Jump to content
  • 0

Webrtc delay from a rtmp live stream encoded using FFmpeg




I am currently running a c++ application which emit a rtmp live stream using FFmpeg and libopenh264 as the encoder. This rmtp live stream then pass through antmedia server which convert it to a webrtc live stream.

I am following this guide to reduce delay: Minimizing the initial delay | VideoKit (iosvideokit.com)

I set those specific parameters:

- reduce the Iframe interval with the gop parameter to 1 every five frame (gop_size = 5)

- reduce the probe size parameter to 32 (Maximum number of bytes read from input in order to determine stream properties.)

- reduce the maxAnalyseDuration to 32 (Maximum duration (in AV_TIME_BASE units) of the data read from input in avformat_find_stream_info())

I am still noticing a 12 seconds delay inside the html viewer from the antmedia interface. When I am reading the log I saw that antmedia are reencoding the stream using libopenh264.

Is there some official guidelines to reduce delay from a rtmp live stream to a webrtc application ?


Here are the logs from the antmedia platform also attach in log format.



I saw the gopsize getting updated to 60fps, so the video is getting re-encoded. Is there a way to stop this process.

Latency is a huge deal in our application, thank you for your time.


Edited by ThibaultOber
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Webrtc does not support ACC audio encoding so AMS transcode ACC to Opus. Can you plese try setting the key frame interval to once every 2 sec.can you try setting the encoder speed as veryfast.

Edited by usama
  • Like 1
Link to comment
Share on other sites

  • 0

you can refer this

ffmpeg -re -i 'video.mp4'  -c:v libx264 -b:v 1600k -preset ultrafast -b 900k -c:a aac -b:a 128k -s 1920x1080 -x264opts keyint=50 -g 25 -pix_fmt yuv420p -f flv rtmp://stream.serverok.in/LiveApp/225873992721868053400782

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...