[Libav-user] latency of mpegts handling in libavformat

Omkiran Sharma omkiran.for.wiki at gmail.com
Mon Jul 25 07:46:11 CEST 2011

 In H.264 can have delay in giving out frames all the way to 16 frames
depending on the type of stream (resolution profile etc). If you need
really low delay (no frame lag) then you need the stream to be encoded
in that mode.  Don't think it is a libav issue at all.

On Mon, Jul 25, 2011 at 10:33 AM, כרמל מגן <carmel.work at gmail.com> wrote:
> I have investigated the matter some more, and it seems that the delay is
> exatcly 2 frames (its 80 ms when I use PAL 25 fps video and 66 ms when I
>  use NTSC 30 fps video). Furthermore, it appears when sending frames 1,2,3
> av_read_frame does not return with frame 1 before I start sending frame 3.
> Does anybody have an idea why this might happen and how I can prevent it?
> Thanks
> Carmel
> 2011/7/19 כרמל מגן <carmel.work at gmail.com>
>> Hello
>> I have been integrating mpeg2 transport stream support into an application
>> I'm developing using libavformat.
>> After successfully transmitting my video (h.264 frames encoded by the
>> calling application) and receiving it, I did some latency testing.
>> To my surprise, I calculated 80 ms between the time that I finished
>> sending the frame in one process (av_write_frame returns) until I finish
>> receiving it in the second process (av_read_frame returns and the packet
>> contains the same frame).
>> To identify the frame I used the pts field of the packet. (i.e I printed
>> the time when sending together with the pts of the frame, and then the time
>> of receiving together with the pts of the frame, and then calculated the
>> difference).
>> This was tested using multicast transmission between 2 processes on the
>> same computer (on two different machines sitting on different networks) so I
>> don't believe network latency can account for it.
>> Can anybody explain what might be taking all that time and how I can
>> reduce it? My application demands very low latency.
>> Thanks
>> Carmel
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

More information about the Libav-user mailing list