[Libav-user] Probing a file

wm4 nfxjfg at googlemail.com
Thu Mar 13 16:15:05 CET 2014


On Wed, 12 Mar 2014 20:55:28 -0300
Gonzalo Garramuno <ggarra13 at gmail.com> wrote:

> I am wondering, in code, what's the most reliable way to probe a file to 
> see if ffmpeg will open it.  I can open a context and see the return 
> value.  However, this returns true for image formats like jpeg, png, and 
> others and I find those handled better with other libraries.  Is there a 
> way to have ffmpeg test to open only video codecs with no image codecs.
> Currently the hack I have is:

Personally I just use av_probe_input_format2() and accept the result
only if it's at least "AVPROBE_SCORE_MAX / 4 + 1", which is documented
as the recommended limit. I also don't set the filename, so no
extension matching is performed. (Although I do a second pass with
filename set, but only after I run my own image format checks.)


More information about the Libav-user mailing list