FFmpeg not copying all audio streams

FFmpeg have option to map all streams to output, you have to use option -map 0 to map all streams from input to output.

In full line it might look like:

ffmpeg -i in.mp4 -c copy -map 0 out.mp4

For more info see the documentation on stream selection and the -map option.


Apparently this is a popular question, so I'm posting my solution as an answer (was previously a comment reply) so that others can see.

I managed to find the correct syntax from this ticket. The correct syntax is:

ffmpeg -i in.mp4 -vcodec copy -c:a copy -map 0:0 -map 0:1 -map 0:2 out.mp4

This will copy all 3 streams.


OK, I read pretty deep into the ffmpeg man page and found this which should be useful:

Note that currently each output stream can only contain channels from a single input stream; you can't for example use "-map_channel" to pick multiple input audio channels contained in different streams (from the same or different files) and merge them into a single output stream. It is therefore not currently possible, for example, to turn two separate mono streams into a single stereo stream. However splitting a stereo stream into two single channel mono streams is possible.

If you need this feature, a possible workaround is to use the amerge filter. For example, if you need to merge a media (here input.mkv) with 2 mono audio streams into one single stereo channel audio stream (and keep the video stream), you can use the following command:

ffmpeg -i input.mkv -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le -c:v copy output.mkv

You may want to read through and experiment with the man page instructions on man ffmpeg-filters to understand just what level of complexity you're getting into for naming channels and expected output.

[Edit: As Mulvya noted, this answers a question, but it was not quite the original poster's question.]