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 --enable-legacy-font-mime-types
186 Enables the use of legacy MIME types for certain types of font
187 attachments. For example, 'application/x-truetype-font' will be
188 used for TrueType fonts instead of 'fonts/ttf'.
189
190 This affects both adding new attachments and replacing existing
191 attachments, but only if the new MIME type isn't specified. Other
192 existing attachments aren't changed.
193
194 The affected MIME types are 'font/sfnt', 'font/ttf' and
195 'font/collection' which are all mapped to
196 'application/x-truetype-fonts' and 'font/otf' which is mapped to
197 'application/vnd.ms-opentype'.
198
199 Other options:
200
201 --disable-language-ietf
202 Normally when the user requests changes to the 'language' track
203 header property, mkvpropedit(1) will apply the same change to the
204 new LanguageIETF track header element in addition to the legacy
205 Language element. If this option is used, the change is only
206 applied to the legacy Language element.
207
208 This option does not affect changes requested via the
209 'language-ietf' track header property.
210
211 --normalize-language-ietf mode
212 Enables normalizing all IETF BCP 47 language tags to either their
213 canonical form with mode 'canonical', to their extended language
214 subtags form with mode 'extlang' or turns it off with mode 'off'.
215 By default normalization to the canonical form is applied.
216
217 In the canonical form all subtags for which preferred values exist
218 are replaced by those preferred values. This converts e.g.
219 'zh-yue-jyutping' to 'yue-jyutping' or 'fr-FX' to 'fr-FR'.
220
221 For the extended language subtags form the canonical form is built
222 first. Afterwards all primary languages for which an extended
223 language subtag exists are replaced by that extended language
224 subtag and its prefix. This converts e.g. 'yue-jyutping' back to
225 'zh-yue-jyutping' but has no effect on 'fr-FR' as 'fr' is not an
226 extended language subtag.
227
228 This normalization is only applied to elements that are actually
229 changed:
230
231 • When editing track headers only those track language elements
232 that are set via edit specifications are affected. Languages of
233 tracks that aren't edited aren't changed. Editing a track but
234 setting only properties other than the language won't affect
235 the language either.
236
237 • When editing chapters all language elements of all chapter
238 elements are affected as existing chapters are always fully
239 replaced.
240
241 • When editing tags only the language elements of the tags that
242 are actually replaced are affected. For example, when you
243 replace global tags then existing track tags aren't affected.
244
245 The best way to normalize all existing language tags in a file is
246 to remux it with mkvmerge(1) and set its
247 '--normalize-language-ietf' option to the desired mode.
248
249 --command-line-charset character-set
250 Sets the character set to convert strings given on the command line
251 from. It defaults to the character set given by system's current
252 locale.
253
254 --output-charset character-set
255 Sets the character set to which strings are converted that are to
256 be output. It defaults to the character set given by system's
257 current locale.
258
259 -r, --redirect-output file-name
260 Writes all messages to the file file-name instead of to the
261 console. While this can be done easily with output redirection
262 there are cases in which this option is needed: when the terminal
263 reinterprets the output before writing it to a file. The character
264 set set with --output-charset is honored.
265
266 --ui-language code
267 Forces the translations for the language code to be used (e.g.
268 'de_DE' for the German translations). Entering 'list' as the code
269 will cause the program to output a list of available translations.
270
271 --abort-on-warnings
272 Tells the program to abort after the first warning is emitted. The
273 program's exit code will be 1.
274
275 --debug topic
276 Turn on debugging for a specific feature. This option is only
277 useful for developers.
278
279 --engage feature
280 Turn on experimental features. A list of available features can be
281 requested with mkvpropedit --engage list. These features are not
282 meant to be used in normal situations.
283
284 --gui-mode
285 Turns on GUI mode. In this mode specially-formatted lines may be
286 output that can tell a controlling GUI what's happening. These
287 messages follow the format '#GUI#message'. The message may be
288 followed by key/value pairs as in
289 '#GUI#message#key1=value1#key2=value2...'. Neither the messages nor
290 the keys are ever translated and always output in English.
291
292 -v, --verbose
293 Be verbose and show all the important Matroska(TM) elements as
294 they're read.
295
296 -h, --help
297 Show usage information and exit.
298
299 -V, --version
300 Show version information and exit.
301
302 @options-file.json
303 Reads additional command line arguments from the file options-file.
304 For a full explanation on the supported formats for such files see
305 the section called "Option files" in the mkvmerge(1) man page.
306
308 The --edit option sets the Matroska(TM) file section (segment
309 information or a certain track's headers) that all following add, set
310 and delete actions operate on. This stays valid until the next --edit
311 option is found. The argument to this option is called the edit
312 selector.
313
314 By default mkvpropedit(1) will edit the segment information section.
315
316 Segment information
317 The segment information can be selected with one of these three words:
318 'info', 'segment_info' or 'segmentinfo'. It contains properties like
319 the segment title or the segment UID.
320
321 Track headers
322 Track headers can be selected with a slightly more complex selector.
323 All variations start with 'track:'. The track header properties include
324 elements like the language code, 'default track' flag or the track's
325 name.
326
327 track:n
328 If the parameter n is a number then the nth track will be selected.
329 The track order is the same that mkvmerge(1)'s --identify option
330 outputs.
331
332 Numbering starts at 1.
333
334 track:tn
335 If the parameter starts with a single character t followed by a n
336 then the nth track of a specific track type will be selected. The
337 track type parameter t must be one of these four characters: 'a'
338 for an audio track, 'b' for a button track, 's' for a subtitle
339 track and 'v' for a video track. The track order is the same that
340 mkvmerge(1)'s --identify option outputs.
341
342 Numbering starts at 1.
343
344 track:=uid
345 If the parameter starts with a '=' followed by a number uid, the
346 track whose track UID element equals the given uid will be
347 selected. Track UIDs can be obtained with mkvinfo(1).
348
349 track:@number
350 If the parameter starts with a '@' followed by a number number, the
351 track whose track number element equals this number will be
352 selected. Track numbers can be obtained with mkvinfo(1).
353
354 Notes
355 Due to the nature of the track edit selectors it is possible that
356 several selectors actually match the same track headers. In such cases
357 all actions for those edit selectors will be combined and executed in
358 the order in which they're given on the command line.
359
361 An attachment selector is used with the two actions
362 --replace-attachment and --delete-attachment. It can have one of the
363 following four forms:
364
365 1. Selection by attachment ID. In this form the selector is simply a
366 number, the attachment's ID as output by mkvmerge(1)'s
367 identification command.
368
369 2. Selection by attachment UID (unique ID). In this form the selector
370 is the equal sign = followed by a number, the attachment's unique
371 ID as output by mkvmerge(1)'s verbose identification command.
372
373 3. Selection by attachment name. In this form the selector is the
374 literal word name: followed by the existing attachment's name. If
375 this selector is used with --replace-attachment then colons within
376 the name to match must be escaped as \c.
377
378 4. Selection by MIME type. In this form the selector is the literal
379 word mime-type: followed by the existing attachment's MIME type. If
380 this selector is used with --replace-attachment then colons within
381 the MIME type to match must be escaped as \c.
382
384 The following example edits a file called 'movie.mkv'. It sets the
385 segment title and modifies the language code of an audio and a subtitle
386 track. Note that this example can be shortened by leaving out the first
387 --edit option because editing the segment information element is the
388 default for all options found before the first --edit option anyway.
389
390 $ mkvpropedit movie.mkv --edit info --set "title=The movie" --edit track:a1 --set language=fre --edit track:a2 --set language=ita
391
392 The second example removes the 'default track flag' from the first
393 subtitle track and sets it for the second one. Note that
394 mkvpropedit(1), unlike mkvmerge(1), does not set the 'default track
395 flag' of other tracks to '0' if it is set to '1' for a different track
396 automatically.
397
398 $ mkvpropedit movie.mkv --edit track:s1 --set flag-default=0 --edit track:s2 --set flag-default=1
399
400 Replacing the tags for the second subtitle track in a file looks like
401 this:
402
403 $ mkvpropedit movie.mkv --tags track:s2:new-subtitle-tags.xml
404
405 Removing all tags requires leaving out the file name:
406
407 $ mkvpropedit movie.mkv --tags all:
408
409 Replacing the chapters in a file looks like this:
410
411 $ mkvpropedit movie.mkv --chapters new-chapters.xml
412
413 Removing all chapters requires leaving out the file name:
414
415 $ mkvpropedit movie.mkv --chapters ''
416
417 Adding a font file (Arial.ttf) as an attachment:
418
419 $ mkvpropedit movie.mkv --add-attachment Arial.ttf
420
421 Adding a font file (89719823.ttf) as an attachment and providing some
422 information as it really is just Arial:
423
424 $ 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
425
426 Replacing one attached font (Comic.ttf) file with another one
427 (Arial.ttf):
428
429 $ mkvpropedit movie.mkv --attachment-name Arial.ttf --attachment-description 'The Arial font as a TrueType font' --replace-attachment name:Comic.ttf:Arial.ttf
430
431 Deleting the second attached file, whatever it may be:
432
433 $ mkvpropedit movie.mkv --delete-attachment 2
434
435 Deleting all attached fonts by MIME type:
436
437 $ mkvpropedit movie.mkv --delete-attachment mime-type:application/x-truetype-font
438
440 mkvpropedit(1) exits with one of three exit codes:
441
442 • 0 -- This exit code means that the modification has completed
443 successfully.
444
445 • 1 -- In this case mkvpropedit(1) has output at least one warning,
446 but the modification did continue. A warning is prefixed with the
447 text 'Warning:'. Depending on the issues involved the resulting
448 files might be ok or not. The user is urged to check both the
449 warning and the resulting files.
450
451 • 2 -- This exit code is used after an error occurred.
452 mkvpropedit(1) aborts right after outputting the error message.
453 Error messages range from wrong command line arguments over
454 read/write errors to broken files.
455
457 For an in-depth discussion about how all tools in the MKVToolNix suite
458 handle character set conversions, input/output encoding, command line
459 encoding and console encoding please see the identically-named section
460 in the mkvmerge(1) man page.
461
463 mkvpropedit(1) uses the default variables that determine the system's
464 locale (e.g. LANG and the LC_* family). Additional variables:
465
466 MKVPROPEDIT_DEBUG, MKVTOOLNIX_DEBUG and its short form MTX_DEBUG
467 The content is treated as if it had been passed via the --debug
468 option.
469
470 MKVPROPEDIT_ENGAGE, MKVTOOLNIX_ENGAGE and its short form MTX_ENGAGE
471 The content is treated as if it had been passed via the --engage
472 option.
473
475 mkvmerge(1), mkvinfo(1), mkvextract(1), mkvtoolnix-gui(1)
476
478 The latest version can always be found at the MKVToolNix homepage[1].
479
481 Moritz Bunkus <moritz@bunkus.org>
482 Developer
483
485 1. the MKVToolNix homepage
486 https://mkvtoolnix.download/
487
488
489
490MKVToolNix 73.0.0 2023-01-02 MKVPROPEDIT(1)