| 28 | | FFmpeg assumes the option names in the order they are declared in the source code. For instance, in this use of the [http://ffmpeg.org/ffmpeg-filters.html#scale scale filter], FFmpeg assumes the option name `width` for the value `iw/2`, and the name `height` for the value `-1`. |
| 29 | | |
| 30 | | == Examples == |
| 31 | | |
| 32 | | === Scaling === |
| 33 | | Starting with something simple. Resize a 640x480 input to a 320x240 output. |
| 34 | | {{{ |
| 35 | | ffmpeg -i input -vf scale=iw/2:-1 output |
| 36 | | }}} |
| 37 | | `iw` is input width. In this example the input width is 640. 640/2 = 320. The `-1` tells the scale filter to preserve the aspect ratio of the output, so in this example the scale filter will choose a value of 240. See the [http://ffmpeg.org/ffmpeg-filters.html#scale FFmpeg documentation] for additional information. |
| 38 | | |
| 39 | | === Speed up your video === |
| 40 | | |
| 41 | | See [[How to speed up / slow down a video]] for examples. |
| 42 | | |
| 43 | | === Filtergraph,Chain,Filter relationship === |
| | 28 | FFmpeg assumes the option names in the order they are declared in the source code. For instance, in this use of the [http://ffmpeg.org/ffmpeg-filters.html#scale scale filter], FFmpeg assumes the option name `width` for the value `iw/2`, and the name `height` for the value `-1`. |
| | 29 | |
| | 30 | === Filtergraph, Chain, Filter relationship === |
| | 31 | |
| 63 | | === multiple input overlay in 2x2 grid === |
| | 51 | === Escaping characters === |
| | 52 | |
| | 53 | As described in the documentation, it can be necessary to escape commas "," that need to appear in some arguments, for example the select filter: |
| | 54 | |
| | 55 | {{{ |
| | 56 | ffmpeg -i input -vf select='eq(pict_type\,I)' -vsync vfr output_%04d.png # to select only I frames |
| | 57 | }}} |
| | 58 | |
| | 59 | However 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: |
| | 60 | |
| | 61 | {{{ |
| | 62 | ffmpeg -i input -vf "select='eq(pict_type,I)'" output # to select only I frames |
| | 63 | ffmpeg -i input -vf "yadif=0:-1:0, scale=iw/2:-1" output # deinterlace then resize |
| | 64 | }}} |
| | 65 | |
| | 66 | Note 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. See [http://ffmpeg.org/ffmpeg-filters.html#Notes-on-filtergraph-escaping Notes on filtergraph escaping] for more information. |
| | 67 | |
| | 68 | == Examples == |
| | 69 | |
| | 70 | === Scaling === |
| | 71 | Starting with something simple. Resize a 640x480 input to a 320x240 output. |
| | 72 | {{{ |
| | 73 | ffmpeg -i input -vf scale=iw/2:-1 output |
| | 74 | }}} |
| | 75 | `iw` is input width. In this example the input width is 640. 640/2 = 320. The `-1` tells the scale filter to preserve the aspect ratio of the output, so in this example the scale filter will choose a value of 240. See the [http://ffmpeg.org/ffmpeg-filters.html#scale FFmpeg documentation] for additional information. |
| | 76 | |
| | 77 | === Speed up your video === |
| | 78 | |
| | 79 | See [[How to speed up / slow down a video]] for examples. |
| | 80 | |
| | 81 | === Multiple input overlay in 2x2 grid === |
| 96 | | === Escaping characters === |
| 97 | | As described in the documentation, it can be necessary to escape commas "," that need to appear in some arguments, for example the select filter: |
| 98 | | {{{ |
| 99 | | ffmpeg -i input -vf select='eq(pict_type\,I)' -vsync vfr output_%04d.png # to select only I frames |
| 100 | | }}} |
| 101 | | |
| 102 | | However 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: |
| 103 | | {{{ |
| 104 | | ffmpeg -i input -vf "select='eq(pict_type,I)'" output # to select only I frames |
| 105 | | ffmpeg -i input -vf "yadif=0:-1:0, scale=iw/2:-1" output # deinterlace then resize |
| 106 | | }}} |
| 107 | | Note 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. See [http://ffmpeg.org/ffmpeg-filters.html#Notes-on-filtergraph-escaping Notes on filtergraph escaping] for more information. |
| 108 | | |