Changes between Version 24 and Version 25 of Map
- Timestamp:
- Aug 8, 2020, 9:31:53 PM (8 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Map
v24 v25 14 14 The commands in the diagram above will select the video from `input0.mp4` and the 3rd audio stream from `input1.mkv` to `output.mp4`. The commands do the same thing, but use different syntax to map streams: 15 15 16 * The top command does not use any ''stream specifiers''. This is an absolute method of mapping and will choose a specific stream regardless of type. 17 * The bottom command includes [https://ffmpeg.org/ffmpeg.html#Stream-specifiers-1 stream specifiers] (`v` for video, `a` for audio) to limit the streams to a specific type. 16 * The top command does not use any ''stream specifiers''. This is an absolute method of mapping and will choose a specific stream regardless of type. `-map 1:3` refers to ''"second input:fourth stream"''. 17 * The bottom command includes [https://ffmpeg.org/ffmpeg.html#Stream-specifiers-1 stream specifiers] (`v` for video, `a` for audio) to limit the streams to a specific type. `-map 1:a:2` refers to ''"second input:audio only:third audio stream"''. 18 18 19 Translation: 19 = Simple examples = 20 20 21 * `-map 1:3` refers to ''"second input:fourth stream"''. 22 * `-map 1:a:2` refers to ''"second input:audio only:third audio stream"''. 21 * `-map 0` From input index !#0 (the 1st input) select all streams. 22 * `-map 1:a` From input index !#1 (the 2nd input) select all audio streams. 23 * `-map 3:s:4` From input index !#3 (the 4th input) select subtitle stream index !#4 (the fifth subtitle stream). 24 * `-map 0 -map -0:s` Will select all streams from input index !#0 (the 1st input) except subtitles. The `-` indicates ''negative mapping''. 23 25 24 26 = Default behavior = … … 26 28 If you do not use the `-map` option then the default [https://ffmpeg.org/ffmpeg.html#Stream-selection stream selection] behavior will automatically choose streams. 27 29 28 * Default stream selection will '''not''' automatically choose allof the streams.29 * Only onestream per type will be selected. For example, if the input has 3 video streams it will only choose 1.30 * Default stream selection will '''not''' automatically choose '''all''' of the streams. 31 * Only 1 stream per type will be selected. For example, if the input has 3 video streams it will only choose 1. 30 32 * The default stream selection will choose streams based upon [https://ffmpeg.org/ffmpeg.html#Automatic-stream-selection specific criteria]. 31 33 … … 51 53 == Modifiers == 52 54 53 * A `-` character before the `input_file_index`, such as `-map -0:v`, creates a ''negative mapping''. It disables matching streams from already created mappings. See [#Everythingexceptaudio example].54 * A trailing `?`, such as `-map 1:a?`, will allow the map to be optional. If the map matches no streams the map will be ignored instead of failing. Note the mapping will still fail if an invalid `input_file_index` is used; such as if the map refers to a non-existent input. See [#Optionalmapping example].55 * A `-` character before the `input_file_index`, such as `-map -0:v`, creates a ''negative mapping''. This excludes streams already selected by a previous map. See [#Everythingexceptaudio example]. 56 * A trailing `?`, such as `-map 1:a?`, will allow the map to be optional. If the map matches no streams the map will be ignored instead of failing. Note the mapping will still fail if an invalid `input_file_index` is used; such as if the map refers to an input that does not exist. See [#Optionalmapping example]. 55 57 56 58 == Order == … … 60 62 * `-map` order determines the stream order in the output(s). 61 63 * Mapping is applied in order. This is useful when using negative mapping. 62 63 == Simple examples ==64 65 To better understand the syntax here are some examples and descriptions:66 67 * `-map 0` From input index !#0 (the 1st input) select all streams.68 * `-map 1:a` From input index !#1 (the 2nd input) select all audio streams.69 * `-map 3:s:4` From input index !#3 (the 4th input) select subtitle stream index !#4 (the fifth subtitle stream).70 * `-map 0 -map -0:s` Will select all streams from input index !#0 (the 1st input) except subtitles. The `-` indicates ''negative mapping''.71 64 72 65 = Examples = … … 177 170 == Re-order streams == 178 171 179 The order of your `-map` options determines the order of the streams in the output. In this example the input file has audio as stream !#0 and video as stream !#1 (which is possible but unusual). Example to re-position video followed byaudio:172 The order of your `-map` options determines the order of the streams in the output. In this example the input file has audio as stream !#0 and video as stream !#1 (which is possible but unusual). Example to re-position video so it is listed first, followed by the audio: 180 173 181 174 {{{