0

I have a video with 2 audio tracks.

After using the following command line the other audio track is gone

ffmpeg -i "movie.mkv" -i "subtitles.ass" -c:v copy -c:a copy -c:s copy "movie with subtitles.mkv"

What am I doing wrong?

1
  • try to add mapping: ffmpeg -i "movie.mkv" -i "subtitles.ass" -map 0 -map 1 -c copy "movie with subtitles.mkv" Aug 26, 2023 at 6:05

1 Answer 1

0

If you don't use the -map options, then by ffmpeg Documentation :

ffmpeg will pick one stream, when available, from among all the inputs.

It means that it selects only one video stream, only one audio stream, and only one subtitle stream (by criteria listed in that doc).

So you have to use -map option:

ffmpeg -i movie.mkv -i subtitles.ass -map 0:v -c copy -map 0:a -c copy -map 1:s -c copy "movie with subtitles.mkv"

The detailed explanation:

ffmpeg -i movie.mkv -i subtitles.ass ...

Input files are introduced with -i options, and are enumerated from 0, so

  • movie.mkv has the number 0,
  • subtitles.ass has the number 1.

This number is the first one in every -map option:

... -map 0:v -map 0:a:0 - map 0:a:1 -map 1:s ...

After the semicolon (:) may be the stream specifier, in your case:

  • v for video stream
  • a for audio stream
  • s for subtitle stream

If there is only one video stream or only one audio stream or only one subtitle stream in a particular input file, there is nothing more to specify:

... -map 0:v ... -map 1:s ...

In your more complicated case with more audio streams, after another semicolon you may specify its ordinal number, enumerated again from 0:

... -map 0:a:0 -map 0:a:1 ...

or – in your case - you my simply omit ordinal number to select all audio streams:

... -map 0:a ...

Note:

The offered command may be further simplified.

To better understand stream specifiers (as e.g. 0:a:1), see my another answer – at least the picture near the end of it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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