MKVEXTRACT(1)
๐ MKVEXTRACT(1) โ user commands, but make it a vibe ๐
okay so bestie, welcome to the mkvextract(1) manual page ๐ซถ this is the User Commands corner of the manual and it's literally about pulling stuff OUT of Matroskaโข files. sit down, hydrate, let's go โจ
โจ NAME โจ
mkvextract โ extract tracks from Matroska(TM) files into other files ๐
๐ธ SYNOPSIS ๐ธ
mkvextract {source-filename} {mode1} [options] [extraction-spec1]
[mode2] [options] [extraction-spec2] [...]
๐ฆ DESCRIPTION ๐ฆ
So this program extracts specific parts out of a Matroska(TM) file and turns them into other useful formats. The very first argument is the name of the source file, and that file must be a Matroska(TM) file, no cap. ๐
Every other argument either:
- switches to a certain extraction mode,
- changes options for the mode you're currently in, or
- says what to extract into which file.
And here's the iconic part: multiple modes can be used in the same invocation of mkvextract, so you can extract a whole bunch of things in a single pass ๐ Most options only work in certain modes though โ a few are universal besties that apply everywhere.
Currently supported is the extraction of tracks, tags, attachments, chapters, CUE sheets, timestamps and cues. slay.
๐ซ Common options ๐ซ
These ones are available in all modes, so we only explain them once, right here, mwah ๐
-f,--parse-fullyโ sets the parse mode to 'full'. The default mode does not parse the whole file; instead it uses the meta seek elements to locate the required elements of a source file. In 99% of all cases that's honestly enough. But for files that don't contain meta seek elements, or that are damaged, you might have to use this mode. Heads up: a full scan of a file can take a couple of minutes, while a fast scan only takes seconds ๐ญ--command-line-charsetcharacter-set โ sets the character set to convert strings given on the command line from. It defaults to the character set given by system's current locale. ๐--output-charsetcharacter-set โ sets the character set to which strings are converted that are to be output. Also defaults to the character set given by system's current locale. ๐ฌ-r,--redirect-outputfile-name โ writes all messages to the file file-name instead of to the console. You could just do output redirection, sure, but there are cases where you genuinely need this option: when the terminal reinterprets the output before writing it to a file. The character set set with--output-charsetis honored. โจ--no-bomโ normally text files that are created & encoded in one of the UTF variants will start with a byte order marker (BOM). Using this option disables writing that byte order marker. bye BOM ๐--flush-on-closeโ tells the program to flush all data cached in memory to storage when closing files opened for writing. This can be used to prevent data loss on power outages, or to circumvent certain problems in the operating system or drivers. The downside? Multiplexing will take longer, becausemkvmergewill wait until all data has been written to the storage before exiting. See issues #2469 and #2480 on the MKVToolNix bug tracker for in-depth discussions on the pros and cons. ๐ฅ--ui-languagecode โ forces the translations for the language code to be used (e.g.'de_DE'for the German translations). Entering'list'as the code will cause the program to output a list of available translations. ๐ฃ๏ธ--abort-on-warningsโ tells the program to abort after the first warning is emitted. The program's exit code will be1. ๐--debugtopic โ turn on debugging for a specific feature. This option is only useful for developers. ngl if you're not a dev, skip it ๐--engagefeature โ turn on experimental features. A list of available features can be requested withmkvextract --engage list. These features are not meant to be used in normal situations. ๐จ--gui-modeโ turns on GUI mode. In this mode specially-formatted lines may be output that can tell a controlling GUI what's happening. These messages follow the format'#GUI#message'. The message may be followed by key/value pairs as in'#GUI#message#key1=value1#key2=value2...'. Neither the messages nor the keys are ever translated and always output in English. ๐-v,--verboseโ be verbose and show all the important Matroska(TM) elements as they're read. ๐-h,--helpโ show usage information and exit.-V,--versionโ show version information and exit.@options-file.jsonโ reads additional command line arguments from the file options-file. For a full explanation on the supported formats for such files see the section called "Option files" in themkvmerge(1)man page. ๐
๐ฌ Track extraction mode ๐ฌ
Syntax:
mkvextract source-filename tracks [options] TID1:dest-filename1
[TID2:dest-filename2 ...]
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. so like, order matters bestie, don't fight it ๐
-ccharacter-set โ sets the character set to convert the next text subtitle track to. Only valid if the next track ID targets a text subtitle track. It defaults toUTF-8. โจ--blockaddlevel โ keep only the BlockAdditions up to this level. The default is to keep all levels. This option only affects certain kinds of codecs likeWAVPACK4. ๐ง--cuesheetโ causesmkvextract(1)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. ๐--rawโ extracts the raw data into a file without any container data around it. Unlike the--fullrawflag 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 thatmkvextract(1)doesn't support otherwise, but the resulting files might not be usable. โ ๏ธ--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 thatmkvextract(1)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 bymkvmerge(1)'s--identifyoption. ๐
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 input.mkv tracks 0:video.h264 2:output-two-vobsub-tracks.idx 3:output-two-vobsub-tracks.idx
๐ Attachments extraction mode ๐
Syntax:
mkvextract source-filename attachments [options] AID1:outname1
[AID2:outname2 ...]
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 source Matroska(TM) file is used instead. This option can be given multiple times. The attachment IDs are the same as the ones output bymkvmerge(1)'s--identifyoption. ๐
๐ Chapters extraction mode ๐
Syntax:
mkvextract source-filename chapters [options] output-filename.xml
-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. ๐--simple-languagelanguage โ if the simple format is enabled thenmkvextract(1)will only output a single entry for each chapter atom encountered, even if a chapter atom contains more than one chapter name. By defaultmkvextract(1)will use the first chapter name found for each atom, regardless of its language. ๐
Using this option allows the user to determine which chapter names are output if atoms contain more than one chapter name. The language parameter must be an ISO 639-1 or ISO 639-2 code.
The chapters are written to specified output file. By default the XML format understood by mkvmerge(1) is used. If no chapters are found in the file, the output file is not created. ๐ซ
๐ท๏ธ Tags extraction mode ๐ท๏ธ
Syntax:
mkvextract source-filename tags [options] output-filename.xml
-T,--no-track-tagsโ exports only tags that aren't track-specific. ๐ โ๏ธ
The tags are written to specified output file in the XML format understood by mkvmerge(1). If no tags are found in the file, the output file is not created. ๐ซ
๐ฟ Cue sheet extraction mode ๐ฟ
Syntax:
mkvextract source-filename cuesheet [options] output-filename.cue
The cue sheet is written to specified output file. If no chapters or tags are found in the file, the output file is not created. ๐ซ
โฑ๏ธ Timestamp extraction mode โฑ๏ธ
Syntax:
mkvextract source-filename timestamps_v2 [options] TID1:dest-filename1
[TID2:dest-filename2 ...]
TID:outnameโ causes extraction of the timestamps for 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 bymkvmerge(1)'s--identifyoption. ๐
Example:
$ mkvextract input.mkv timestamps_v2 1:ts-track1.txt 2:ts-track2.txt
๐ฏ Cues extraction mode ๐ฏ
Syntax:
mkvextract source-filename cues [options] TID1:dest-filename1
[TID2:dest-filename2 ...]
TID:dest-filenameโ causes extraction of the cues for 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 bymkvmerge(1)'s--identifyoption and not the numbers contained in the CueTrack element. ๐
The format output is a simple text format: one line per CuePoint element with key=value pairs. If an optional element is not present in a CuePoint (e.g. CueDuration) then a dash will be output as the value. โ
Example:
timestamp=00:00:13.305000000 duration=- cluster_position=757741 relative_position=11
The possible keys are:
timestampโ the cue point's timestamp with nanosecond precision. The format isHH:MM:SS.nnnnnnnnn. This element is always set. โญdurationโ the cue point's duration with nanosecond precision. The format isHH:MM:SS.nnnnnnnnn. โณcluster_positionโ the absolute position in bytes inside the Matroska(TM) file where the cluster containing the referenced element starts. ๐
Note โจ Inside the Matroska(TM) file theCueClusterPositionis relative to the segment's data start offset. The value output bymkvextract(1)'s cue extraction mode, however, contains that offset already and is an absolute offset from the beginning of the file. iykyk ๐
relative_positionโ the relative position in bytes inside the cluster where theBlockGrouporSimpleBlockelement that the cue point refers to starts.
Note โจ Inside the Matroska(TM) file theCueRelativePositionis relative to the cluster's data start offset. The value output bymkvextract(1)'s cue extraction mode, however, is relative to the cluster's ID. The absolute position inside the file can be calculated by addingcluster_positionandrelative_position. math queen behavior ๐งฎ๐
Example:
$ mkvextract input.mkv cues 1:cues-track1.txt 2:cues-track2.txt
๐ EXAMPLES ๐
Extracting both chapters and tags in their respective XML formats at the same time, bestie:
$ mkvextract movie.mkv chapters movie-chapters.xml tags movie-tags.xml
Extracting a couple of tracks and their respective timestamps at the same time โ multitasking icon behavior ๐:
$ mkvextract "Another Movie.mkv" tracks 0:video.h265 "1:main audio.aac" "2:director's comments.aac" timestamps_v2 "0:timestamps video.txt" "1:timestamps main audio.txt" "2:timestamps director's comments.txt"
Extracting chapters in the Ogg/OGM format and re-encoding a text subtitle track to another character set:
$ mkvextract "My Movie.mkv" chapters --simple "My Chapters.txt" tracks -c MS-ANSI "2:My Subtitles.srt"
๐ TEXT FILES AND CHARACTER SET CONVERSIONS ๐
For an in-depth discussion about how all tools in the MKVToolNix suite handle character set conversions, input/output encoding, command line encoding and console encoding, please see the identically-named section in the mkvmerge(1) man page. go read it, it's giving thorough ๐
๐ฆ OUTPUT FILE FORMATS ๐ฆ
The decision about the output format is based on the track type, not on the extension used for the output file name. Like, the extension is NOT the vibe check here, the track type is ๐ซถ The following track types are supported at the moment:
A_AAC/MPEG2/*,A_AAC/MPEG4/*,A_AACโ all AAC files will be written into an AAC file with ADTS headers before each packet. The ADTS headers will not contain the deprecatedemphasisfield.A_AC3,A_EAC3โ these will be extracted to raw AC-3 files.A_ALACโ ALAC tracks are written to CAF files.A_DTSโ these will be extracted to raw DTS files.A_FLACโ FLAC tracks are written to raw FLAC files.A_MPEG/L2โ MPEG-1 Audio Layer II streams will be extracted to raw MP2 files.A_MPEG/L3โ these will be extracted to raw MP3 files.A_OPUSโ Opus(TM) tracks are written to OggOpus(TM) files.A_PCM/INT/LIT,A_PCM/INT/BIGโ raw PCM data will be written to a WAV file. Big-endian integer data will be converted to little-endian data in the process. glow up conversion fr fr โจA_REAL/*โ RealAudio(TM) tracks are written to RealMedia(TM) files.A_TRUEHD,A_MLPโ these will be extracted to raw TrueHD/MLP files.A_TTA1โ TrueAudio(TM) tracks are written to TTA files. Please note that due to Matroska(TM)'s limited timestamp 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. heads up, not a bug, just the precision situation ๐A_VORBISโ Vorbis audio will be written into an OggVorbis(TM) file.A_WAVPACK4โ WavPack(TM) tracks are written to WV files.S_HDMV/PGSโ PGS subtitles will be written as SUP files.S_HDMV/TEXTSTโ TextST subtitles will be written as a special file format invented formkvmerge(1)andmkvextract(1). bespoke, we made it ourselves ๐S_KATEโ Kate(TM) streams will be written within an Ogg(TM) container.S_TEXT/SSA,S_TEXT/ASS,S_SSA,S_ASSโ SSA and ASS text subtitles will be written as SSA/ASS files respectively.S_TEXT/UTF8,S_TEXT/ASCIIโ simple text subtitles will be written as SRT files.S_VOBSUBโ VobSub(TM) subtitles will be written as SUB files along with the respective index files, as IDX files.S_TEXT/USFโ USF text subtitles will be written as USF files.S_TEXT/WEBVTTโ WebVTT text subtitles will be written as WebVTT files.V_MPEG1,V_MPEG2โ MPEG-1 and MPEG-2 video tracks will be written as MPEG elementary streams.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(TM)from theGPAC(TM)package.V_MPEG4/ISO/HEVCโ H.265 / HEVC video tracks are written to H.265 elementary streams which can be processed further with e.g.MP4Box(TM)from theGPAC(TM)package.V_MS/VFW/FOURCCโ fixed FPS video tracks with this CodecID are written to AVI files.V_REAL/*โ RealVideo(TM) tracks are written to RealMedia(TM) files.V_THEORAโ Theora(TM) streams will be written within an Ogg(TM) containerV_VP8,V_VP9โ VP8 / VP9 tracks are written to IVF files.- Tags โ tags are converted to a XML format. This format is the same that
mkvmerge(1)supports for reading tags. - Attachments โ attachments are written to the output file as they are. No conversion whatsoever is done. untouched, no notes, periodt ๐
- Chapters โ chapters are converted to a XML format. This format is the same that
mkvmerge(1)supports for reading chapters. Alternatively a stripped-down version can be output in the simple OGM style format. - Timestamps โ timestamps are first sorted and then output as a timestamp v2 format compliant file ready to be fed to
mkvmerge(1). The extraction to other formats (v1, v3 and v4) is not supported. sorry bestie, v2 only ๐ญ
๐ EXIT CODES ๐
mkvextract(1) exits with one of three exit codes:
0โ this exit code means that extraction has completed successfully. slay ๐1โ in this casemkvextract(1)has output at least one warning, but extraction did continue. A warning is prefixed with the text'Warning:'. Depending on the issues involved the resulting files might be ok or not. The user is urged to check both the warning and the resulting files. read the warning, check ur files, don't skip this step ๐2โ this exit code is used after an error occurred.mkvextract(1)aborts right after outputting the error message. Error messages range from wrong command line arguments over read/write errors to broken files.
๐ธ ENVIRONMENT VARIABLES ๐ธ
mkvextract(1) uses the default variables that determine the system's locale (e.g. LANG and the LC_* family). Additional variables:
MKVEXTRACT_DEBUG,MKVTOOLNIX_DEBUGand its short formMTX_DEBUGโ the content is treated as if it had been passed via the--debugoption.MKVEXTRACT_ENGAGE,MKVTOOLNIX_ENGAGEand its short formMTX_ENGAGEโ the content is treated as if it had been passed via the--engageoption.
๐ SEE ALSO ๐
mkvmerge(1), mkvinfo(1), mkvpropedit(1), mkvtoolnix-gui(1)
๐ WWW ๐
The latest version can always be found at the MKVToolNix homepage[1].
๐ AUTHOR ๐
Moritz Bunkus <moritz@bunkus.org> Developer
๐ NOTES ๐
- the MKVToolNix homepage
https://mkvtoolnix.download/
and that's the whole page bestie ๐ this one's from MKVToolNix 102.0, dated 2026-09-14, and it's the MKVEXTRACT(1) manual. go extract something iconic โจ๐ฆ
๐ฆ where this page comes from
- fedora 44: mkvtoolnix 102.0-1.fc44 ยท GPL-2.0-or-later AND LGPL-2.1-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms