
If we want to extract only audio streams, from input file, then we can do it like this: ffmpeg -i input.mkv -map 0:1 -map 0:2 -c copy output.mkv The option “-c copy” tells FFmpeg to use “copy” on all streams. Note that we specified all the input streams, but in the reverse order, which causes that order to be respected in the output. This can simply be done using the following command line: ffmpeg -i input.mkv -map 0:3 -map 0:2 -map 0:1 -map 0:0 -c copy output.mkv Let’s say that we want to reorder input streams backwards, so that we have output like this: Stream #0:0(ger): Subtitle: text (default)

The result will be: Output #0, matroska, to 'output.mkv': Note that “a:0” refers to the output’s first AUDIO stream ( #0:1 in our case), “a:1” refers to the output’s 2nd AUDIO stream ( #0:2 in our case), etc. We used “-c:a:0” to specify codec for the output’s first AUDIO stream and “-c:a:1” to specify codec for the output’s second AUDIO stream. Video and subtitle stream have just been copied and german audio stream has been encoded to 2 new audio streams, mp3 and aac. So, our output will now have the following streams: Output #0, matroska, to 'output.mkv':Īfter we selected which streams we would like in our output, using “-map” option, we specified codecs for each stream in our output. Using “-map 0:0 -map 0:1 -map 0:1 -map 0:3” we told FFmpeg to select/map specified input streams to output in that order. Note there is no “-map 0:2” and that “-map 0:1” has been specified twice. This can be done using the following FFmpeg command line: ffmpeg -i input.mkv \


The best way to understand -map option is to think of it like a way to tell FFmpeg which streams do you want to select/copy from input to output.
