[Libav-user] Reducing latency of file opening (when playing from http)
Kalileo
kalileo at universalx.net
Wed May 15 05:20:03 CEST 2013
On May 15, 2013, at 09:36 , Bjoern Drabeck wrote:
>>
>> This is also what I noticed, when playing with probesize and analyzeduration trying to get the player to start more quickly (using mpegts (h264/aac) streams served through a memory buffer).
>>
>> This leads to the question why does a known stream need to get probed / analyzed at all? If all values are known, they could be set before, and decoding / playing should start right away, skipping the step of av_find_stream_info. Unfortunately so far I did not manage to get this to work, av_find_stream_info seems to set something which is required for decoding to work.
>>
>> I looked though the av_find_stream_info source code and did not find anything special happening there, or I did not recognize it.
>>
>> So, to reduce latency, what has to be set for a codec / context to allow to skip the time-consuming step of av_find_stream_info?
>
>
> Just one thing I wanted to mention:
>
> 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?
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.
>
> 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).
Which is why I would love to configure all possible settings which can be set before these functions are called.
More information about the Libav-user
mailing list