Add audio and subtitle in mkv video by one command.

Code add subtitle:

-i input.mkv -f srt -i subtitle.srt -map 0:0 -map 0:1 -map 0:2 -map 1:0 -c:v copy -c:a copy -c:s srt -c:s:0 srt -metadata:s:s:0 language=eng output.mkv

Code add audio:

-i input.mkv -i audio.aac -map 0:v -map 0:a:0 -map 1:a -metadata:s:a:1 language=eng  -codec copy output.mkv

I couldn't add subtitle and audio in one command.Please help me!

1 Answer 1


Why don't map everything

ffmpeg -i input.mkv -i input.aac -i input.srt -map 0:0 -map 0:a:0 -map 2:0 -map 1:a -c copy output.mkv

But it is unclear which one to map, you took different stream each time from the mkv -map 0:0 -map 0:1 -map 0:2 vs -map 0:v -map 0:a:0

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.