1MKVPROPEDIT(1) User Commands MKVPROPEDIT(1)
2
3
4
6 mkvpropedit - Modify properties of existing Matroska(TM) files without
7 a complete remux
8
10 mkvpropedit [options] {source-filename} {actions}
11
13 This program analyses an existing Matroska(TM) file and modifies some
14 of its properties. Then it writes those modifications to the existing
15 file. Among the properties that can be changed are the segment
16 information elements (e.g. the title) and the track headers (e.g. the
17 language code, 'default track' flag or the name).
18
19 Options:
20
21 -l, --list-property-names
22 Lists all known and editable property names, their type (string,
23 integer, boolean etc) and a short description. The program exits
24 afterwards. Therefore the source-filename parameter does not have
25 to be supplied.
26
27 -p, --parse-mode mode
28 Sets the parse mode. The parameter 'mode' can either be 'fast'
29 (which is also the default) or 'full'. The 'fast' mode does not
30 parse the whole file but uses the meta seek elements for locating
31 the required elements of a source file. In 99% of all cases this is
32 enough. But for files that do not contain meta seek elements or
33 which are damaged the user might have to set the 'full' parse mode.
34 A full scan of a file can take a couple of minutes while a fast
35 scan only takes seconds.
36
37 Actions that deal with track and segment info properties:
38
39 -e, --edit selector
40 Sets the Matroska(TM) file section (segment information or a
41 certain track's headers) that all following add, set and delete
42 actions operate on. This option can be used multiple times in order
43 to make modifications to more than one element.
44
45 By default mkvpropedit(1) will edit the segment information
46 section.
47
48 See the section about edit selectors for a full description of the
49 syntax.
50
51 -a, --add name=value
52 Adds a property name with the value value. The property will be
53 added even if such a property exists already. Note that most
54 properties are unique and cannot occur more than once.
55
56 -s, --set name=value
57 Sets all occurrences of the property name to the value value. If no
58 such property exists then it will be added.
59
60 -d, --delete name
61 Deletes all occurrences of the property name. Note that some
62 properties are required and cannot be deleted.
63
64 Actions that deal with tags and chapters:
65
66 -t, --tags selector:filename
67 Add or replace tags in the file with the ones from filename or
68 remove them if filename is empty. mkvpropedit(1) reads the same
69 XML tag format that mkvmerge(1) reads as well.
70
71 The selector must be one of the words all, global or track. For all
72 mkvpropedit(1) will replace or remove all tags in a file. With
73 global only global tags will be replaced or removed.
74
75 With track mkvpropedit(1) will replace tags for a specific track.
76 Additionally the tags read from filename will be assigned to the
77 same track. The track is specified in the same way edit selectors
78 are specified (see below), e.g. --tags
79 track:a1:new-audio-tags.xml.
80
81 --add-track-statistics-tags
82 Calculates statistics for all tracks in a file and adds new
83 statistics tags for them. If the file already contains such tags
84 then they'll be updated.
85
86 --delete-track-statistics-tags
87 Deletes all existing track statistics tags from a file. If the file
88 doesn't contain track statistics tags then it won't be modified.
89
90 -c, --chapters filename
91 Add or replace chapters in the file with the ones from filename or
92 remove them if filename is empty. mkvpropedit(1) reads the same
93 XML and simple chapter formats that mkvmerge(1) reads as well.
94
95 Actions for handling attachments:
96
97 --add-attachment filename
98 Adds a new attachment from filename.
99
100 If the option --attachment-name has been used prior to this option
101 then its value is used as the new attachment's name. Otherwise it
102 is derived from filename.
103
104 If the option --attachment-mime-type has been used prior to this
105 option then its value is used as the new attachment's MIME type.
106 Otherwise it is auto-detected from the content of filename.
107
108 If the option --attachment-description has been used prior to this
109 option then its value is used as the new attachment's description.
110 Otherwise no description will be set.
111
112 If the option --attachment-uid has been used prior to this option
113 then its value is used as the new attachment's UID. Otherwise a
114 random UID will be generated automatically.
115
116 --replace-attachment selector:filename
117 Replaces one or more attachments that match selector with the file
118 filename. If more than one existing attachment matches selector
119 then all of their contents will be replaced by the content of
120 filename.
121
122 The selector can have one of four forms. They're explained below in
123 the section attachment selectors.
124
125 If the option --attachment-name has been used prior to this option
126 then its value is set as the new name for each modified attachment.
127 Otherwise the names aren't changed.
128
129 If the option --attachment-mime-type has been used prior to this
130 option then its value is set as the new MIME type for each modified
131 attachment. Otherwise the MIME types aren't changed.
132
133 If the option --attachment-description has been used prior to this
134 option then its value is set as the new description for each
135 modified attachment. Otherwise the descriptions aren't changed.
136
137 If the option --attachment-uid has been used prior to this option
138 then its value is set as the new UID for each modified attachment.
139 Otherwise the UIDs aren't changed.
140
141 --update-attachment selector
142 Sets the properties of one or more attachments that match selector.
143 If more than one existing attachment matches selector then all of
144 their properties will be updated.
145
146 The selector can have one of four forms. They're explained below in
147 the section attachment selectors.
148
149 If the option --attachment-name has been used prior to this option
150 then its value is set as the new name for each modified attachment.
151 Otherwise the names aren't changed.
152
153 If the option --attachment-mime-type has been used prior to this
154 option then its value is set as the new MIME type for each modified
155 attachment. Otherwise the MIME types aren't changed.
156
157 If the option --attachment-description has been used prior to this
158 option then its value is set as the new description for each
159 modified attachment. Otherwise the descriptions aren't changed.
160
161 If the option --attachment-uid has been used prior to this option
162 then its value is set as the new UID for each modified attachment.
163 Otherwise the UIDs aren't changed.
164
165 --delete-attachment selector
166 Deletes one or more attachments that match selector.
167
168 The selector can have one of four forms. They're explained below in
169 the section attachment selectors.
170
171 Options for attachment actions:
172
173 --attachment-name name
174 Sets the name to use for the following --add-attachment or
175 --replace-attachment operation.
176
177 --attachment-mime-type mime-type
178 Sets the MIME type to use for the following --add-attachment or
179 --replace-attachment operation.
180
181 --attachment-description description
182 Sets the description to use for the following --add-attachment or
183 --replace-attachment operation.
184
185 Other options:
186
187 --disable-language-ietf
188 Normally when the user requests changes to the 'language' track
189 header property, mkvpropedit(1) will apply the same change to the
190 new LanguageIETF track header element in addition to the legacy
191 Language element. If this option is used, the change is only
192 applied to the legacy Language element.
193
194 This option does not affect changes requested via the
195 'language-ietf' track header property.
196
197 --command-line-charset character-set
198 Sets the character set to convert strings given on the command line
199 from. It defaults to the character set given by system's current
200 locale.
201
202 --output-charset character-set
203 Sets the character set to which strings are converted that are to
204 be output. It defaults to the character set given by system's
205 current locale.
206
207 -r, --redirect-output file-name
208 Writes all messages to the file file-name instead of to the
209 console. While this can be done easily with output redirection
210 there are cases in which this option is needed: when the terminal
211 reinterprets the output before writing it to a file. The character
212 set set with --output-charset is honored.
213
214 --ui-language code
215 Forces the translations for the language code to be used (e.g.
216 'de_DE' for the German translations). Entering 'list' as the code
217 will cause the program to output a list of available translations.
218
219 --abort-on-warnings
220 Tells the program to abort after the first warning is emitted. The
221 program's exit code will be 1.
222
223 --debug topic
224 Turn on debugging for a specific feature. This option is only
225 useful for developers.
226
227 --engage feature
228 Turn on experimental features. A list of available features can be
229 requested with mkvpropedit --engage list. These features are not
230 meant to be used in normal situations.
231
232 --gui-mode
233 Turns on GUI mode. In this mode specially-formatted lines may be
234 output that can tell a controlling GUI what's happening. These
235 messages follow the format '#GUI#message'. The message may be
236 followed by key/value pairs as in
237 '#GUI#message#key1=value1#key2=value2...'. Neither the messages nor
238 the keys are ever translated and always output in English.
239
240 -v, --verbose
241 Be verbose and show all the important Matroska(TM) elements as
242 they're read.
243
244 -h, --help
245 Show usage information and exit.
246
247 -V, --version
248 Show version information and exit.
249
250 @options-file.json
251 Reads additional command line arguments from the file options-file.
252 For a full explanation on the supported formats for such files see
253 the section called "Option files" in the mkvmerge(1) man page.
254
256 The --edit option sets the Matroska(TM) file section (segment
257 information or a certain track's headers) that all following add, set
258 and delete actions operate on. This stays valid until the next --edit
259 option is found. The argument to this option is called the edit
260 selector.
261
262 By default mkvpropedit(1) will edit the segment information section.
263
264 Segment information
265 The segment information can be selected with one of these three words:
266 'info', 'segment_info' or 'segmentinfo'. It contains properties like
267 the segment title or the segment UID.
268
269 Track headers
270 Track headers can be selected with a slightly more complex selector.
271 All variations start with 'track:'. The track header properties include
272 elements like the language code, 'default track' flag or the track's
273 name.
274
275 track:n
276 If the parameter n is a number then the nth track will be selected.
277 The track order is the same that mkvmerge(1)'s --identify option
278 outputs.
279
280 Numbering starts at 1.
281
282 track:tn
283 If the parameter starts with a single character t followed by a n
284 then the nth track of a specific track type will be selected. The
285 track type parameter t must be one of these four characters: 'a'
286 for an audio track, 'b' for a button track, 's' for a subtitle
287 track and 'v' for a video track. The track order is the same that
288 mkvmerge(1)'s --identify option outputs.
289
290 Numbering starts at 1.
291
292 track:=uid
293 If the parameter starts with a '=' followed by a number uid, the
294 track whose track UID element equals the given uid will be
295 selected. Track UIDs can be obtained with mkvinfo(1).
296
297 track:@number
298 If the parameter starts with a '@' followed by a number number, the
299 track whose track number element equals this number will be
300 selected. Track numbers can be obtained with mkvinfo(1).
301
302 Notes
303 Due to the nature of the track edit selectors it is possible that
304 several selectors actually match the same track headers. In such cases
305 all actions for those edit selectors will be combined and executed in
306 the order in which they're given on the command line.
307
309 An attachment selector is used with the two actions
310 --replace-attachment and --delete-attachment. It can have one of the
311 following four forms:
312
313 1. Selection by attachment ID. In this form the selector is simply a
314 number, the attachment's ID as output by mkvmerge(1)'s
315 identification command.
316
317 2. Selection by attachment UID (unique ID). In this form the selector
318 is the equal sign = followed by a number, the attachment's unique
319 ID as output by mkvmerge(1)'s verbose identification command.
320
321 3. Selection by attachment name. In this form the selector is the
322 literal word name: followed by the existing attachment's name. If
323 this selector is used with --replace-attachment then colons within
324 the name to match must be escaped as \c.
325
326 4. Selection by MIME type. In this form the selector is the literal
327 word mime-type: followed by the existing attachment's MIME type. If
328 this selector is used with --replace-attachment then colons within
329 the MIME type to match must be escaped as \c.
330
332 The following example edits a file called 'movie.mkv'. It sets the
333 segment title and modifies the language code of an audio and a subtitle
334 track. Note that this example can be shortened by leaving out the first
335 --edit option because editing the segment information element is the
336 default for all options found before the first --edit option anyway.
337
338 $ mkvpropedit movie.mkv --edit info --set "title=The movie" --edit track:a1 --set language=fre --edit track:a2 --set language=ita
339
340 The second example removes the 'default track flag' from the first
341 subtitle track and sets it for the second one. Note that
342 mkvpropedit(1), unlike mkvmerge(1), does not set the 'default track
343 flag' of other tracks to '0' if it is set to '1' for a different track
344 automatically.
345
346 $ mkvpropedit movie.mkv --edit track:s1 --set flag-default=0 --edit track:s2 --set flag-default=1
347
348 Replacing the tags for the second subtitle track in a file looks like
349 this:
350
351 $ mkvpropedit movie.mkv --tags track:s2:new-subtitle-tags.xml
352
353 Removing all tags requires leaving out the file name:
354
355 $ mkvpropedit movie.mkv --tags all:
356
357 Replacing the chapters in a file looks like this:
358
359 $ mkvpropedit movie.mkv --chapters new-chapters.xml
360
361 Removing all chapters requires leaving out the file name:
362
363 $ mkvpropedit movie.mkv --chapters ''
364
365 Adding a font file (Arial.ttf) as an attachment:
366
367 $ mkvpropedit movie.mkv --add-attachment Arial.ttf
368
369 Adding a font file (89719823.ttf) as an attachment and providing some
370 information as it really is just Arial:
371
372 $ mkvpropedit movie.mkv --attachment-name Arial.ttf --attachment-description 'The Arial font as a TrueType font' --attachment-mime-type application/x-truetype-font --add-attachment 89719823.ttf
373
374 Replacing one attached font (Comic.ttf) file with another one
375 (Arial.ttf):
376
377 $ mkvpropedit movie.mkv --attachment-name Arial.ttf --attachment-description 'The Arial font as a TrueType font' --replace-attachment name:Comic.ttf:Arial.ttf
378
379 Deleting the second attached file, whatever it may be:
380
381 $ mkvpropedit movie.mkv --delete-attachment 2
382
383 Deleting all attached fonts by MIME type:
384
385 $ mkvpropedit movie.mkv --delete-attachment mime-type:application/x-truetype-font
386
388 mkvpropedit(1) exits with one of three exit codes:
389
390 · 0 -- This exit code means that the modification has completed
391 successfully.
392
393 · 1 -- In this case mkvpropedit(1) has output at least one warning,
394 but the modification did continue. A warning is prefixed with the
395 text 'Warning:'. Depending on the issues involved the resulting
396 files might be ok or not. The user is urged to check both the
397 warning and the resulting files.
398
399 · 2 -- This exit code is used after an error occurred.
400 mkvpropedit(1) aborts right after outputting the error message.
401 Error messages range from wrong command line arguments over
402 read/write errors to broken files.
403
405 For an in-depth discussion about how all tools in the MKVToolNix suite
406 handle character set conversions, input/output encoding, command line
407 encoding and console encoding please see the identically-named section
408 in the mkvmerge(1) man page.
409
411 mkvpropedit(1) uses the default variables that determine the system's
412 locale (e.g. LANG and the LC_* family). Additional variables:
413
414 MKVPROPEDIT_DEBUG, MKVTOOLNIX_DEBUG and its short form MTX_DEBUG
415 The content is treated as if it had been passed via the --debug
416 option.
417
418 MKVPROPEDIT_ENGAGE, MKVTOOLNIX_ENGAGE and its short form MTX_ENGAGE
419 The content is treated as if it had been passed via the --engage
420 option.
421
423 mkvmerge(1), mkvinfo(1), mkvextract(1), mkvtoolnix-gui(1)
424
426 The latest version can always be found at the MKVToolNix homepage[1].
427
429 Moritz Bunkus <moritz@bunkus.org>
430 Developer
431
433 1. the MKVToolNix homepage
434 https://mkvtoolnix.download/
435
436
437
438MKVToolNix 53.0.0 2021-01-30 MKVPROPEDIT(1)