Changes between Version 5 and Version 6 of FilteringGuide


Ignore:
Timestamp:
Dec 1, 2011, 11:00:43 AM (5 years ago)
Author:
nichot20
Comment:

Added some syntax equivalence samples

Legend:

Unmodified
Added
Removed
Modified
  • FilteringGuide

    v5 v6  
    2222 
    2323Please show a complete command if you would like to add more examples. 
     24---- 
     25=== Filtergraph,Chain,Filter relationship === 
     26What follows the -vf in an ffmpeg command line is a Filtergraph description. This filtergraph may contain a number of chains, each of which may contain a number of filters. 
    2427 
     28Whilst a full filtergraph description can be complicated, it is possible to simplify it for simpler graphs provided ambiguity is avoided. 
     29 
     30Remembering that filters in a chain are separated by commas "." chains by a semicolon ";" and that if an input or output is not specified it is assumed to come from the preceding or sent to the following item in the chain. 
     31 
     32The following are equivalent:- 
     33{{{ 
     34ffmpeg -i input -vf [in]scale=iw/2:-1[out] output 
     35ffmpeg -i input -vf scale=iw/2:-1 output                                      # the input and output are implied without ambiguity 
     36}}} 
     37 
     38As are:- 
     39{{{ 
     40ffmpeg -i input -vf [in]yadif=0:0:0[middle];[middle]scale=iw/2:-1[out] output # 2 chains form, one filter per chain, chains linked by the [middle] pad 
     41ffmpeg -i input -vf [in]yadif=0:0:0,scale=iw/2:-1[out] output                 # 1 chain form, with 2 filters in the chain, linking implied 
     42ffmpeg -i input -vf yadif=0:0:0,scale=iw/2:-1  output                         # the input and output are implied without ambiguity 
     43}}} 
     44 
     45=== Escaping characters === 
     46As described in the documentation, it can be necessary to escape commas "," that need to appear in some arguments, for example the select filter:- 
     47{{{ 
     48ffmpeg -i input -vf select='eq(pict_type\,I)' output                         #to select only I frames 
     49}}} 
     50 
     51However an alternative, which also allows for white space within the filtergraph, and which may assist in clarity of reading complex graphs, is to enclose the whole filtergraph within double quotes " " thus:- 
     52{{{ 
     53ffmpeg -i input -vf "select=eq(pict_type,I)" output                          #to select only I frames 
     54ffmpeg -i input -vf "yadif=0:-1:0, scale=iw/2:-1" output                     # deinterlace then resize 
     55}}} 
     56Note that the examples given in the documentation mix and match the use of "full quoting" and "\" escaping, and that use of unusual shells may upset escaping. 
    2557---- 
    2658 
     
    90122 
    91123}}} 
    92  
    93