[Libav-user] http streaming latency depends on frame rate

Andrey Utkin andrey.krieger.utkin at gmail.com
Sat Jun 9 18:14:18 CEST 2012

среда, 6 июня 2012 г. пользователь Aleksey Shubin <x.morion.x at gmail.com>
> Good day to all.
> I'm using libav in my application to encode live video to h264, mux it
> in Live Smooth Streaming format and send to IIS Live Smooth Streaming
> publishing point (via http).
> I need to achieve quite low latency (<3 seconds) of live video. When

Latency you address everywhere in the letter is playback start latency, or
time latency on player side? I assume first.

> the video is recorded on regular frame rate (20-30 fps), everything is
> good and latency is even lower. But when I try lower fps values, the
> latency grows. For 5 fps the latency is 5-6 seconds, for 2 fps it is
> 11 seconds and for 1 fps - 21 second.
> I've measured time of the encoding of each frame, it is approximately
> 1.5 seconds and didn't changed with fps. Also disabled all buffering
> at the video player side to exclude it. So the problem seems to be
> somewhere at http transfer process (that is performed by libav too).
> First I thought that some kind of buffer is used in libav for http
> transfer, and on the lower frame rate it is filled slower, and that's
> the reason of increased latency. But changing video resolution and
> bitrate doesn't affect on latency, though obviously should change
> encoded frame size and so change the buffer filling rate.
> Now I'm completely out of ideas what is reason of that latency and how
> to remove it. Does anyone have any suggestions?

I just don't know, does iis streaming format have global metadata headers,
or not. If not, the delay could be introduced by seeking for in-stream
metadata. Afaiu x264 encodes instream metadata into keyframes, which go
once per "keyframes interval" video frames. This explains why things are
bad on low fps. You could try reduce keyframe interval for such cases.

Andrey Utkin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120609/2f209ade/attachment.html>

More information about the Libav-user mailing list