How to extract embedded subtitles (.srt/.ass) from MKV files

Here’s the trouble:

  • I had downloaded some movie in MKV format and I want to watch it with my whole family in my standard DVD player that can’t play MKV file.
  • The movie already had multilingual subtitles embedded on it (not separated .srt file) and I want to extract it so the subtitles will appear on the DVD.
  • My favorite video converter application (winFF and Handbrake) can’t extract and re-embed the subtitles into target video (.avi divx).
  • So, I use winFF to convert MKV file into .AVI (divx) file then somehow I need to extract that subtitle from the MKV.

FYI: I’m using Ubuntu 10.04 to do all these commands

Here’s the step you need to do to extract subtitle (.srt) from a MKV movie:

[1] Install mkvtoolnix to manipulate MKV movie

[2] get info about ‘tracks’ available in the MKV movie using mkvinfo tool, example:

You’ll get output like these:

As you may notice from the output, there are 5 ‘tracks’ available in the MKV: track #1 is the video(H.264), track #2 is the audio (AAC), track #3 is subtitle, track #4 is subtitle in French and track #5 is subtitle in Spanish

[3] So, it’s clear, well extract track #3 which is a subtitle (although no language mentioned, it’s in English). To do that, use mkvextract command (for example):

that command above will produce which is the subtitle I want.

[4] One last step is to make sure that the file is in MSDOS (CR-LF) format by using ‘flip’ command (if you haven’t install it yet, do it using sudo apt-get install flip):

Now, you’re ready to pair-up the subtitle with the converted video from winFF!
Note: notice that the subtitle codec is S_TEXT/UTF8, if you found another MKV that has subtitle with codec S_TEXT/SSA or S_TEXT/ASS the the subtitle should be in SSA/ASS format respectively (.ssa/.ass)

  1. Nice howto, it works as described. Many thanks.

  2. Thank you, man. This has been very useful to me, because my friend’s player doesn’t get embedded subtitles.

  3. Note that depending on the type of mkv file, you may instead have to offset the track numbers by one. Newer versions of mkvinfo will warn you of this in the track headers. Below is track number 2, but you would really pick track 1 for mkvextract as shown by mkvinfo output:

    | + A track
    | + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
    | + Track UID: 3429178541772093080
    | + Track type: subtitles
    | + Default flag: 0
    | + Lacing flag: 0
    | + Codec ID: S_TEXT/UTF8

Leave a Reply

%d bloggers like this: