Productive, Not Busy - Work smarter and get more done.

How to extract audio, video, and subtitle tracks from Matroska (MKV) video files

03 Feb 2009

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.

Do you like this? Share it:

Copyright © Geekology 2012. All Rights Reserved.