简体   繁体   中英

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM