Table of Contents

ffmpeg - Subtitles - Add subtitles to MP4 vs MKV

Different syntax is used for MP4 vs MKV.

  • In both cases you must specify video and audio codec, or just copy stream if you just want to add subtitle.

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 mov_text output.mp4

NOTE: Notice the -c:s mov_text.


MKV

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

NOTE: Notice the -c:s srt.


NOTE: If mapping is not used, then adding additional subtitles would overwrite the existing ones.

To add language metadata (insert before output file) “-metadata:s:s:0 language=eng”


NOTE: .srt files must be imported with -c:s copy not with -c:s mov_text


References

https://en.wikipedia.org/wiki/Comparison_of_video_container_formats