Opened 9 years ago

Closed 9 years ago

#1480 closed enhancement (wontfix)

Grouping of command line options for more clarity

Reported by: burek Owned by:
Priority: wish Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Maybe it might be good to implement some kind of grouping of command line options, to make it more clear and readable (especially for new users of FFmpeg) and to clearly distinguish which option belongs to what. Consider the following example:

ffmpeg {-f mjpeg -r 25 -i input} {-c:v libx264 -crf 23 -preset medium} {-acodec libfaac -ab 32k -ar 44100 -ac 2} {-f mpegts output}

Here we have all the options grouped by their associated inputs/outputs/streams. This would (maybe) help make the command lines more readable.

Change History (4)

comment:1 by Nicolas George, 9 years ago

You can already write your command line that way:

ffmpeg \\
  -f mjpeg -r 25 -i input  \\
  -c:v libx264 -crf 23 -preset medium \\
  -acodec libfaac -ab 32k -ar 44100 -ac 2 \\
  -f mpegts output

if you want. Is it not readable enough for you?

comment:2 by burek, 9 years ago

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 FFmpeg.

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 suggested.

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 :)

comment:3 by Stefano Sabatini, 9 years ago

Honestly I consider this a bad idea.

The suggestion is not well specified, it will possibly add much complexity, it could have side effects and glitches, would complicate shell escaping ("{" is special for many shells), so I'd consider this more trouble than gain.

comment:4 by Carl Eugen Hoyos, 9 years ago

Resolution: wontfix
Status: newclosed

Afaict, this is will not be implemented.

Note: See TracTickets for help on using tickets.