ffmpeg -i input.mp4 -f srt -i input.srt -map 0:0 -map 0:1 -map 1:0 -c:v copy \
-c:a copy -c:s mov_text output.mp4ffmpeg -i input.mp4 -f srt -i input.srt -map 0:0 -map 0:1 -map 1:0 -c:v copy \
-c:a copy -c:s srt output.mkvTo understand the -map option you'll first need to examine your source file
by running the video trough ffprobe or ffmpeg
ffprobe video.mp4OR
ffmpeg -i video.mp4Then you'll see some lines named "Stream", each stream represent a video,
sound and/or subtitle.
Streams starting with 0: are video or sound tracks (streams) and streams
starting with a number higher than 0 is subtitle (overlays)
To add several subtitles to the same video requires you to add a
-c:s mov_text or -c:s srt for each subtitle submitted
If you like to add a title to each soundtrack or subtitle you can use the
-metadata:s: and -metadata:s:sFor English soundtracks you'll use English for language
-metadata:s:0 language=EnglishFor subtitle you have to use the extra s
-metadata:s:s:1 language=English \
-metadata:s:s:2 language=Dansk
Thanks for sharing the example!
This is what I got to work with several languages:
I used the ISO 639-2 three character language code for the subtitle
languagemetadata which seems to be recognized by bothmediainfoandvlcas their locale names.I had a problem with one of my subtitle files being encoded with
WINDOWS-1252rather than the expectedUTF-8. It would produce an error like this when encoding:To fix it you can detect the encoding with
chardetoruchardetand then useiconvto convert to the expectedUTF-8: