[libav-api] how to continue to read growing flv file after first eof?

Ronald S. Bultje rsbultje at gmail.com
Fri Aug 26 20:09:30 CEST 2011


On Fri, Aug 26, 2011 at 5:52 AM, Zsolt V <vtkzsolt at gmail.com> wrote:
> Hi,
> I am new in using libav and cannot find a solution to my problem. We have a
> server program that can capture video from webcam and save the stream into
> an flv file (on linux). This program was not written by us, we cannot modify
> it. My task is to write a program that listens to a target directory, and if
> new flv file appears, start processing it immediately. I use libavformat and
> libavcodec to read from flv and decode frames.
> The problem is that I start reading the flv file before it is finished. When
> av_read_frame reaches EOF, it will not continue any more, even if new data
> arrive later. This is because av_find_stream_info reads the packets into a
> buffer at the beginning (when the flv file is small), and when the end of
> this buffer is reached, it is not updated, no new data are added to it. I
> did not find the solution how to update the buffer, or how to treat the file
> as an endless stream.
> The corresponding part of my code is attached.

Check AVFormatContext->pb->eof_reached, and set it to zero if it's 1
and you believe there's new data added.


More information about the libav-api mailing list