Use FFmpeg to add subtitles to video


ffmpeg -i input.mp4 -f srt -i -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s mov_text output.mp4


ffmpeg -i input.mp4 -f srt -i -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s srt  output.mkv

To understand the -map option you’ll first need to examine your source file by running the video trough ffprobe or ffmpeg

ffmprob -i video.mp4

Then you’ll see some lines named “Stream”, each stream represent a video, sound and/or subtitle. Streams starting with 0: is video or sound tracks 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:s


For soundtracks you’ll use for English

-metadata:s:0 language=English

For subtitle you have to use the extra s

-metadata:s:s:1 language=English \
-metadata:s:s:2 language=Dansk

Skriv et svar