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.mp4
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 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
ffmprobe -i video.mp4
Then 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:s
For English soundtracks you'll use English for language
-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
Source: https://www.reck.dk/use-ffmpeg-to-add-subtitles-to-video/
Is this correct? If so, does the order of inputs specified by the "-i" switch matter?