I've manually created a stereo mixdown oft some 5.1 DTS tracks. Now I would like to add the new audio track to the original movie file, without dropping the old audio tracks.

My problem appears to be that I either miss to hand ffmpeg the correct mapping of the tracks (the file has a two audio tracks already and a number of subtiles, which appear to count too), so that I receive the "Number of stream maps must match the number of output streams" (quoted from memory), or I even geht the whole stream/map concept wrong.

Is there any good explanation for what I'm trying to do? I'd even read a whole text about the topic, the documentation in ffmpeg.org just isn't that helpful in this case.

To be more specific: I want to know if there is any way to make ffmpeg display the actual stream mapping of a file and how can I merge my stereo track into it?

Everything I've found so far deals with silent videos vor replacling an audio track, which is not what I want to do.

ffmpeg -i input.mkv -i audio.dts -map 0 -map 1 -c copy output.mkv

The default stream selection behavior only chooses one stream per stream type, so in this case you have to use -map to tell it which streams you want.

The input file index starts counting from 0, so using -map 0 will choose all streams from the first input (input.mkv), and -map 1 will choose all streams from the second input (audio.dts).

The result is that output.mkv will contain all of the streams from both inputs. Using -c copy will stream copy the streams, so they will simply be re-muxed without additional re-encoding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.