User Tools

Site Tools


ffmpeg:subtitles:add_subtitles_to_mp4_vs_mkv

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

ffmpeg/subtitles/add_subtitles_to_mp4_vs_mkv.txt · Last modified: 2024/12/30 22:30 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki