1 Jan 2011

Extracting Subtitles from a MKV


You have a video file with the extension MKV (Matroska Video).  It has embedded subtitles that want to extract into a separate file (SRT). Here's how you do it with free software.
You will need:
  1. The MKV File with a built-in Subtitles track. I will show you how to check.
  2. A video player. Ideally VLC Media Player 
  3. MKVToolnix – a set of cross-platform tools for .MKV files (get them from here)
And here's what you do

Step #1 – Verify that your MKV file does have built-in subtitles
Screenshot #1
(Click to zoom)

The easiest way is to check is to open the file using VLC Player. Select Tools >> Media Info (or press Ctrl+J). Switch to the “Codec Details” tab. Expand all the items underneath until you find one with the type “Subtitle”.  An example can be seen in the screenshot on the right.

Another way of doing this is to use the mkvinfo tool from the MKVToolnix collection mentioned above. If you are, start up mkvinfo in graphical mode with the following command line:

mkvinfo –g {Press Enter}

Then open up your .MKV file (Select File -- Open). You should see the same information as we saw before here too (see screenshot).

Screenshot #2
(Click to zoom)
Important: Make a note of the “Track Number” for our subtitle track. In our case, the value is 3. This will come in handy with the extraction process. The "Codec" field of the same track tells you if the subtitles you are going to extract are Text. This is important because .SRT files are supposed to be text. If your codec is any different, the following steps can be used to extract such subtitles into it's own file. But additional post-extractions steps will be necessary to convert the specific format into the text-based .SRT format.

Step #2 – Extract the Subtitles into a .SRT file
We will now use the mkvextract tool from the MKVToolnix kit. The exact command line format to use is:

mkvextract.exe tracks {path of the MKV file}  {track number we noted in the previous step}:{Filename to save the subtitles to}

In the case of my example, this will look like the following:

mkvextract.exe tracks "c:\My_MKV_Video_File.mkv" 3:My_MKV_Video_File.srt

Note the number used to prefix the .SRT filename. This is “Track Number” we noted in the previous step.

Going beyond
The mkvextract tool is just as capable of extracting other tracks - audio, video or non-text subtitles. All you need to do is use the right track number as prefix. So for instance, if the first track is audio, you can extract it with very little modification to the command we used before

mkvextract.exe tracks "c:\My_MKV_Video_File.mkv" 1:Audio_track.mp3

Again, note that we prefixed the MP3 filename with the right track number. We can also combine all of what we did above to extract both audio and subtitles in one single line:

mkvextract.exe tracks "c:\My_MKV_Video_File.mkv" 1:Audio_track.MP3 3:My_MKV_Video_File.srt

For more possibilities, look through the documentation of the mkvextract tool. And if this does work for you or you did something cooler with this - I would love to hear from you. Please leave me a comment below.

Originally published: 15th Jan 2011. Last updated: Jan 2017