[Libav-user] avformat_find_stream_info/avformat_open_input speed

Nikola Spiric nikola.spiric.ns at gmail.com
Thu May 18 03:44:19 EEST 2017


Hello Carl,

Thanks for the response !

> Yes, there is no free lunch.
> You will have to find values that work for you and are smaller than
> the default.
The problem is that I'm working with a RTP multicast streams; not static 
files. So what I see happening a lot is the following:

  * I set values that are smaller than the default
  * The values work in most cases; however some times they do not. When
    this happens; what is the best course of action ? Can I just
    increase the values and try again without wasting too much time ?

> How do you know you have gathered "all the basic information" of
> a transport stream?
> (There was a sample stream for which -probesize 2G was not enough
> so we increased the range for the option.)
I guess I could have been clearer, sorry. What I meant was; is there a 
way of telling FFMPEG to imminently stop analyzing the stream (even if 
the "probesize" number of bytes haven't been used up yet) once it 
gathers enough information about the stream ?

So for instance if the *probesize *is set to 4MB; if my understanding is 
correct FFMPEG will finish avformat_find_stream_info/avfromat_open_input 
only when it reads all 4MB of data. Isn't there a way to stop it from 
reading the rest if for instance, only 1MB was enough to get the 
metadata from the stream ?

So I guess what I'm trying to say is; I would like it to stop analyzing 
the stream:

  * In case of audio, as soon as it detects the codec type, sample rate
    and number of channels.
  * In case of video, as soon as it detects the codec type, video
    resolution and "extradata" in case of H264/H265

Best regards,
Nikola


On 17-May-17 10:05, Carl Eugen Hoyos wrote:
> 2017-05-15 11:09 GMT+02:00 Nikola Spiric<nikola.spiric.ns at gmail.com>:
>
>> I tried reducing "probesize" and "analyzeduration" parameters with
>> mixed results. Sometimes it indeed does speed up mentioned function
>> calls; however they often just result in the functions failing (i.e. they
>> don't get enough data to provide me with all the information I need).
> Yes, there is no free lunch.
> You will have to find values that work for you and are smaller than
> the default.
>
>> So my question is: Is there a way to tell FFMPEG to stop analyzing the
>> stream once it gathers all the basic information (video width/height,
>> h.264/HEVC extra data or audio sample rate/number of channels) ?
> How do you know you have gathered "all the basic information" of
> a transport stream?
> (There was a sample stream for which -probesize 2G was not enough
> so we increased the range for the option.)
>
>> I really need a way of speeding up these two function calls (5
>> seconds is not acceptable for my needs).
> 5 seconds seem extremely long on current hardware.
>
> Carl Eugen
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170518/75a97211/attachment.html>


More information about the Libav-user mailing list