


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 \ encode german audio stream to mp3 (128kbps) and aac (96kbps) (creating 2 audio streams in the output).Stream #0:3(ger): Subtitle: text (default)Īt least one output file must be specified Copyright (c) 2000-2012 the FFmpeg developers In all following examples, we will use an example input file like this one: # fmpeg -i input.mkvįfmpeg version. The order of -map options, specified on cmd line, will create the same order of streams in the output file. 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.
