[Libav-user] Receiving MPEGTS and fifo buffer overflows
andrey.krieger.utkin at gmail.com
Thu May 30 21:07:35 CEST 2013
2013/5/30 Vahid Kowsari <vahid at kowsari.com>:
> 1. Increased the the fifo_size, set overrun non fatal
> 2. Made my avcodec_decode_video2 and my processing of the frame in different
> threads and use a queue of frames between them.
Doing 1 and 2, you are near to the right way.
Make separate thread for av_read_frame(), and another for decoding and
processing. Decoding (key)frame may take significant time, and at this
moment connection buffer gets overflowed. If you do av_read_frame()
all the time without waiting for anything else (and working on
anything else) you don't get such error.
Even simpler, you may proceed increasing fifo_size, and it should make
problem go away. Setting its size to something like stream bitrate (in
bytes per second) * 1 second should do that. Note that -fifo_size
option takes value in units of 188 bytes.
One more point: when you get such error of losing MPEGTS data, but
having overrun_nonfatal set to 1, you get decoding errors, but
consequence is just quality degradation, and possibly lost frames.
Correctly working application can live with it without need to restart
More information about the Libav-user