[Libav-user] Reducing latency of file opening (when playing from http)

Bjoern Drabeck bjoern.drabeck at gmail.com
Wed May 15 06:09:46 CEST 2013

>> When I am opening a file I call avformat_open_input, then after that I
>> call avformat_find_stream_info, and I am timing those calls:
>> 'avformat_open_input':          9.7970 seconds
>> 'avformat_find_stream_info':  0.1080 seconds
>> So for me the problem seems to be avformat_open_input. My testfiles
>> are all around that range, maybe +-2 sec
> You mentioned that you read the files using http urls, so isn't there the download time included in the values you measure for avformat_open_input?
Yeah sure, it will have to get the data first, but I am wondering if
that amount of data can be reduced, because 10 sec seems quite long to
me for opening, but those probesize etc don't seem to make a

On the other hand, once I have opened, and I seek to a spot later in
the file, it is so fast it is almost instant.. so that's why I
wondered if the amount of data analyzed/download on initial opening
can be reduced...

> In my case I fill a memory buffer first and then feed that to the avformat functions.
> Nevertheless I will time these two functions again. I always assumed that the time is lost in avformat_find_stream_info and not in avformat_open_input, but may be my assumption was wrong.

yeah please let me know your findings, am curious to hear...

>> As I mentioned before, changine probesize/analyzeduration from 5000000
>> to 5000 doesn't seem show any visible effect (just ranging within the
>> usual fluctuations of the above timings)
>> Is that what you experienced too?
> if I reduce probesize/analyzeduration it does not get faster, but at some point it fails to recognize the streams. At 100000 it does fail most of the time (mpegts h264/aac).

for me I can often go down as low as 5000 (or at least 10000) before
it starts failing.. but the timing doesn't seem to change really...

> Which is why I would love to configure all possible settings which can be set before these functions are called.

yeah me too...


More information about the Libav-user mailing list