Quantcast
Channel: chooru.code » subtitles
Viewing all articles
Browse latest Browse all 7

How to add subtitles to video file using MKVMerge

$
0
0

If you like to watch videos with subtitles, you have two options. First, you have an external subtitles file and your player can pick it up while playing the video file. Second, you have a video file with an embedded subtitles stream. You may be forced to use the second option for certain video players or for streaming video content using media servers, like MiniDLNA for example.

It is possible to embed a subtitles file, for example a SubRip .srt file, into a video file to output a video file that has the subtitles stream embedded in it. The easiest method to achieve this is to output to a Matroska Multimedia Container (MKV) file. This is a commonly used container format for video files that can hold multiple streams: video, audio and subtitles. So, we create a MKV file containing the original video file (of any format) and a subtitles stream to be used along with it. The only limitation is that you will need a player that supports MKV to replay this back.

To deal with MKV files, we need the mkvtoolnix package:

$ sudo apt-get install mkvtoolnix

We use the mkvmerge tool from this package to merge a SubRip SRT file into an existing video file:

$ mkvmerge -o out.mkv in.avi in.srt

Note:

  • The input file cannot be overwritten with the output file, hence we use a different name here.
  • Multiple subtitle files can be added to MKV file incrementally in this way. This is typically used to embed subtitles of multiple languages into the file.

  • When playing with a player like VLC, one or none of the subtitles can be picked. For example, right-click in the middle of the playing video and choose Subtitle -> Sub Track.

Tried with: MKVToolNix 6.7.0-1 and Ubuntu 14.04


Tagged: mkv, mkvmerge, srt, subtitles

Viewing all articles
Browse latest Browse all 7

Latest Images

Trending Articles





Latest Images