[libav-api] start of a live stream
lu_zero at gentoo.org
Tue Sep 1 12:27:24 CEST 2015
On 28/08/15 08:55, Florian Iragne wrote:
> I'm using libav to decode live audio streams and process them using
> custom code. In this process the start timestamp of the stream is quite
> Currently, i take the timestamp (using std::chrono) at the end of the
> first decoded packet (av_read_frame -> ... -> av_free_packet). Most of
> the time this is fine and i observe no or little difference between this
> start timestamp and the "reality".
> In some cases, i observe huge differences (many seconds).
Are you using find_stream_info? It does cache quite a bit of data by
> So, i wonder if i can be more precise in my timestamp choice.
> Does libav starts buffering when i call avformat_open_input and keeps
> the buffers until i call av_read_frame? When does it really starts to
> read the stream?
When the format does the first read over the protocol the stream starts,
for rtsp there are specific calls to pause/play.
In general it depends on the streaming protocol since read_header could
interact differently depending on the protocol.
Sorry for not having definitive answers.
More information about the libav-api