[FFmpeg-user] Guessing the output format

Carl Zwanzig cpz at tuunq.com
Sat Feb 27 21:04:21 EET 2021


On 2/27/2021 12:23 AM, Carl Eugen Hoyos wrote:

>>     ffmpeg -f lavfi -i testsrc=duration=5:size=1280x720:rate=30000/1001 testsrc.mpg

> Just for completeness:
> This does not create a MPEG-2 program stream but an MPEG-1 system stream.

No doubt that's correct, although maybe unexpected by many people.


(this is mostly to document things so it can found in the list archive)

ffmpeg-all doc tells us

-f fmt (input/output)
     Force input or output file format. The format is normally auto detected 
for input files and guessed from the file extension for output files,[...]

but there is nothing that explains which guesses are made (and how) on the 
output format. Most should be fairly obvious (e.g. .ogg or .wav); the 
confusion comes when you get to all of the MPEG-related formats (vob, dvd, 
mp2, mp4, etc), all of which -might- be found in a file called .mpg (right 
or wrong, it happens).

ffmpeg -muxers will show a list of muxers and what appear to be their 
default file extensions (although .mpg isn't shown, .mpeg is; it's 
reasonable to treat them as same).


Note also that this identifies the -container-, not necessarily the codec or 
other parameters. For instance- nothing specifically mentions the difference 
between the MPEG-2 PS in .vob vs .dvd. This is similar to the -target 
option, the doc page doesn't mention all of the parameters that are being 
set (it's only in the code).


(It appears that the work starts with av_guess_format() calling 
av_muxer_iterate() which then looks over the list of all muxers (in 
muxer_list.c) and appears to check each one in turn to see what it thinks of 
the file name/extension/mime-type passed. When time permits, I may dive more 
deeply into this.)


Later,

z!



More information about the ffmpeg-user mailing list