1MKVEXTRACT(1) User Commands MKVEXTRACT(1)
2
3
4
6 mkvextract - extract tracks from Matroska(TM) files into other files
7
9 mkvextract {mode} {source-filename} [options] [extraction-spec]
10
12 This program extracts specific parts from a Matroska(TM) file to other
13 useful formats. The first argument, mode, tells mkvextract(1) what to
14 extract. Currently supported is the extraction of tracks, tags,
15 attachments, chapters, CUE sheets and timecodes. The second argument is
16 the name of the source file. It must be a Matroska(TM) file. All
17 following arguments are options and extraction specifications; both of
18 which depend on the selected mode.
19
20 Common options
21 The following options are available in all modes and only described
22 once in this section.
23
24 -f, --parse-fully
25 Sets the parse mode to 'full'. The default mode does not parse the
26 whole file but uses the meta seek elements for locating the
27 required elements of a source file. In 99% of all cases this is
28 enough. But for files that do not contain meta seek elements or
29 which are damaged the user might have to use this mode. A full scan
30 of a file can take a couple of minutes while a fast scan only takes
31 seconds.
32
33 --command-line-charset character-set
34 Sets the character set to convert strings given on the command line
35 from. It defaults to the character set given by system's current
36 locale.
37
38 --output-charset character-set
39 Sets the character set to which strings are converted that are to
40 be output. It defaults to the character set given by system's
41 current locale.
42
43 -r, --redirect-output file-name
44 Writes all messages to the file file-name instead of to the
45 console. While this can be done easily with output redirection
46 there are cases in which this option is needed: when the terminal
47 reinterprets the output before writing it to a file. The character
48 set set with --output-charset is honored.
49
50 --ui-language code
51 Forces the translations for the language code to be used (e.g.
52 'de_DE' for the German translations). It is preferable to use the
53 environment variables LANG, LC_MESSAGES and LC_ALL though. Entering
54 'list' as the code will cause mkvextract(1) to output a list of
55 available translations.
56
57 -v, --verbose
58 Be verbose and show all the important Matroska(TM) elements as
59 they're read.
60
61 -h, --help
62 Show usage information and exit.
63
64 -V, --version
65 Show version information and exit.
66
67 @options-file
68 Reads additional command line arguments from the file options-file.
69 Lines whose first non-whitespace character is a hash mark ('#') are
70 treated as comments and ignored. White spaces at the start and end
71 of a line will be stripped. Each line must contain exactly one
72 option. There is no meta character escaping.
73
74 The command line 'mkvextract tracks source.mkv --raw
75 1:destination.raw' could be converted into the following option
76 file:
77
78 # Extract a track from source.mkv
79 tracks
80 source.mkv
81 # Output the track as raw data.
82 --raw
83 1:destination.raw
84
85
86 Track extraction mode
87 Syntax: mkvextract tracks source-filename [options] TID1:dest-filename1
88 [TID2:dest-filename2 ...]
89
90 The following command line options are available for each track in the
91 'tracks' extraction mode. They have to appear in front of the track
92 specification (see below) they should be applied to.
93
94 -c character-set
95 Sets the character set to convert the next text subtitle track to.
96 Only valid if the next track ID targets a text subtitle track. It
97 defaults to UTF-8.
98
99 --blockadd level
100 Keep only the BlockAdditions up to this level. The default is to
101 keep all levels. This option only affects certain kinds of codecs
102 like WAVPACK4.
103
104 --cuesheet
105 Causes mkvextract(1) to extract a CUE sheet from the chapter
106 information and tag data for the following track into a file whose
107 name is the track's output name with '.cue' appended to it.
108
109 --raw
110 Extracts the raw data into a file without any container data around
111 it. Unlike the --fullraw flag this flag does not cause the contents
112 of the CodecPrivate element to be written to the file. This mode
113 works with all CodecIDs, even the ones that mkvextract(1) doesn't
114 support otherwise, but the resulting files might not be usable.
115
116 --fullraw
117 Extracts the raw data into a file without any container data around
118 it. The contents of the CodecPrivate element will be written to the
119 file first if the track contains such a header element. This mode
120 works with all CodecIDs, even the ones that mkvextract(1) doesn't
121 support otherwise, but the resulting files might not be usable.
122
123 TID:outname
124 Causes extraction of the track with the ID TID into the file
125 outname if such a track exists in the source file. This option can
126 be given multiple times. The track IDs are the same as the ones
127 output by mkvmerge(1)'s --identify option.
128
129 Each output name should be used only once. The exception are
130 RealAudio and RealVideo tracks. If you use the same name for
131 different tracks then those tracks will be saved in the same file.
132 Example:
133
134 $ mkvextract tracks input.mkv 1:output-two-tracks.rm 2:output-two-tracks.rm
135
136
137 Tags extraction mode
138 Syntax: mkvextract tags source-filename [options]
139
140 The extracted tags are written to the console unless the output is
141 redirected (see the section about output redirection for details).
142
143 Attachments extraction mode
144 Syntax: mkvextract attachments source-filename [options] AID1:outname1
145 [AID2:outname2 ...]
146
147 AID:outname
148 Causes extraction of the attachment with the ID AID into the file
149 outname if such an attachment exists in the source file. If the
150 outname is left empty then the name of the attachment inside the
151 source Matroska(TM) file is used instead. This option can be given
152 multiple times. The attachment IDs are the same as the ones output
153 by mkvmerge(1)'s --identify option.
154
155 Chapters extraction mode
156 Syntax: mkvextract chapters source-filename [options]
157
158 -s, --simple
159 Exports the chapter information in the simple format used in the
160 OGM tools (CHAPTER01=..., CHAPTER01NAME=...). In this mode some
161 information has to be discarded. Default is to output the chapters
162 in XML format.
163
164 The extracted chapters are written to the console unless the output is
165 redirected (see the section about output redirection for details).
166
167 Cue sheet extraction mode
168 Syntax: mkvextract cuesheet source-filename [options]
169
170 The extracted cue sheet is written to the console unless the output is
171 redirected (see the section about output redirection for details).
172
173 Timecode extraction mode
174 Syntax: mkvextract timecodes_v2 source-filename [options]
175
176 The extracted timecodes are written to the console unless the output is
177 redirected (see the section about output redirection for details).
178
180 Several extraction modes cause mkvextract(1) to write the extracted
181 data to the console. There are generally two ways of writing this data
182 into a file: one provided by the shell and one provided by
183 mkvextract(1) itself.
184
185 The shell's builtin redirection mechanism is used by appending '>
186 output-filename.ext' to the command line. Example:
187
188 $ mkvextract tags source.mkv > tags.xml
189
190
191 mkvextract(1)'s own redirection is invoked with the --redirect-output
192 option. Example:
193
194 $ mkvextract tags source.mkv --redirect-output tags.xml
195
196
197 Note
198 On Windows you should probably use the --redirect-output option
199 because cmd.exe sometimes interpretes special characters before
200 they're written into the output file resulting in broken output.
201
203 The decision about the output format is based on the track type, not on
204 the extension used for the output file name. The following track types
205 are supported at the moment:
206
207 V_MPEG4/ISO/AVC
208
209 H.264 / AVC video tracks are written to H.264 elementary streams
210 which can be processed further with e.g. MP4Box(TM) from the
211 GPAC(TM) package.
212
213 V_MS/VFW/FOURCC
214 Fixed FPS video tracks with this CodecID are written to AVI files.
215
216 V_REAL/*
217
218 RealVideo(TM) tracks are written to RealMedia(TM) files.
219
220 A_MPEG/L3, A_AC3
221 These will be extracted to raw MP3 and AC3 files.
222
223 A_PCM/INT/LIT
224 Raw PCM data will be written to a WAV file.
225
226 A_AAC/MPEG2/*, A_AAC/MPEG4/*, A_AAC
227 All AAC files will be written into an AAC file with ADTS headers
228 before each packet. The ADTS headers will not contain the
229 deprecated emphasis field.
230
231 A_VORBIS
232 Vorbis audio will be written into an OggVorbis(TM) file.
233
234 A_REAL/*
235
236 RealAudio(TM) tracks are written to RealMedia(TM) files.
237
238 A_TTA1
239
240 TrueAudio(TM) tracks are written to TTA files. Please note that due
241 to Matroska(TM)'s limited timecode precision the extracted file's
242 header will be different regarding two fields: data_length (the
243 total number of samples in the file) and the CRC.
244
245 S_TEXT/UTF8
246 Simple text subtitles will be written as SRT files.
247
248 S_TEXT/SSA, S_TEXT/ASS
249
250 SSA and ASS text subtitles will be written as SSA/ASS files
251 respectively.
252
253 S_KATE
254
255 Kate(TM) streams will be written within an Ogg(TM) container.
256
257 Tags
258 Tags are converted to a XML format. This format is the same that
259 mkvmerge(1) supports for reading tags.
260
261 Attachments
262 Attachments are written to they output file as they are. No
263 conversion whatsoever is done.
264
265 Chapters
266 Chapters are converted to a XML format. This format is the same
267 that mkvmerge(1) supports for reading chapters. Alternatively a
268 stripped-down version can be output in the simple OGM style format.
269
270 Timecodes
271 Timecodes are first sorted and then output as a timecode v2 format
272 compliant file ready to be fed to mkvmerge(1). The extraction to
273 other formats (v1, v3 and v4) is not supported.
274
276 mkvextract(1) exits with one of three exit codes:
277
278 · 0 -- This exit codes means that extraction has completed
279 successfully.
280
281 · 1 -- In this case mkvextract(1) has output at least one warning,
282 but extraction did continue. A warning is prefixed with the text
283 'Warning:'. Depending on the issues involved the resulting files
284 might be ok or not. The user is urged to check both the warning and
285 the resulting files.
286
287 · 2 -- This exit code is used after an error occurred.
288 mkvextract(1) aborts right after outputting the error message.
289 Error messages range from wrong command line arguments over
290 read/write errors to broken files.
291
293 mkvmerge(1), mkvinfo(1), mkvpropedit(1), mmg(1)
294
296 The latest version can always be found at the MKVToolNix homepage[1].
297
299 Moritz Bunkus <moritz@bunkus.org>
300 Developer
301
303 1. the MKVToolNix homepage
304 http://www.bunkus.org/videotools/mkvtoolnix/
305
306
307
308MkvToolNix 4.4.0 2010-10-31 MKVEXTRACT(1)