[FFmpeg-user] Selecting MPEG TS child streams for filter_complex

Mark Filipak markfilipak.windows+ffmpeg at gmail.com
Mon Mar 16 23:11:52 EET 2020

On 03/16/2020 04:37 PM, Carl Zwanzig wrote:
> On 3/16/2020 6:24 AM, Gyan Doshi wrote:
>> -filter_complex is a global option, so parsed first, then input files, then the complex filtergraphs are set up, then output files.
> Is there any reason, then, not to always put -filter_complex as the first parameters of the command line? The Synopsis line in the docs shows global options first but most of the doc examples don't.
> Example-
> ffmpeg -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map '[out]' out.mkv"
> Or is there another reason for listing inputs, then -filter_complex, then outputs?

I've been told several times by several gurus that filters, including filter_complex, are output specific and must be specified directly before the output to which they apply, and, for processes that have multiple outputs, can be different for each output.


PS: Follow-up. Here's my style of documentation, best viewed as plain text, for the overall structure of commands:

Basic command example:
         1ST INPUT  ADDITIONAL INPUTS      OUTPUTS        ...Note 1
ffmpeg  [A]  -i B   [[C]  -i D ...]  [[E] [F]  G ...]]   ...Note 2
     [A] -i B     : the 1st input's specification.
                  : [A] : the 1st input's options, if any.
                  :  B  : the 1st input's URL.
  [[C] -i D ...]  : additional input specifications, if any.
                  : [C] : the 2nd input's options, if any.
                  :  D  : the 2nd input's URL.
                  : ... : more input specifications.
  [[E] [F] G ...] : output specifications, if any.
                  : [E] : an output's filter chain, if any.
                  : [F] : an output's options, if any.
                  :  G  : an output's URL.
                  : ... : more output specifications.
Note 1: All inputs first, then all outputs.
Note 2: A B C D E F G are tokens that appear here simply to preserve
Note 3: Global options (not shown) can be anywhere except within
         another option or at the end of the command.
Note 4: Braces, [], denote options here but should not appear in actual
         commands except where ffmpeg docs indicate (for example, input
         and output pads in filter chains).

More information about the ffmpeg-user mailing list