I have a video with 1 video stream, 2 audio streams (TrueHD 7.1 and E-AC3 5.1), a bunch of PGS subtitles and chapters.

I want to copy the video, convert the 7.1 audio into AAC, copy over the original 7.1 and 5.1 streams (so 3 audio streams), keep only French and English subtitles and all the metadata.

After a few trials, this command seems to do exactly that:

ffmpeg -i input.mkv -map 0:v:0 -map 0:a:0 -map 0:m:language:eng -map 0:m:language:fre -c copy -c:a:0 aac -b:a:0 512k output.mkv

Stream mapping:

  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (truehd (native) -> aac (native))
  Stream #0:1 -> #0:2 (copy) # truehd 7.1
  Stream #0:2 -> #0:3 (copy) # e-ac3 5.1
  Stream #0:3 -> #0:4 (copy) # (English subtitles)
  Stream #0:6 -> #0:5 (copy) # (French subtitles)

Now the question is... if I wanted to get rid of the e-ac3, how would I do that?

1 Answer 1


ffmpeg -i input.mkv -map 0:v:0 -c:v copy -map 0:a:0 -c:a:0 aac -b:a:0 512k -map 0:a:0 -c:a:1 copy -map 0:s:0 -c:s:0 copy -metadata:s:s:0 language=eng -map 0:s:1 -c:s:1 copy -metadata:s:s:1 language=fre output.mkv

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (truehd (native) -> aac (native))
Stream #0:1 -> #0:2 (copy) # truehd 7.1
Stream #0:3 -> #0:3 (copy) # (English subtitles)
Stream #0:6 -> #0:4 (copy) # (French subtitles)

If I've done this correctly it should only copy or encode what you asked for and nothing else..

-canvas_size 1920x804 (WidthxHeight of video.. Is needed to copy DVD & Blu-ray picture based subtitles over..)

And on a side note:

-map 0:m:language:eng (Missing Index on which stream metadata should be changed)
-map 0:m:language:fre (Missing Index on which stream metadata should be changed)
-c copy (This will copy all streams over regardless of mapping..)

Your Answer

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

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