# MKVEXTRACT

NAME
SYNOPSIS
DESCRIPTION
NOTES
EXAMPLES
AUTHOR
SEE ALSO
WWW

## NAME

| mkvextract - extract tracks from Matroska files into other files

## SYNOPSIS

| mkvextract tracks <inname> [options] [TID1:out1 [TID2:out2 ...]] mkvextract tags <inname> [options] mkvextract attachments <inname> [options] [AID1:[out1] [AID2:[out2] ...]] mkvextract chapters <inname> [options] mkvextract cuesheet <inname> [options]
mkvextract timecodes_v2 <inname> [TID1:out1 [TID2:out2 ...]]
mkvextract <-h|-V>

## DESCRIPTION

| This program extracts specific parts from a Matroska file to other useful formats. The first argument tells mkvextract what to extract. Currently supported is the extraction of tracks, tags, attachments, chapters, CUE sheets and timecodes. The second argument is the name of the source file. It must be a Matroska file.

The following command line options are available for each track in the tracks extraction mode. They have to appear in front of the track specification (see below) they should be applied to.

| -c charset

| Sets the charset to convert the next text subtitle track to. Only valid if the next track ID targets a text subtitle track. It defaults to UTF-8.

| --blockadd level

| Keep only the BlockAdditions up to this level. The default is to keep all levels. This option only affects certain kinds of codecs like WAVPACK4.

| --cuesheet

| Causes mkvextract to extract a CUE sheet from the chapter information and tag data for the following track into a file whose name is the track’s output name with ".cue" appended to it.

| --fullraw

| Extracts the raw data into a file without any container data around it. The contents of the CodecPrivate element will be written to the file first if the track contains such a header element. This mode works with all CodecIDs, even the ones that mkvextract doesn’t support otherwise, but the resulting files might not be usable.

| --no-ogg

| Only valid for FLAC tracks. Normally FLAC tracks are embedded in an Ogg transport stream. With this switch they are extracted to raw FLAC files instead.

| --raw |  | Extracts the raw data into a file without any container data around it. Unlike the --fullraw flag this flag does not cause the contents of the CodecPrivate element to be written to the file. This mode works with all CodecIDs, even the ones that mkvextract doesn’t support otherwise, but the resulting files might not be usable.

| TID:outname

| Causes extraction of the track with the ID TID into the file outname if such a track exists in the source file. This option can be given multiple times. The track IDs are the same as the ones output by mkvmerge’s --identify option. Each output name should be used only once. The exception are RealAudio and RealVideo tracks. If you use the same name for different tracks then those tracks will be saved in the same file. Example:
mkvextract tracks input.mkv 1:output-two-tracks.rm 2:output-two-tracks.rm

| -v, --verbose

| Be verbose and show all the important Matroska elements as they’re read.

| Command line syntax for the tags extraction mode:

| -v, --verbose

| Be verbose and show all the important Matroska elements as they’re read.

| Command line syntax for the attachments extraction mode:

| AID:outname

| Causes extraction of the attachment with the ID AID into the file outname if such an attachment exists in the source file. If the outname is left empty then the name of the attachment inside the Matroska file is used instead. This option can be given multiple times. The attachment IDs are the same as the ones output by mkvmerge’s --identify option.

| -v, --verbose

| Be verbose and show all the important Matroska elements as they’re read.

| Command line syntax for the chapters extraction mode:

| -s, --simple

| Exports the chapter information in the simple format used in the OGM tools (CHAPTER01=..., CHAPTER01NAME=...). In this mode some information has to be discarded. Default is to output the chapters in XML format.

| -v, --verbose

| Be verbose and show all the important Matroska elements as they’re read.

| Command line syntax for the cuesheet extraction mode:

| -v, --verbose

| Be verbose and show all the important Matroska elements as they’re read.

| Command line syntax for the timecodes_v2 extraction mode:

| -v, --verbose

| Be verbose and show all the important Matroska elements as they’re read.

| If one of the following options is used as the only command line argument additional information about mkvextract is output.

| -h, --help

| Show usage information.

| -V, --version

| Show version information.

## NOTES

| The decision about the output format is based on the track type, not on the extension used for the output file name. The following track types are supported at the moment:

| V_MPEG4/ISO/AVC

| H.264 / AVC video tracks are written to H.264 elementary streams which can be processed further with e.g. MP4Box from the GPAC package.

| V_MS/VFW/FOURCC

| Fixed FPS video tracks with this CodecID are written to AVI files.

| V_REAL/*

| RealVideo tracks are written to RealMedia files.

| A_MPEG/L3, A_AC3

| These will be extracted to raw MP3 and AC3 files.

| A_PCM/INT/LIT

| Raw PCM data will be written to a WAV file.

| A_AAC/MPEG2/*

| All MPEG2 AAC files will be written into an AAC file with ADTS headers before each packet.

| A_AAC/MPEG4/*

| All MPEG4 AAC files will be written into an AAC file with ADTS headers before each packet. The ADTS headers will not contain the deprecated emphasis field.

| A_VORBIS

| Vorbis audio will be written into an Ogg/Vorbis file.

| A_REAL/*

| RealAudio tracks are written to RealMedia files.

| A_TTA1 | TrueAudio tracks are written to TTA files. Please note that due to Matroska’s limited timecode precision the extracted file’s header will be different regarding two fields: data_length (the total number of samples in the file) and the CRC.

| S_TEXT/UTF8

| Simple text subtitles will be written as SRT files.

| S_TEXT/SSA, S_TEXT/ASS

| SSA and ASS text subtitles will be written as SSA/ASS files respectively.

| S_KATE |  | Kate streams will be written within an Ogg container.

| Tags are converted to a XML format. This format is the same that mkvmerge supports for reading tags. Attachments are written to they output file as they are. No conversion whatsoever is done. Chapters are converted to a XML format. This format is the same that mkvmerge supports for reading chapters. Alternatively a stripped-down version can be output in the simple OGM style format.

Timecodes are first sorted and then output as a timecode v2 format compliant file ready to be fed to mkvmerge. The extraction to other formats (v1 and v3) is not supported.

## EXAMPLES

| Let’s assume you’ve made a Matroska file with one video track, two audio tracks and two subtitle tracks, and you need the second audio track and the first subtitle track. So first fire up mkvmerge with the --identify option: $ mkvmerge -i movie.mkv
File ’movie.mkv’: container: Matroska
Track ID 1: video (V_MS/VFW/FOURCC, DIV3)
Track ID 2: audio (A_MPEG/L3)
Track ID 3: audio (A_VORBIS)
Track ID 4: subtitles (S_TEXT/UTF8)
Track ID 5: subtitles (S_TEXT/UTF8)

Now you can call mkvextract like this:

$ mkvextract tracks movie.mkv 3:audio.ogg 4:subtitles.srt

Another example. Let’s assume you have a Matroska file with one RealVideo v10 track, one Vorbis audio track and one RealAudio (COOK) track. The identification output might look like this:

$ mkvmerge -i movie2.mkv
File ’movie2.mkv’: container: Matroska
Track ID 1: video (V_REAL/RV40)
Track ID 2: audio (A_VORBIS)
Track ID 3: audio (A_REAL/COOK)

Let’s further assume you want only need the video and the RealAudio track but both in the same output file. This is possible for RealMedia files by using the same output name for those tracks that you want to end up in the same file:

$ mkvextract tracks movie2.mkv 1:extracted.rm 3:extracted.rm

Sometimes you the raw data of a track might even be useful, e.g. for MPEG-1 tracks. In this case you can use a track flag like this:

$ mkvextract tracks movie3.mkv --fullraw 1:extracted.mpeg

If you need the timecodes for all the blocks of track 2 from a file then you can let mkvextract create a timecode v2 format file like this:

$ mkvextract timecodes_v2 input.mkv 2:timecodes-track2.txt

## AUTHOR

| mkvextract was written by Moritz Bunkus <moritz@bunkus.org>.

## SEE ALSO

| mkvmerge(1), mkvinfo(1)

## WWW

| The newest version can always be found at <http://www.bunkus.org/videotools/mkvtoolnix/>