[Libav-user] http streaming latency depends on frame rate
i.like.privacy.too at gmail.com
Sun Jun 10 00:50:42 CEST 2012
On 06/06/2012 02:57 AM, Aleksey Shubin wrote:
> Now I'm completely out of ideas what is reason of that latency and how
> to remove it. Does anyone have any suggestions?
What player are you using? Most players (e.g. Windows Media Player or
anything based on the Windows Media Codec infrastructure) will not play
until they have buffered a few seconds of data (this can be adjusted,
but not below 1 second if I recall correctly; the default used to be 5
If you are using ffplay / libav / ffmpeg as the decoder, be aware that
by default it will use a multithreaded decoder in which each frame is
decoded by a different thread, where the number of threads is the number
of cores; This configuration introduces a delay of (number of cores)
frames in the ffplay/ffmpeg decoding process, regardless of any other
buffer - by switching to single-threaded mode, you can eliminate this delay.
Further, depending on your encoding settings, there will be a delay of
(number of reference frames). e.g. I have a camera that puts "number of
refs = 4" in the stream, despite never using more than 1 ref; as a
result, every conforming h264 decoder introduces a delay of 4 frames.
This number is stream dependent and can go as high as 16. If you can
control your encoder, set it to a low-latency mode (which means no B
frames, max reorder=0, and only 1 reference frame).
More information about the Libav-user