[FFmpeg-user] format_whitelist and fFMPEG command

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Aug 10 19:51:42 CEST 2015


Moritz Barsnick <barsnick <at> gmx.net> writes:

> On Sat, Aug 08, 2015 at 21:39:14 +0000, Dani A wrote:
> > Does the White_list switch forces the FFMPEg to look 
> > into the container to verify if it is mp4 or mov file?

No.
The input option "-f" allows you to force a container, 
if it is not specified, FFmpeg will try to guess the 
container. Only if it fails to guess the container will 
it use the extension.
Whitelist allows you to specify which container formats 
it should consider (and, implicitly, which it should not 
consider) when it tries to guess the format.

> ffmpeg always looks into a container, otherwise it 
> cannot demux. You can influence the way it does this 
> with "-probesize" and "-analyzeduration".

(analyzeduration is used to specify how far into the 
file it should look for codecs, it should not influence 
the container selection iirc.)

> > I have used the white_list switch and I have 
> > renamed the a .mov file to .mp4 and I tried to use 
> > the FFMPEG -white_list "Mp4", it went ahead with 
> > moving the atom for the renamed file and I expected 
> > it will check the file content and then display an 
> > error as it is a mov file with a mp4 extension.
> 
> How do you move the atom by renaming? I don't get it.
> 
> Anyway: ffmpeg doesn't care for the extension (though 
> it uses it as a hint for the muxer, but not for the 
> demuxer, I believe). It does check the content.

Some file formats are not auto-detected by FFmpeg, for 
example pnm, and some cannot be auto-detected, for 
example "yuv10" (an extension used for high-bitrate 
rawvideo), in these cases the extension is used by 
FFmpeg for demuxing.

> Furthermore, if you had read the output quoted by me 
> in the thread, you would have seen that, from 
> ffmpeg's perspective, mp4 and mov containers are the 
> same thing. ffprobe -show_format show this for both:
> 
> format_name=mov,mp4,m4a,3gp,3g2,mj2
> 
> In other words: ffmpeg doesn't know or doesn't expose 
> the difference, probably because the same demuxer is 
> used. 

Correct.

> If what you're trying to do is to fix the minor 
> differences (which are in atoms apparently), you'll
> need to do this pre-check for this detail outside of 
> ffmpeg. AtomicParsley comes to mind.

You could also read the console output:
For mov, it will report "major_brand: qt", for mp4 it 
should be "major_brand: isom".

> > So where is the security in the white_list command?

Software contains bugs, large software like FFmpeg 
contains many bugs. Some of these (unknown) bugs are 
security-relevant.
If you know that all your input is either matroska 
or avi, you can specify the following to make sure 
bugs in other demuxers will not hit you:
$ ffmpeg -format_whitelist matroska,avi -i input

Similar for -codec_whitelist

Carl Eugen



More information about the ffmpeg-user mailing list