Combining video and subtitle files as one video?

99,659

Solution 1

MKVtoolnix is another easy to use option since you already have the files you want. You can combine them into an MKV container without altering the originals in anyway. It has a nice GUI to guide you through the combination process as well.

I see user1301428 had mentioned Handbrake, which is also a very common/popular tool. I'm not as familiar with it, but if it doesn't re-encode your source AVI then it should be great.

Solution 2

A free, cross-platform solution with FFmpeg, which does bitstream copy and therefore doesn't take more than a few seconds, even for large files:

ffmpeg -i input.mp4 -i subtitles.srt -c:s mov_text -c:v copy -c:a copy output.mp4

This works for MP4. Be aware that some subtitle formats might not automatically be compatible with the chosen output formats, so you have to change the codec after -c:s:

  • MP4: Use the mov_text subtitle codec (as in the example above), which implements MPEG-4 Part 17.

  • MKV: Use srt, subrip, ssa or ass. MKV does not support mov_text.

  • AVI: Very problematic with embedded subtitles. In theory they support SubRip and SSA/ASS subtitles, but only through third party software.

See Wikipedia for a list of containers and their supported subtitle formats.

Using dedicated video encoding programs such as Handbrake will re-encode your video, which reduces its quality and could take you hours to encode – this is why you should check whether the tools support copying the video and audio bitstreams.

Share:
99,659

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin almost 2 years

    I have a video file (in the format of .mp4, .mkv, .avi or whatever) and a subtitle file (.srt). I want to embed the subtitle file into the video file so that I have only one file - the video file in contrast to the video and the subtitle file.

    Is it possible? How?

    • Karan
      Karan over 11 years
      Soft embedded subs that can be turned off are the way to go (might not be possible with AVI though); hard subs are really irritating and not only does adding them cause quality loss, but removing them is not possible without further significant loss.
  • slhck
    slhck over 11 years
    This wil re-encode the video, which a) takes a lot of time and b) deteriorates the quality.
  • Zombo
    Zombo almost 11 years
    I have found -f srt to be necessary sometimes, otherwise great!
  • user3405291
    user3405291 about 6 years
    In case your subtitle file is of *.vtt format, use -c:s webvtt option, like this: ffmpeg -i input.webm -i input.vtt -c:s webvtt -c:v copy -c:a copy output.webm