Extracting Audio, Video and Subtitle tracks from Matroska Video (MKV) files

mkvtoolnix is a set of cross-platform command line tools (mkvmerge, mkvextract, and mkvinfo) for extracting audio, video and subtitle tracks from Matroska Video (.mkv) files. After extracting these tracks you can recombine them into an AVI container with subtitles embedded using a tool such as ffmpegX (a visual interface to mencoder available for OS X only) or mencoder (Linux).

mkvtoolnix can be downloaded here, or installed via MacPorts.

First, use mkvmerge to list the MKV file’s contents:

mkvmerge -i MovieFile.mkv

You’ll see a listing similar to this:

File 'MovieFile.mkv': container: Matroska
Track ID 1: subtitles (S_TEXT/ASS)
Track ID 2: audio (A_MPEG/L3)
Track ID 3: video (V_MPEG4/ISO/AVC)

Next, use mkvextract to extract certain tracks / attachments based on the output from the above command:

mkvextract tracks MovieFile.mkv 1:thesubtitles.srt
  2:theaudio.mp3 3:thevideo.mp4

mkvextract will extract the tracks you listed and save them to the specified filenames.

 

Related posts:

  1. Embedding subtitles (SRT) into video files (AVI, MPG, MP4, MKV, etc.)
  2. Converting RealVideo (RMVB, RealPlayer) files to AVI, MPEG, or MP4 on the Mac
  3. Bash Script to split a single CSV file into multiple files with headers
  4. Showing hidden files and directories in the Finder in Mac OS X
  5. Extract and sort email addresses from text files with Automator
Twitter Digg Delicious Stumbleupon Technorati Facebook Email

3 Responses to “Extracting Audio, Video and Subtitle tracks from Matroska Video (MKV) files”

  1. ROBERTO FROTA Reply 27 Aug 2009 at 00:10

    Perfect. Easy and fast. Thank you very much!

  2. Bravo! Thank you, you solved a great predicament for me

  3. thanks i was looking for this and worked

Afrigator