[FFmpeg-trac] #1480(undetermined:new): Grouping of command line options for more clarity

FFmpeg trac at avcodec.org
Sat Jun 23 14:58:58 CEST 2012

#1480: Grouping of command line options for more clarity
             Reporter:  burek        |                    Owner:
                 Type:  enhancement  |                   Status:  new
             Priority:  wish         |                Component:
              Version:  unspecified  |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0

Comment (by burek):

 Yes, I know, but it's not about me, it's about new FFmpeg users, that
 usually are not aware that order of options does matter to FFmpeg. One
 example is -ss option, which seeks the input file to the given time point.
 If it is placed before "-i" it is parsed as an input option and if placed
 after "-i" it is parsed as an output option. First case is a lot faster
 and the second case is a lot more accurate, but users who misplace that
 option usually end up thinking that something doesn't work properly in

 This is why I'm suggesting this feature, which can easily help on this
 matter by visually and logically grouping options together. Every group of
 options could be distinguished by '{' and '}' parenthesis. Inside each
 group the order of options wouldn't matter, so it would be the same to
 write these 2 command lines:

 # ffmpeg {-ss 100 -i input} ... {output}
 # ffmpeg {-i input -ss 100} ... {output}

 because each group would belong to a certain input/output. Also, another
 example is "-preset" option, which is usually used for video encoder
 (mostly libx264) but which also conflicts (I recently found this out) with
 aac encoder, because it also has an option named "-preset".

 So writing something like this:
 # ffmpeg -i input -vcodec libx264 -acodec aac -preset medium output
 would set the -preset option for both libx264 and aac, so -preset:v is

 Also, when people are using -map option, after that they need to use
 stream specifiers to specify to which stream the option belongs. This can
 also be solved by this grouping feature.

 For example:
 # ffmpeg {-i input} {-map 0:0 -vcodec libx264 -crf 20} {-map 0:1 -acodec
 aac} {-f mp4 output}

 Keep in mind that order of options inside one group does not matter,
 because each group contains either input/output or a specific stream
 (using -map), so all options are grouped and clearly indicate what is what
 in the command line.

 The above cmd line could be written like this and it would still do the
 same thing:
 # ffmpeg {-i input} {-crf 20 -vcodec libx264 -map 0:0} {-acodec aac -map
 0:1} {output -f mp4}

 I hope you get the idea :)

Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1480#comment:2>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list