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

Zsolt V vtkzsolt at gmail.com
Fri Aug 26 14:52:05 CEST 2011


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.

Thanks for help in advance,
Zsolt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libav.org/pipermail/libav-api/attachments/20110826/2a79fcd5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: code.cc
Type: text/x-c++src
Size: 2955 bytes
Desc: not available
URL: <http://lists.libav.org/pipermail/libav-api/attachments/20110826/2a79fcd5/attachment.cc>


More information about the libav-api mailing list