'How to mux srt subtitles into a video while keeping the multiple audio files using ffmpeg?

I have been using:

ffmpeg -i "video.mkv" -sub_charenc UTF-8 -i "video.srt" -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng -metadata:s:s:0 handler="English" -id3v2_version 3 -write_id3v1 1 "subbed_video.mp4"

But when I do it, I notice only the English audio carries over but the Japanese audio disappears. Is there a way to ensure both carry over? Thanks.



Solution 1:[1]

By default ffmpeg only copies one video stream and one audio stream. You need to specify all your streams using 3 -map output options:

ffmpeg -i "video.mkv" -sub_charenc UTF-8 -i "video.srt" -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng -metadata:s:s:0 handler="English" -id3v2_version 3 -write_id3v1 1 -map 0:v:0 -map 0:a:0 -map 0:a:1 -map 1:s:0 "subbed_video.mp4"

Here, I'm assuming that you have only 2 audio tracks (a:0 and a:1) on video.mkv.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1