0

Input:

 * One Video
 * 4 audio streams
 * Many subtitles
 * Chapters

I want to re-encode one of the audio streams (the first one) and keep everything else as-of (copy).
Is it possible to do that in one command-line in ffmpeg?

So far my best 2 guesses don't work:

ffmpeg -i input.mkv -map_metadata 0 -map 0:v -c:v copy -map 0:s -c:s copy -map 0:a:0 -c:a ac3 -vbr 3 -map 0:a:1 -c:a copy -map 0:a:2 -c:a copy -map 0:a:3 -c:a copy output.mkv
Copies everything

ffmpeg -i input.mkv -map_metadata 0 -map 0:v -c:v copy -map 0:s -c:s copy -map 0:a -c:a copy -map 0:a:0 -c:a ac3 -vbr 3 output.mkv
Re-encodes all audio streams

2

Use

ffmpeg -i input.mkv -map_metadata 0 -map 0 -c copy -c:a:0 ac3 -vbr 3 output.mkv

See https://superuser.com/a/1219824 for an illustrated guide to how stream options are parsed.

| improve this answer | |
  • Thanks, it worked! – Thomas Jan 10 at 20:11

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.