[FFmpeg-user] Confused with an example of stream mapping in ffmpeg man page

Gyan Doshi ffmpeg at gyani.pro
Thu Aug 27 15:30:39 EEST 2020



On 27-08-2020 05:26 pm, scrutinizer wrote:
> The example reads as follows:
>
> ffmpeg -i multichannel.mxf -map 0:v:0 -map 0:a:0 -map 0:a:0 -c:a:0 ac3 -b:a:0 640k -ac:a:1 2 -c:a:1 aac -b:2 128k out.mp4
>
>         In the above example, a multichannel audio stream is mapped twice for output.  The
>         first instance is encoded with codec ac3 and bitrate 640k.  The second instance is
>         downmixed to 2 channels and encoded with codec aac. A bitrate of 128k is specified
>         for it using absolute index of the output stream.
>
>
> We see the second audio stream appearing as in “-ac:a:1" and “-c:a:1” and the set of options is capped with the absolute index for the stream number 2 written as “-b:2”. However the second manual mapping option is “-map 0:a:0” in the example. Shouldn’t it have been “-map 0:a:1”? Prior to the example we don’t know anything about how many streams are in the output and input files. If there’re more than 1 then it’s logical to assume that audio-stream number 1 is encoded with ac3, while the other one is set to be made as a 2-channel encoded with aac.
> Does all above mean that the correct command line should’ve been
> “ffmpeg -i multichannel.mxf -map 0:v:0 -map 0:a:0 -map 0:a:1 -c:a:0 ac3 -b:a:0 640k -ac:a:1 2 -c:a:1 aac -b:2 128k out.mp4”?

The stream specifier in `-map` refers to the input indices, whereas the 
specifiers for -codec or other output options refer to the output 
indices. The example shows the same input audio stream being mapped 
twice, thus creating two output streams. Then different output options 
are set for each of those output streams.

Gyan


More information about the ffmpeg-user mailing list