Extracting subtitles from an MKV

Working with MKV (Matroska) video files you'll pretty soon hit on Mkvtoolnix. Using it you can easily extract any track (audio, video, subtitle) from an MKV file.

First run mkvinfo to get a list of tracks.
Using v5.2.0 on Mac OS X you get a similiar output:
$ mkvinfo sample.mkv
+ EBML head
|+ Doc type: matroska
|+ Doc type version: 2
|+ Doc type read version: 2
+ Segment, size 682327795
|+ Seek head (subentries will be skipped)
|+ EbmlVoid (size: 4027)
|+ Segment information
| + Timecode scale: 1000000
| + Muxing application: libebml v0.7.8 + libmatroska v0.8.1
| + Writing application: mkvmerge v2.9.5 ('Tu es le seul') built on Jun 17 2009 16:28:30
| + Duration: 1555.520s (00:25:55.520)
| + Date: Sun Dec 25 20:48:55 2011 UTC
| + Segment UID: 0x83 0x34 0xda 0xc8 0x35 0x6c 0xe6 0xa2 0xb4 0xb9 0x63 0x0e 0x15 0xa9 0x36 0x60
|+ Segment tracks
| + A track
|  + Track number: 1
|  + Track UID: 3887535020
|  + Track type: video
|  + Enabled: 1
|  + Default flag: 1
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 1
|  + Timecode scale: 1
|  + Max BlockAddition ID: 0
|  + Codec ID: V_MPEG4/ISO/AVC
|  + Codec decode all: 1
|  + CodecPrivate, length 42 (h.264 profile: High @L4.1)
|  + Default duration: 40.000ms (25.000 fps for a video track)
|  + Language: und
|  + Video track
|   + Pixel width: 1280
|   + Pixel height: 720
|   + Interlaced: 0
|   + Display width: 1280
|   + Display height: 720
| + A track
|  + Track number: 2
|  + Track UID: 1236562563
|  + Track type: audio
|  + Enabled: 1
|  + Default flag: 1
|  + Forced flag: 0
|  + Lacing flag: 1
|  + MinCache: 0
|  + Timecode scale: 1
|  + Max BlockAddition ID: 0
|  + Codec ID: A_AC3
|  + Codec decode all: 1
|  + Default duration: 32.000ms (31.250 fps for a video track)
|  + Language: eng
|  + Audio track
|   + Sampling frequency: 48000
|   + Channels: 6
| + A track
|  + Track number: 3
|  + Track UID: 1977222801
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 1
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/SSA
|  + Codec decode all: 1
|  + CodecPrivate, length 1231
|  + Language: eng
|+ EbmlVoid (size: 1024)
|+ Cluster

Find the number of the track ("Track number") that you want to extract, subtract one (for some reason mkvextract indexes tracks starting with 0, while mkvinfo starts the index from 1) and execute mkvextract:
$ mkvextract tracks sample.mkv 2:subtitle.ssa
Extracting track 2 with the CodecID 'S_TEXT/SSA' to the file 'subtitle.ssa'. Container format: SSA/ASS text subtitles
Progress: 100%

This saved the subtitle into the file subtitle.ssa. The "S_TEXT/SSA" stands for the SubStation Alpha subtitle format. You can easily edit or convert it into other formats using Jubler.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re:Extracting Subtitles from MKV

I just find another easy method to extract subtitles like srt files from video like MKV, MP4, VOB, AVI, WMV, TS, MOV etc from http://www.idealshare.net/video-converter/extract-subtitles-from-mkv-vob-avi-mp4.html

The software in this method also helps to add subtitles to video or remove subtitles from videos.

Syndicate content