1MKVMERGE(1)                      User Commands                     MKVMERGE(1)
2
3
4

NAME

6       mkvmerge - Merge multimedia streams into a Matroska(TM) file
7

SYNOPSIS

9       mkvmerge [global options] {-o out} [options1] {file1}
10                [[options2] {file2}] [@options-file.json]
11

DESCRIPTION

13       This program takes the input from several media files and joins their
14       streams (all of them or just a selection) into a Matroska(TM) file; see
15       the Matroska(TM) website[1].
16
17           Important
18           The order of command line options is important. Please read the
19           section "Option order" if you're new to the program.
20
21   Global options
22       -v, --verbose
23           Increase verbosity.
24
25       -q, --quiet
26           Suppress status output.
27
28       -o, --output file-name
29           Write to the file file-name. If splitting is used then this
30           parameter is treated a bit differently. See the explanation for the
31           --split option for details.
32
33       -w, --webm
34           Create a WebM compliant file. This is also turned on if the output
35           file name's extension is "webm". This mode enforces several
36           restrictions. The only allowed codecs are VP8, VP9 video and Opus,
37           Vorbis audio tracks. The DocType header item is changed to "webm".
38
39           For chapters and tags only a subset of elements are allowed.
40           mkvmerge(1) will automatically remove all elements not allowed by
41           the specification.
42
43       --title title
44           Sets the general title for the output file, e.g. the movie name.
45
46       --default-language language-code
47           Sets the default language code that will be used for tracks for
48           which no language is set with the --language option and for which
49           the source container doesn't provide a language.
50
51           The default language code is 'und' for 'undetermined'.
52
53   Segment info handling (global options)
54       --segmentinfo filename.xml
55           Read segment information from an XML file. This file can contain
56           the segment family UID, segment UID, previous and next segment UID
57           elements. An example file and a DTD are included in the MKVToolNix
58           distribution.
59
60           See the section about segment info XML files below for details.
61
62       --segment-uid SID1,SID2,...
63           Sets the segment UIDs to use. This is a comma-separated list of
64           128-bit segment UIDs in the usual UID form: hex numbers with or
65           without the "0x" prefix, with or without spaces, exactly 32 digits.
66
67           If SID starts with = then its rest is interpreted as the name of a
68           Matroska file whose segment UID is read and used.
69
70           Each file created contains one segment, and each segment has one
71           segment UID. If more segment UIDs are specified than segments are
72           created then the surplus UIDs are ignored. If fewer UIDs are
73           specified than segments are created then random UIDs will be
74           created for them.
75
76   Chapter and tag handling (global options)
77       --chapter-language language-code
78           Sets the ISO 639-2 language code that is written for each chapter
79           entry. Defaults to 'eng'. See the section about chapters below for
80           details.
81
82           This option can be used both for simple chapter files and for
83           source files that contain chapters but no information about the
84           chapters' language, e.g. MP4 and OGM files.
85
86           The language set with this option is also used when chapters are
87           generated with the --generate-chapters option.
88
89       --chapter-charset character-set
90           Sets the character set that is used for the conversion to UTF-8 for
91           simple chapter files. See the section about text files and
92           character sets for an explanation how mkvmerge(1) converts between
93           character sets.
94
95           This switch does also apply to chapters that are copied from
96           certain container types, e.g. Ogg/OGM and MP4 files. See the
97           section about chapters below for details.
98
99       --chapter-sync d[,o[/p]]
100           Adjust the timestamps of the chapters in the following source file
101           by d ms. Alternatively you can use the --sync option with the
102           special track ID -2 (see section special track IDs).
103
104           o/p: adjust the timestamps by o/p to fix linear drifts.  p defaults
105           to 1 if omitted. Both o and p can be floating point numbers.
106
107           Defaults: no manual sync correction (which is the same as d = 0 and
108           o/p = 1.0).
109
110           This option can be used multiple times for an input file applying
111           to several tracks by selecting different track IDs each time.
112
113       --generate-chapters mode
114           mkvmerge(1) can create chapters automatically. The following two
115           modes are currently supported:
116
117           •   'when-appending' – This mode creates one chapter at the start
118               and one chapter whenever a file is appended.
119
120               This mode also works with split modes 'parts:' and
121               'parts-frames:'. For these modes one chapter will be generated
122               for each appended timestamp range (those whose start timestamps
123               are prefixed with '+').
124
125                   Note
126                   mkvmerge(1) requires a video or an audio track to be
127                   present in order to be able to determine when a new file is
128                   appended. If one or more video tracks are muxed the first
129                   one is used. Otherwise the first audio track is used.
130
131           •   'interval:time-spec' – This mode creates one chapter at fixed
132               intervals given by time-spec. The format is either the form
133               HH:MM:SS.nnnnnnnnn or a number followed by one of the units
134               's', 'ms' or 'us'.
135
136               Example: --generate-chapters interval:45s
137
138           The names for the new chapters are controlled by the option
139           --generate-chapters-name-template. The language is set with
140           --chapter-language which must occur before --generate-chapters.
141
142       --generate-chapters-name-template template
143           This sets the name template for chapter names generated by the
144           option --generate-chapters. If the option is not used then default
145           'Chapter <NUM:2>' will be used.
146
147           There are several variables that can be used in the template that
148           are replaced by their actual values when a chapter is generated.
149           The string '<NUM>' will be replaced by the chapter number. The
150           string '<START>' will be replaced by the chapter's start timestamp.
151
152           The strings '<FILE_NAME>' and '<FILE_NAME_WITH_EXT>' are only
153           filled when generating chapters for appended files. They will be
154           replaced by the appended file's name without respectively with its
155           extension. Note that only the file's base name and extension are
156           inserted, not its directory or drive components.
157
158           You can specify a minimum number of places for the chapter number
159           with '<NUM:places>', e.g. '<NUM:3>'. The resulting number will be
160           padded with leading zeroes if the number of places is less than
161           specified.
162
163           You can control the format used by the start timestamp with
164           <START:format>. The format defaults to '%H:%M:%S' if none is given.
165           Valid format codes are:
166
167           •   %h – hours
168
169           •   %H – hours zero-padded to two places
170
171           •   %m – minutes
172
173           •   %M – minutes zero-padded to two places
174
175           •   %s – seconds
176
177           •   %S – seconds zero-padded to two places
178
179           •   %n – nanoseconds with nine places
180
181           •   %<1-9>n – nanoseconds with up to nine places (e.g. three places
182               with %3n)
183
184       --cue-chapter-name-format format
185           mkvmerge(1) supports reading CUE sheets for audio files as the
186           input for chapters.  CUE sheets usually contain the entries
187           PERFORMER and TITLE for each index entry.  mkvmerge(1) uses these
188           two strings in order to construct the chapter name. With this
189           option the format used for this name can be set.
190
191           If this option is not given then mkvmerge(1) defaults to the format
192           '%p - %t' (the performer, followed by a space, a dash, another
193           space and the title).
194
195           If the format is given then everything except the following meta
196           characters is copied as-is, and the meta characters are replaced
197           like this:
198
199%p is replaced by the current entry's PERFORMER string,
200
201%t is replaced by the current entry's TITLE string,
202
203%n is replaced by the current track number and
204
205%N is replaced by the current track number padded with a
206               leading zero if it is < 10.
207
208       --chapters file-name
209           Read chapter information from the file file-name. See the section
210           about chapters below for details.
211
212       --global-tags file-name
213           Read global tags from the file file-name. See the section about
214           tags below for details.
215
216   General output control (advanced global options)
217       --track-order FID1:TID1,FID2:TID2,...
218           This option changes the order in which the tracks for an input file
219           are created. The argument is a comma separated list of pairs IDs.
220           Each pair contains first the file ID (FID1) which is simply the
221           number of the file on the command line starting at 0. The second is
222           a track ID (TID1) from that file. If some track IDs are omitted
223           then those tracks are created after the ones given with this option
224           have been created.
225
226           If this option isn't given, tracks will be sorted by their type
227           first & the order of their source file second. Video tracks come
228           first followed by audio & subtitle tracks. Other rarely used track
229           types come last.
230
231       --cluster-length spec
232           Limit the number of data blocks or the duration of data in each
233           cluster. The spec parameter can either be a number n without a unit
234           or a number d postfixed with 'ms'.
235
236           If no unit is used then mkvmerge(1) will put at most n data blocks
237           into each cluster. The maximum number of blocks is 65535.
238
239           If the number d is postfixed with 'ms' then mkvmerge(1) puts at
240           most d milliseconds of data into each cluster. The minimum for d is
241           '100ms', and the maximum is '32000ms'.
242
243           mkvmerge(1) defaults to putting at most 65535 data blocks and
244           5000ms of data into a cluster.
245
246           Programs trying to find a certain frame can only seek directly to a
247           cluster and have to read the whole cluster afterwards. Therefore
248           creating larger clusters may lead to imprecise or slow seeking.
249
250       --clusters-in-meta-seek
251           Tells mkvmerge(1) to create a meta seek element at the end of the
252           file containing all clusters. See also the section about the
253           Matroska(TM) file layout.
254
255       --timestamp-scale factor
256           Forces the timestamp scale factor to factor. Valid values are in
257           the range 1000..10000000 or the special value -1.
258
259           Normally mkvmerge(1) will use a value of 1000000 which means that
260           timestamps and durations will have a precision of 1ms. For files
261           that will not contain a video track but at least one audio track
262           mkvmerge(1) will automatically chose a timestamp scale factor so
263           that all timestamps and durations have a precision of one audio
264           sample. This causes bigger overhead but allows precise seeking and
265           extraction.
266
267           If the special value -1 is used then mkvmerge(1) will use sample
268           precision even if a video track is present.
269
270       --enable-durations
271           Write durations for all blocks. This will increase file size and
272           does not offer any additional value for players at the moment.
273
274       --no-cues
275           Tells mkvmerge(1) not to create and write the cue data which can be
276           compared to an index in an AVI.  Matroska(TM) files can be played
277           back without the cue data, but seeking will probably be imprecise
278           and slower. Use this only if you're really desperate for space or
279           for testing purposes. See also option --cues which can be specified
280           for each input file.
281
282       --no-date
283           By default mkvmerge(1) sets the "date" segment information field to
284           the time & date when multiplexing started. With this option that
285           field is not written at all.
286
287       --disable-lacing
288           Disables lacing for all tracks. This will increase the file's size,
289           especially if there are many audio tracks. This option is not
290           intended for everyday use.
291
292       --disable-track-statistics-tags
293           Normally mkvmerge(1) will write certain tags with statistics for
294           each track. If such tags are already present then they will be
295           overwritten. The tags are BPS, DURATION, NUMBER_OF_BYTES and
296           NUMBER_OF_FRAMES.
297
298           Enabling this option prevents mkvmerge(1) from writing those tags
299           and from touching any existing tags with same names.
300
301       --disable-language-ietf
302           Normally mkvmerge(1) will write the new IETF BCP 47 language
303           elements in addition to the legacy language elements in track
304           headers, chapters and tags. If this option is used, only the legacy
305           elements are written.
306
307       --normalize-language-ietf mode
308           Enables normalizing all IETF BCP 47 language tags to either their
309           canonical form with mode 'canonical', to their extended language
310           subtags form with mode 'extlang' or turns it off with mode 'off'.
311           By default normalization to the canonical form is applied.
312
313           In the canonical form all subtags for which preferred values exist
314           are replaced by those preferred values. This converts e.g.
315           'zh-yue-jyutping' to 'yue-jyutping' or 'fr-FX' to 'fr-FR'.
316
317           For the extended language subtags form the canonical form is built
318           first. Afterwards all primary languages for which an extended
319           language subtag exists are replaced by that extended language
320           subtag and its prefix. This converts e.g. 'yue-jyutping' back to
321           'zh-yue-jyutping' but has no effect on 'fr-FR' as 'fr' is not an
322           extended language subtag.
323
324       --stop-after-video-ends
325           Stops processing after the primary video track ends, discarding any
326           remaining packets of other tracks.
327
328   File splitting, linking, appending and concatenation (more global options)
329       --split specification
330           Splits the output file after a given size or a given time. Please
331           note that tracks can only be split right before a key frame.
332           Therefore the split point may be a bit off from what the user has
333           specified.
334
335           At the moment mkvmerge(1) supports the following modes:
336
337            1. Splitting by size.
338
339               Syntax: --split [size:]d[k|m|g]
340
341               Examples: --split size:700m or --split 150000000
342
343               The parameter d may end with 'k', 'm' or 'g' to indicate that
344               the size is in KB, MB or GB respectively. Otherwise a size in
345               bytes is assumed. After the current output file has reached
346               this size limit a new one will be started.
347
348               The 'size:' prefix may be omitted for compatibility reasons.
349
350            2. Splitting after a duration.
351
352               Syntax: --split [duration:]HH:MM:SS.nnnnnnnnn|ds
353
354               Examples: --split duration:00:60:00.000 or --split 3600s
355
356               The parameter must either have the form HH:MM:SS.nnnnnnnnn for
357               specifying the duration in up to nano-second precision or be a
358               number d followed by the letter 's' for the duration in
359               seconds.  HH is the number of hours, MM the number of minutes,
360               SS the number of seconds and nnnnnnnnn the number of
361               nanoseconds. Both the number of hours and the number of
362               nanoseconds can be omitted. There can be up to nine digits
363               after the decimal point. After the duration of the contents in
364               the current output has reached this limit a new output file
365               will be started.
366
367               The 'duration:' prefix may be omitted for compatibility
368               reasons.
369
370            3. Splitting after specific timestamps.
371
372               Syntax: --split timestamps:A[,B[,C...]]
373
374               Example: --split timestamps:00:45:00.000,01:20:00.250,6300s
375
376               The parameters A, B, C etc must all have the same format as the
377               ones used for the duration (see above). The list of timestamps
378               is separated by commas. After the input stream has reached the
379               current split point's timestamp a new file is created. Then the
380               next split point given in this list is used.
381
382               The 'timestamps:' prefix must not be omitted.
383
384            4. Keeping specific parts by specifying timestamp ranges while
385               discarding others.
386
387               Syntax: --split
388               parts:start1-end1[,[+]start2-end2[,[+]start3-end3...]]
389
390               Examples:
391
392                1. --split parts:00:01:20-00:02:45,00:05:50-00:10:30
393
394                2. --split parts:00:01:20-00:02:45,+00:05:50-00:10:30
395
396                3. --split parts:-00:02:45,00:05:50-
397
398               The parts mode tells mkvmerge(1) to keep certain ranges of
399               timestamps while discarding others. The ranges to keep have to
400               be listed after the parts: keyword and be separated by commas.
401               A range itself consists of a start and an end timestamp in the
402               same format the other variations of --split accept (e.g. both
403               00:01:20 and 80s refer to the same timestamp).
404
405               If a start timestamp is left out then it defaults to the
406               previous range's end timestamp. If there was no previous range
407               then it defaults to the start of the file (see example 3).
408
409               If an end timestamp is left out then it defaults to the end of
410               the source files which basically tells mkvmerge(1) to keep the
411               rest (see example 3).
412
413               Normally each range will be written to a new file. This can be
414               changed so that consecutive ranges are written to the same
415               file. For that the user has to prefix the start timestamp with
416               a +. This tells mkvmerge(1) not to create a new file and
417               instead append the range to the same file the previous range
418               was written to. Timestamps will be adjusted so that there will
419               be no gap in the output file even if there was a gap in the two
420               ranges in the input file.
421
422               In example 1 mkvmerge(1) will create two files. The first will
423               contain the content starting from 00:01:20 until 00:02:45. The
424               second file will contain the content starting from 00:05:50
425               until 00:10:30.
426
427               In example 2 mkvmerge(1) will create only one file. This file
428               will contain both the content starting from 00:01:20 until
429               00:02:45 and the content starting from 00:05:50 until 00:10:30.
430
431               In example 3 mkvmerge(1) will create two files. The first will
432               contain the content from the start of the source files until
433               00:02:45. The second file will contain the content starting
434               from 00:05:50 until the end of the source files.
435
436                   Note
437                   Note that mkvmerge(1) only makes decisions about splitting
438                   at key frame positions. This applies to both the start and
439                   the end of each range. So even if an end timestamp is
440                   between two key frames mkvmerge(1) will continue outputting
441                   the frames up to but excluding the following key frame.
442
443            5. Keeping specific parts by specifying frame/field number ranges
444               while discarding others.
445
446               Syntax: --split
447               parts-frames:start1-end1[,[+]start2-end2[,[+]start3-end3...]]
448
449               Examples:
450
451                1. --split parts-frames:137-258,548-1211
452
453                2. --split parts-frames:733-912,+1592-2730
454
455                3. --split parts-frames:-430,2512-
456
457               The parts-frames mode tells mkvmerge(1) to keep certain ranges
458               of frame/field numbers while discarding others. The ranges to
459               keep have to be listed after the parts-frames: keyword and be
460               separated by commas. A range itself consists of a start and an
461               end frame/field number. Numbering starts at 1.
462
463               If a start number is left out then it defaults to the previous
464               range's end number. If there was no previous range then it
465               defaults to the start of the file (see example 3).
466
467               If an end number is left out then it defaults to the end of the
468               source files which basically tells mkvmerge(1) to keep the rest
469               (see example 3).
470
471               Normally each range will be written to a new file. This can be
472               changed so that consecutive ranges are written to the same
473               file. For that the user has to prefix the start number with a
474               +. This tells mkvmerge(1) not to create a new file and instead
475               append the range to the same file the previous range was
476               written to. Timestamps will be adjusted so that there will be
477               no gap in the output file even if there was a gap in the two
478               ranges in the input file.
479
480                   Note
481                   Note that mkvmerge(1) only makes decisions about splitting
482                   at key frame positions. This applies to both the start and
483                   the end of each range. So even if an end frame/field number
484                   is between two key frames mkvmerge(1) will continue
485                   outputting the frames up to but excluding the following key
486                   frame.
487               In example 1 mkvmerge(1) will create two files. The first will
488               contain the content starting from the first key frame at or
489               after 137 up to but excluding the first key frame at or after
490               258. The second file will contain the content starting from 548
491               until 1211.
492
493               In example 2 mkvmerge(1) will create only one file. This file
494               will contain both the content starting from 733 until 912 and
495               the content starting from 1592 until 2730.
496
497               In example 3 mkvmerge(1) will create two files. The first will
498               contain the content from the start of the source files until
499               430. The second file will contain the content starting from
500               2512 until the end of the source files.
501
502               This mode considers only the first video track that is output.
503               If no video track is output no splitting will occur.
504
505                   Note
506                   The numbers given with this argument are interpreted based
507                   on the number of Matroska(TM) blocks that are output. A
508                   single Matroska(TM) block contains either a full frame (for
509                   progressive content) or a single field (for interlaced
510                   content). mkvmerge does not distinguish between those two
511                   and simply counts the number of blocks. For example: If one
512                   wanted to split after the 25th full frame with interlaced
513                   content one would have to use 50 (two fields per full
514                   frame) as the split point.
515
516            6. Splitting after specific frames/fields.
517
518               Syntax: --split frames:A[,B[,C...]]
519
520               Example: --split frames:120,237,891
521
522               The parameters A, B, C etc must all be positive integers.
523               Numbering starts at 1. The list of frame/field numbers is
524               separated by commas. After the input stream has reached the
525               current split point's frame/field number a new file is created.
526               Then the next split point given in this list is used.
527
528               The 'frames:' prefix must not be omitted.
529
530               This mode considers only the first video track that is output.
531               If no video track is output no splitting will occur.
532
533                   Note
534                   The numbers given with this argument are interpreted based
535                   on the number of Matroska(TM) blocks that are output. A
536                   single Matroska(TM) block contains either a full frame (for
537                   progressive content) or a single field (for interlaced
538                   content). mkvmerge does not distinguish between those two
539                   and simply counts the number of blocks. For example: If one
540                   wanted to split after the 25th full frame with interlaced
541                   content one would have to use 50 (two fields per full
542                   frame) as the split point.
543
544            7. Splitting before specific chapters.
545
546               Syntax: --split chapters:all or --split chapters:A[,B[,C...]]
547
548               Example: --split chapters:5,8
549
550               The parameters A, B, C etc must all be positive integers.
551               Numbering starts at 1. The list of chapter numbers is separated
552               by commas. Splitting will occur right before the first key
553               frame whose timestamp is equal to or bigger than the start
554               timestamp for the chapters whose numbers are listed. A chapter
555               starting at 0s is never considered for splitting and discarded
556               silently.
557
558               The keyword all can be used instead of listing all chapter
559               numbers manually.
560
561               The 'chapters:' prefix must not be omitted.
562
563                   Note
564                   The Matroska(TM) file format supports arbitrary deeply
565                   nested chapter structures called 'edition entries' and
566                   'chapter atoms'. However, this mode only considers the
567                   top-most level of chapters across all edition entries.
568
569           For this splitting mode the output filename is treated differently
570           than for the normal operation. It may contain a printf like
571           expression '%d' including an optional field width, e.g. '%02d'. If
572           it does then the current file number will be formatted
573           appropriately and inserted at that point in the filename. If there
574           is no such pattern then a pattern of '-%03d' is assumed right
575           before the file's extension: '-o output.mkv' would result in
576           'output-001.mkv' and so on. If there's no extension then '-%03d'
577           will be appended to the name.
578
579           Another possible pattern is '%c' which will be replaced by the name
580           of the first chapter in the file. Note that when '%c' is present,
581           the pattern '-%03d' will not be added automatically.
582
583       --link
584           Link files to one another when splitting the output file. See the
585           section on file linking below for details.
586
587       --link-to-previous segment-UID
588           Links the first output file to the segment with the segment UID
589           given by the segment-UID parameter. See the section on file linking
590           below for details.
591
592           If SID starts with = then its rest is interpreted as the name of a
593           Matroska file whose segment UID is read and used.
594
595       --link-to-next segment-UID
596           Links the last output file to the segment with the segment UID
597           given by the segment-UID parameter. See the section on file linking
598           below for details.
599
600           If SID starts with = then its rest is interpreted as the name of a
601           Matroska file whose segment UID is read and used.
602
603       --append-mode mode
604           Determines how timestamps are calculated when appending files. The
605           parameter mode can have two values: 'file' which is also the
606           default and 'track'.
607
608           When mkvmerge appends a track (called 'track2_1' from now on) from
609           a second file (called 'file2') to a track (called 'track1_1') from
610           the first file (called 'file1') then it has to offset all
611           timestamps for 'track2_1' by an amount. For 'file' mode this amount
612           is the highest timestamp encountered in 'file1' even if that
613           timestamp was from a different track than 'track1_1'. In track mode
614           the offset is the highest timestamp of 'track1_1'.
615
616           Unfortunately mkvmerge cannot detect which mode to use reliably.
617           Therefore it defaults to 'file' mode. 'file' mode usually works
618           better for files that have been created independently of each
619           other; e.g. when appending AVI or MP4 files. 'track' mode may work
620           better for sources that are essentially just parts of one big file,
621           e.g. for VOB and EVO files.
622
623           Subtitle tracks are always treated as if 'file' mode were active
624           even if 'track' mode actually is.
625
626       --append-to SFID1:STID1:DFID1:DTID1[,...]
627           This option controls to which track another track is appended. Each
628           spec contains four IDs: a file ID, a track ID, a second file ID and
629           a second track ID. The first pair, "source file ID" and "source
630           track ID", identifies the track that is to be appended. The second
631           pair, "destination file ID" and "destination track ID", identifies
632           the track the first one is appended to.
633
634           If this option has been omitted then a standard mapping is used.
635           This standard mapping appends each track from the current file to a
636           track from the previous file with the same track ID. This allows
637           for easy appending if a movie has been split into two parts and
638           both file have the same number of tracks and track IDs with the
639           command mkvmerge -o output.mkv part1.mkv +part2.mkv.
640
641       +
642           A single '+' causes the next file to be appended instead of added.
643           The '+' can also be put in front of the next file name. Therefore
644           the following two commands are equivalent:
645
646               $ mkvmerge -o full.mkv file1.mkv + file2.mkv
647               $ mkvmerge -o full.mkv file1.mkv +file2.mkv
648
649       [ file1 file2 ]
650           If multiple file names are contained in a pair of square brackets
651           then the second and all following files will be appended to the
652           first file named within the brackets.
653
654           This is an alternative syntax to using '+' between the file names.
655           Therefore the following two commands are equivalent:
656
657               $ mkvmerge -o full.mkv file1.mkv + file2.mkv
658               $ mkvmerge -o full.mkv '[' file1.mkv file2.mkv ']'
659
660       =
661           For certain file types (MPEG program streams = VOBs) mkvmerge(1)
662           normally looks for files in the same directory as an input file
663           that have the same base name and only differ in their running
664           number (e.g. 'VTS_01_1.VOB', 'VTS_01_2.VOB', 'VTS_01_3.VOB' etc)
665           and treats all of those files as if they were concatenated into a
666           single big file. This option, a single '=', causes mkvmerge not to
667           look for those additional files.
668
669           The '=' can also be put in front of the next file name. Therefore
670           the following two commands are equivalent:
671
672               $ mkvmerge -o full.mkv = file1.vob
673               $ mkvmerge -o full.mkv =file1.vob
674
675       ( file1 file2 )
676           If multiple file names are contained in a pair of parenthesis then
677           those files will be treated as if they were concatenated into a
678           single big file consisting of the content of each of the files one
679           after the other.
680
681           This can be used for e.g. VOB files coming from a DVD or MPEG
682           transport streams. It cannot be used if each file contains its own
683           set of headers which is usually the case with stand-alone files
684           like AVI or MP4.
685
686           Putting a file name into parenthesis also prevents mkvmerge(1) from
687           looking for additional files with the same base name as described
688           in option =. Therefore these two command lines are equivalent:
689
690               $ mkvmerge -o out.mkv = file.mkv
691               $ mkvmerge -o out.mkv '(' file.mkv ')'
692
693           Several things should be noted:
694
695            1. There must be spaces both after the opening and before the
696               closing parenthesis.
697
698            2. Every parameter between parenthesis is interpreted as a file
699               name. Therefore all options applying to this logical file must
700               be listed before the opening parenthesis.
701
702            3. Some shells treat parenthesis as special characters. Hence you
703               must escape or quote them as shown in the example above.
704
705   Attachment support (more global options)
706       --attachment-description description
707           Plain text description of the following attachment. Applies to the
708           next --attach-file or --attach-file-once option.
709
710       --attachment-mime-type MIME type
711           MIME type of the following attachment. Applies to the next
712           --attach-file or --attach-file-once option. A list of officially
713           recognized MIME types can be found e.g. at the IANA homepage[2].
714           The MIME type is mandatory for an attachment.
715
716           If no MIME type is given a for an attachment, its type will be
717           detected automatically.
718
719       --attachment-name name
720           Sets the name that will be stored in the output file for this
721           attachment. If this option is not given then the name will be
722           derived from the file name of the attachment as given with the
723           --attach-file or the --attach-file-once option.
724
725       --attach-file file-name, --attach-file-once file-name
726           Creates a file attachment inside the Matroska(TM) file. The MIME
727           type must have been set before this option can used. The difference
728           between the two forms is that during splitting the files attached
729           with --attach-file are attached to all output files while the ones
730           attached with --attach-file-once are only attached to the first
731           file created. If splitting is not used then both do the same.
732
733           mkvextract(1) can be used to extract attached files from a
734           Matroska(TM) file.
735
736       --enable-legacy-font-mime-types
737           Enables the use of legacy MIME types for certain types of font
738           attachments. For example, 'application/x-truetype-font' will be
739           used for TrueType fonts instead of 'fonts/ttf'.
740
741           This affects both new attachments if its MIME type is detected
742           automatically and existing attachments whose stored MIME types will
743           be remapped to the legacy ones.
744
745           The affected MIME types are 'font/sfnt', 'font/ttf' and
746           'font/collection' which are all mapped to
747           'application/x-truetype-fonts' and 'font/otf' which is mapped to
748           'application/vnd.ms-opentype'.
749
750   Options that can be used for each input file
751       -a, --audio-tracks [!]n,m,...
752           Copy the audio tracks n, m etc. The numbers are track IDs which can
753           be obtained with the --identify switch. They're not simply the
754           track numbers (see section track IDs). Default: copy all audio
755           tracks.
756
757           Instead of track IDs you can also provide ISO 639-2 language codes.
758           This will only work for source files that provide language tags for
759           their tracks.
760
761           Default: copy all tracks of this kind.
762
763           If the IDs are prefixed with !  then the meaning is reversed: copy
764           all tracks of this kind but the ones listed after the !.
765
766       -d, --video-tracks [!]n,m,...
767           Copy the video tracks n, m etc. The numbers are track IDs which can
768           be obtained with the --identify switch. They're not simply the
769           track numbers (see section track IDs). Default: copy all video
770           tracks.
771
772           Instead of track IDs you can also provide ISO 639-2 language codes.
773           This will only work for source files that provide language tags for
774           their tracks.
775
776           If the IDs are prefixed with !  then the meaning is reversed: copy
777           all tracks of this kind but the ones listed after the !.
778
779       -s, --subtitle-tracks [!]n,m,...
780           Copy the subtitle tracks n, m etc. The numbers are track IDs which
781           can be obtained with the --identify switch. They're not simply the
782           track numbers (see section track IDs). Default: copy all subtitle
783           tracks.
784
785           Instead of track IDs you can also provide ISO 639-2 language codes.
786           This will only work for source files that provide language tags for
787           their tracks.
788
789           If the IDs are prefixed with !  then the meaning is reversed: copy
790           all tracks of this kind but the ones listed after the !.
791
792       -b, --button-tracks [!]n,m,...
793           Copy the button tracks n, m etc. The numbers are track IDs which
794           can be obtained with the --identify switch. They're not simply the
795           track numbers (see section track IDs). Default: copy all button
796           tracks.
797
798           Instead of track IDs you can also provide ISO 639-2 language codes.
799           This will only work for source files that provide language tags for
800           their tracks.
801
802           If the IDs are prefixed with !  then the meaning is reversed: copy
803           all tracks of this kind but the ones listed after the !.
804
805       --track-tags [!]n,m,...
806           Copy the tags for tracks n, m etc. The numbers are track IDs which
807           can be obtained with the --identify switch (see section track IDs).
808           They're not simply the track numbers. Default: copy tags for all
809           tracks.
810
811           If the IDs are prefixed with !  then the meaning is reversed: copy
812           everything but the IDs listed after the !.
813
814       -m, --attachments [!]n[:all|first],m[:all|first],...
815           Copy the attachments with the IDs n, m etc to all or only the first
816           output file. Each ID can be followed by either ':all' (which is the
817           default if neither is entered) or ':first'. If splitting is active
818           then those attachments whose IDs are specified with ':all' are
819           copied to all of the resulting output files while the others are
820           only copied into the first output file. If splitting is not active
821           then both variants have the same effect.
822
823           The default is to copy all attachments to all output files.
824
825           If the IDs are prefixed with !  then the meaning is reversed: copy
826           everything but the IDs listed after the !.
827
828       -A, --no-audio
829           Don't copy any audio track from this file.
830
831       -D, --no-video
832           Don't copy any video track from this file.
833
834       -S, --no-subtitles
835           Don't copy any subtitle track from this file.
836
837       -B, --no-buttons
838           Don't copy any button track from this file.
839
840       -T, --no-track-tags
841           Don't copy any track specific tags from this file.
842
843       --no-chapters
844           Don't copy chapters from this file.
845
846       -M, --no-attachments
847           Don't copy attachments from this file.
848
849       --no-global-tags
850           Don't copy global tags from this file.
851
852       -y, --sync TID:d[,o[/p]]
853           Adjust the timestamps of the track with the id TID by d ms. The
854           track IDs are the same as the ones given with --identify (see
855           section track IDs).
856
857           o/p: adjust the timestamps by o/p to fix linear drifts.  p defaults
858           to 1 if omitted. Both o and p can be floating point numbers.
859
860           Defaults: no manual sync correction (which is the same as d = 0 and
861           o/p = 1.0).
862
863           This option can be used multiple times for an input file applying
864           to several tracks by selecting different track IDs each time.
865
866       --cues TID:none|iframes|all
867           Controls for which tracks cue (index) entries are created for the
868           given track (see section track IDs). 'none' inhibits the creation
869           of cue entries. For 'iframes' only blocks with no backward or
870           forward references ( = I frames in video tracks) are put into the
871           cue sheet. 'all' causes mkvmerge(1) to create cue entries for all
872           blocks which will make the file very big.
873
874           The default is 'iframes' for video and subtitle tracks and 'none'
875           for audio tracks. See also option --no-cues which inhibits the
876           creation of cue entries regardless of the --cues options used.
877
878           This option can be used multiple times for an input file applying
879           to several tracks by selecting different track IDs each time.
880
881       --default-track-flag TID[:bool]
882           Sets the "default track" flag for the given track (see section
883           track IDs) if the optional argument bool is set to 1 or if it isn't
884           present. The flag will be set if the source container doesn't
885           provide that information and the user doesn't specify it via this
886           option.
887
888           If the user does not explicitly select a track during playback, the
889           player should select one of the tracks that has its "default track"
890           flag set, taking user preferences such as their preferred language
891           into account.
892
893           This option can be used multiple times for an input file applying
894           to several tracks by selecting different track IDs each time.
895
896       --track-enabled-flag TID[:bool]
897           Sets the "track enabled" flag for the given track (see section
898           track IDs) to the given value bool (0 or 1; defaults to 1 if not
899           specified). Tracks are enabled by default if no option is specified
900           for them and the source container doesn't provide this information
901           either.
902
903           Only tracks whose "track enabled" flag is set should be considered
904           for playback.
905
906           This option can be used multiple times for an input file applying
907           to several tracks by selecting different track IDs each time.
908
909       --forced-display-flag TID[:bool]
910           Sets the "forced display" flag for the given track (see section
911           track IDs) if the optional argument bool is set to 1 or if it isn't
912           present. Use this for tracks containing onscreen text or
913           foreign-language dialogue.
914
915           This option can be used multiple times for an input file applying
916           to several tracks by selecting different track IDs each time.
917
918       --hearing-impaired-flag TID[:bool]
919           Sets the "hearing impaired" flag for the given track (see section
920           track IDs) if the optional argument bool is set to 1 or if it isn't
921           present. This flag can be set if the track is suitable for users
922           with hearing impairments.
923
924           This option can be used multiple times for an input file applying
925           to several tracks by selecting different track IDs each time.
926
927       --visual-impaired-flag TID[:bool]
928           Sets the "visual impaired" flag for the given track (see section
929           track IDs) if the optional argument bool is set to 1 or if it isn't
930           present. This flag can be set if the track is suitable for users
931           with visual impairments.
932
933           This option can be used multiple times for an input file applying
934           to several tracks by selecting different track IDs each time.
935
936       --text-descriptions-flag TID[:bool]
937           Sets the "text descriptions" flag for the given track (see section
938           track IDs) if the optional argument bool is set to 1 or if it isn't
939           present. This flag can be set if the track contains textual
940           descriptions of video content suitable for playback via a
941           text-to-speech system for a visually-impaired user.
942
943           This option can be used multiple times for an input file applying
944           to several tracks by selecting different track IDs each time.
945
946       --original-flag TID[:bool]
947           Sets the "original language" flag for the given track (see section
948           track IDs) if the optional argument bool is set to 1 or if it isn't
949           present. This flag can be set if the track is in the content's
950           original language (not a translation).
951
952           This option can be used multiple times for an input file applying
953           to several tracks by selecting different track IDs each time.
954
955       --commentary-flag TID[:bool]
956           Sets the "commentary" flag for the given track (see section track
957           IDs) if the optional argument bool is set to 1 or if it isn't
958           present. This flag can be set if the track contains commentary.
959
960           This option can be used multiple times for an input file applying
961           to several tracks by selecting different track IDs each time.
962
963       --track-name TID:name
964           Sets the track name for the given track (see section track IDs) to
965           name.
966
967       --language TID:language
968           Sets the language for the given track (see section track IDs). Both
969           ISO 639-2 language codes and ISO 639-1 country codes are allowed.
970           The country codes will be converted to language codes
971           automatically. All languages including their ISO 639-2 codes can be
972           listed with the --list-languages option.
973
974           This option can be used multiple times for an input file applying
975           to several tracks by selecting different track IDs each time.
976
977       -t, --tags TID:file-name
978           Read tags for the track with the number TID from the file
979           file-name. See the section about tags below for details.
980
981       --aac-is-sbr TID[:0|1]
982           Tells mkvmerge(1) that the track with the ID TID is SBR AAC (also
983           known as HE-AAC or AAC+). This options is needed if a) the source
984           file is an AAC file (not for a Matroska(TM) file) and b) the AAC
985           file contains SBR AAC data. The reason for this switch is that it
986           is technically impossible to automatically tell normal AAC data
987           from SBR AAC data without decoding a complete AAC frame. As there
988           are several patent issues with AAC decoders mkvmerge(1) will never
989           contain this decoding stage. So for SBR AAC files this switch is
990           mandatory. The resulting file might not play back correctly or even
991           not at all if the switch was omitted.
992
993           If the source file is a Matroska(TM) file then the CodecID should
994           be enough to detect SBR AAC. However, if the CodecID is wrong then
995           this switch can be used to correct that.
996
997           If mkvmerge wrongfully detects that an AAC file is SBR then you can
998           add ':0' to the track ID.
999
1000       --audio-emphasis TID:n|symbolic-name
1001           Sets the emphasis for the audio track with the track ID TID. The
1002           mode can either be a number n (certain values between 0 and 16) or
1003           a symbolic name. All valid numbers & symbolic names can be listed
1004           with the --list-audio-emphasis option.
1005
1006       --reduce-to-core TID
1007           Some audio codecs have a lossy core and optional extensions that
1008           implement lossless decoding. This option tells mkvmerge(1) to only
1009           copy the core but not the extensions. By default mkvmerge(1) copies
1010           both the core and the extensions.
1011
1012           Currently only DTS tracks are affected by this option. TrueHD
1013           tracks that contain an embedded AC-3 core are instead presented as
1014           two separate tracks for which the user can select which track to
1015           copy. For DTS such a scheme would not work as the HD extensions
1016           cannot be decoded by themselves – unlike the TrueHD data.
1017
1018       --remove-dialog-normalization-gain TID
1019           Some audio codecs contain header fields that tell the decoder or
1020           player to apply a (usually negative) gain for dialog normalization.
1021           This option tells mkvmerge(1) to remove or minimize that gain by
1022           modifying the corresponding header fields.
1023
1024           Currently only AC-3, DTS and TrueHD tracks are affected by this
1025           option.
1026
1027       --timestamps TID:file-name
1028           Read the timestamps to be used for the specific track ID from
1029           file-name. These timestamps forcefully override the timestamps that
1030           mkvmerge(1) normally calculates. Read the section about external
1031           timestamp files.
1032
1033       --default-duration TID:x
1034           Forces the default duration of a given track to the specified
1035           value. Also modifies the track's timestamps to match the default
1036           duration. The argument x must be postfixed with 's', 'ms', 'us',
1037           'ns', 'fps', 'p' or 'i' to specify the default duration in seconds,
1038           milliseconds, microseconds, nanoseconds, 'frames per second',
1039           'progressive frames per second' or 'interlaced frames per second'
1040           respectively. The number x itself can be a floating point number or
1041           a fraction.
1042
1043           If the default duration is not forced then mkvmerge will try to
1044           derive the track's default duration from the container and/or the
1045           encoded bitstream for certain track types, e.g. AVC/H.264 or
1046           MPEG-2.
1047
1048           This option can also be used to change the FPS of video tracks
1049           without having to use an external timestamp file.
1050
1051       --fix-bitstream-timing-information TID[:0|1]
1052           Normally mkvmerge(1) does not change the timing information
1053           (frame/field rate) stored in the video bitstream. With this option
1054           that information is adjusted to match the container timing
1055           information. The container timing information can come from various
1056           sources: from the command line (see option --default-duration), the
1057           source container or derived from the bitstream.
1058
1059               Note
1060               This has only been implemented for AVC/H.264 video tracks so
1061               far.
1062
1063       --compression TID:n
1064           Selects the compression method to be used for the track. Note that
1065           the player also has to support this method. Valid values are
1066           'none', 'zlib' and 'mpeg4_p2'/'mpeg4p2'.
1067
1068           The compression method 'mpeg4_p2'/'mpeg4p2' is a special
1069           compression method called 'header removal' that is only available
1070           for MPEG4 part 2 video tracks.
1071
1072           The default for some subtitle types is 'zlib' compression. This
1073           compression method is also the one that most if not all playback
1074           applications support. Support for other compression methods other
1075           than 'none' is not assured.
1076
1077   Options that only apply to video tracks
1078       -f, --fourcc TID:FourCC
1079           Forces the FourCC to the specified value. Works only for video
1080           tracks in the 'MS compatibility mode'.
1081
1082       --display-dimensions TID:widthxheight
1083           Matroska(TM) files contain two values that set the display
1084           properties that a player should scale the image on playback to:
1085           display width and display height. These values can be set with this
1086           option, e.g. '1:640x480'.
1087
1088           Another way to specify the values is to use the --aspect-ratio or
1089           the --aspect-ratio-factor option (see below). These options are
1090           mutually exclusive.
1091
1092       --aspect-ratio TID:ratio|width/height
1093           Matroska(TM) files contain two values that set the display
1094           properties that a player should scale the image on playback to:
1095           display width and display height. With this option mkvmerge(1) will
1096           automatically calculate the display width and display height based
1097           on the image's original width and height and the aspect ratio given
1098           with this option. The ratio can be given either as a floating point
1099           number ratio or as a fraction 'width/height', e.g. '16/9'.
1100
1101           Another way to specify the values is to use the
1102           --aspect-ratio-factor or --display-dimensions options (see above
1103           and below). These options are mutually exclusive.
1104
1105       --aspect-ratio-factor TID:factor|n/d
1106           Another way to set the aspect ratio is to specify a factor. The
1107           original aspect ratio is first multiplied with this factor and used
1108           as the target aspect ratio afterwards.
1109
1110           Another way to specify the values is to use the --aspect-ratio or
1111           --display-dimensions options (see above). These options are
1112           mutually exclusive.
1113
1114       --cropping TID:left,top,right,bottom
1115           Sets the pixel cropping parameters of a video track to the given
1116           values.
1117
1118       --color-matrix-coefficients TID:n
1119           Sets the matrix coefficients of the video used to derive luma and
1120           chroma values from red, green and blue color primaries. The
1121           parameter n is an integer rangeing from 0 and 10.
1122
1123           Valid values and their meaning are:
1124
1125           0: GBR, 1: BT709, 2: unspecified, 3: reserved, 4: FCC, 5: BT470BG,
1126           6: SMPTE 170M, 7: SMPTE 240M, 8: YCOCG, 9: BT2020 non-constant
1127           luminance, 10: BT2020 constant luminance
1128
1129       --color-bits-per-channel TID:n
1130           Sets the number of coded bits for a color channel. A value of 0
1131           indicates that the number of bits is unspecified.
1132
1133       --chroma-subsample TID:hori,vert
1134           The amount of pixels to remove in the Cr and Cb channels for every
1135           pixel not removed horizontally/vertically.
1136
1137           Example: For video with 4:2:0 chroma subsampling, the parameter
1138           should be set to TID:1,1.
1139
1140       --cb-subsample TID:hori,vert
1141           The amount of pixels to remove in the Cb channel for every pixel
1142           not removed horizontally/vertically. This is additive with
1143           --chroma-subsample.
1144
1145           Example: For video with 4:2:1 chroma subsampling, the parameter
1146           --chroma-subsample should be set to TID:1,0 and Cb-subsample should
1147           be set to TID:1,0.
1148
1149       --chroma-siting TID:hori,vert
1150           Sets how chroma is sited horizontally/vertically (0: unspecified,
1151           1: top collocated, 2: half).
1152
1153       --color-range TID:n
1154           Sets the clipping of the color ranges (0: unspecified, 1: broadcast
1155           range, 2: full range (no clipping), 3: defined by
1156           MatrixCoefficients/TransferCharacteristics).
1157
1158       --color-transfer-characteristics TID:n
1159           The transfer characteristics of the video.
1160
1161           Valid values and their meaning are:
1162
1163           0: reserved, 1: ITU-R BT.709, 2: unspecified, 3: reserved, 4: gamma
1164           2.2 curve, 5: gamma 2.8 curve, 6: SMPTE 170M, 7: SMPTE 240M, 8:
1165           linear, 9: log, 10: log sqrt, 11: IEC 61966-2-4, 12: ITU-R BT.1361
1166           extended color gamut, 13: IEC 61966-2-1, 14: ITU-R BT.2020 10 bit,
1167           15: ITU-R BT.2020 12 bit, 16: SMPTE ST 2084, 17: SMPTE ST 428-1;
1168           18: ARIB STD-B67 (HLG)
1169
1170       --color-primaries TID:n
1171           Sets the color primaries of the video.
1172
1173           Valid values and their meaning are:
1174
1175           0: reserved, 1: ITU-R BT.709, 2: unspecified, 3: reserved, 4: ITU-R
1176           BT.470M, 5: ITU-R BT.470BG, 6: SMPTE 170M, 7: SMPTE 240M, 8: FILM,
1177           9: ITU-R BT.2020, 10: SMPTE ST 428-1, 22: JEDEC P22 phosphors
1178
1179       --max-content-light TID:n
1180           Sets the maximum brightness of a single pixel (Maximum Content
1181           Light Level) in candelas per square meter (cd/m²). The value of n
1182           should be a non-negtive integer.
1183
1184       --max-frame-light TID:n
1185           Sets the maximum brightness of a single full frame (Maximum
1186           Frame-Average Light Level) in candelas per square meter (cd/m²).
1187           The value of n should be a non-negtive integer.
1188
1189       --chromaticity-coordinates
1190       TID:red-x,red-y,green-x,green-y,blue-x,blue-y
1191           Sets the red/green/blue chromaticity coordinates as defined by CIE
1192           1931.
1193
1194       --white-color-coordinates TID:x,y
1195           Sets the white color chromaticity coordinates as defined by CIE
1196           1931.
1197
1198       --max-luminance TID:float
1199           Sets the maximum luminance in candelas per square meter (cd/m²).
1200           The value should be less than 9999.99.
1201
1202       --min-luminance TID:float
1203           Sets the minimum luminance in candelas per square meter (cd/m²).
1204           The value should be less than 999.9999.
1205
1206       --projection-type TID:method
1207           Sets the video projection method used. Valid values are 0
1208           (rectangular projection), 1 (equirectangular projection), 2
1209           (cubemap projection) and 3 (mesh projection).
1210
1211       --projection-private TID:data
1212           Sets private data that only applies to a specific projection. Data
1213           must be given as hex numbers with or without the "0x" prefix, with
1214           or without spaces.
1215
1216       --projection-pose-yaw TID:float
1217           Specifies a yaw rotation to the projection.
1218
1219       --projection-pose-pitch TID:float
1220           Specifies a pitch rotation to the projection.
1221
1222       --projection-pose-roll TID:float
1223           Specifies a roll rotation to the projection.
1224
1225       --field-order TID:n
1226           Sets the field order for the video track with the track ID TID. The
1227           order must be one of the following numbers:
1228
1229           0: progressive; 1: interlaced with top field displayed first and
1230           top field stored first; 2: undetermined field order; 6: interlaced
1231           with bottom field displayed first and bottom field stored first; 9:
1232           interlaced with bottom field displayed first and top field stored
1233           first; 14: interlaced with top field displayed first and bottom
1234           field stored first
1235
1236       --stereo-mode TID:n|symbolic-name
1237           Sets the stereo mode for the video track with the track ID TID. The
1238           mode can either be a number n between 0 and 14 or a symbolic name.
1239           All valid numbers & names can be listed with the
1240           --list-stereo-modes option.
1241
1242   Options that only apply to text subtitle tracks
1243       --sub-charset TID:character-set
1244           Sets the character set for the conversion to UTF-8 for UTF-8
1245           subtitles for the given track ID. If not specified the charset will
1246           be derived from the current locale settings. Note that a charset is
1247           not needed for subtitles read from Matroska(TM) files or from Kate
1248           streams, as these are always stored in UTF-8. See the section about
1249           text files and character sets for an explanation how mkvmerge(1)
1250           converts between character sets.
1251
1252           This option can be used multiple times for an input file applying
1253           to several tracks by selecting different track IDs each time.
1254
1255   Other options
1256       -i, --identify file-name
1257           Will let mkvmerge(1) probe the single file and report its type, the
1258           tracks contained in the file and their track IDs. If this option is
1259           used then the only other option allowed is the filename.
1260
1261           The output format used for the result can be changed with the
1262           option --identification-format.
1263
1264       -J file-name
1265           This is a convenient alias for "--identification-format json
1266           --identify file-name".
1267
1268       -F, --identification-format format
1269           Determines the output format used by the --identify option. The
1270           following formats are supported: text (the default if this option
1271           isn't used) and json.
1272
1273            1. The text format is short and human-readable. It consists of one
1274               line per item found (container, tracks, attachments etc.).
1275
1276               This format is not meant to be parsed. The output will be
1277               translated into the language mkvmerge(1) uses (see also
1278               --ui-language).
1279
1280            2. The json format outputs a machine-readable JSON representation.
1281               This format follows the JSON schema described in the following
1282               file:
1283
1284               mkvmerge-identification-output-schema-v18.json[3]
1285
1286               All versions of the JSON schema are available both online and
1287               in the released source code archives.
1288
1289       --probe-range-percentage percentage
1290           File types such as MPEG program and transport streams (.vob, .m2ts)
1291           require parsing a certain amount of data in order to detect all
1292           tracks contained in the file. This amount is 0.3% of the source
1293           file's size or 10 MB, whichever is higher.
1294
1295           If tracks are known to be present but not found then the percentage
1296           to probe can be changed with this option. The minimum of 10 MB is
1297           built-in and cannot be changed.
1298
1299       --list-audio-emphasis
1300           Lists all valid numbers & their corresponding symbolic names for
1301           the --audio-emphasis option.
1302
1303       --list-languages
1304           Lists all languages and their ISO 639-2 code which can be used with
1305           the --language option.
1306
1307       --list-stereo-modes
1308           Lists all valid numbers & their corresponding symbolic names for
1309           the --stereo-mode option.
1310
1311       -l, --list-types
1312           Lists supported input file types.
1313
1314       --priority priority
1315           Sets the process priority that mkvmerge(1) runs with. Valid values
1316           are 'lowest', 'lower', 'normal', 'higher' and 'highest'. If nothing
1317           is given then 'normal' is used. On Unix like systems mkvmerge(1)
1318           will use the nice(2) function. Therefore only the super user can
1319           use 'higher' and 'highest'. On Windows all values are useable for
1320           every user.
1321
1322           Selecting 'lowest' also causes mkvmerge(1) to select idle I/O
1323           priority in addition to the lowest possible process priority.
1324
1325       --command-line-charset character-set
1326           Sets the character set to convert strings given on the command line
1327           from. It defaults to the character set given by system's current
1328           locale. This settings applies to arguments of the following
1329           options: --title, --track-name and --attachment-description.
1330
1331       --output-charset character-set
1332           Sets the character set to which strings are converted that are to
1333           be output. It defaults to the character set given by system's
1334           current locale.
1335
1336       -r, --redirect-output file-name
1337           Writes all messages to the file file-name instead of to the
1338           console. While this can be done easily with output redirection
1339           there are cases in which this option is needed: when the terminal
1340           reinterprets the output before writing it to a file. The character
1341           set set with --output-charset is honored.
1342
1343       --flush-on-close
1344           Tells the program to flush all data cached in memory to storage
1345           when closing files opened for writing. This can be used to prevent
1346           data loss on power outages or to circumvent certain problems in the
1347           operating system or drivers. The downside is that multiplexing will
1348           take longer as mkvmerge will wait until all data has been written
1349           to the storage before exiting. See issues #2469 and #2480 on the
1350           MKVToolNix bug tracker for in-depth discussions on the pros and
1351           cons.
1352
1353       --ui-language code
1354           Forces the translations for the language code to be used (e.g.
1355           'de_DE' for the German translations). Entering 'list' as the code
1356           will cause the program to output a list of available translations.
1357
1358       --abort-on-warnings
1359           Tells the program to abort after the first warning is emitted. The
1360           program's exit code will be 1.
1361
1362       --deterministic seed
1363           Enables the creation of byte-identical files if the same version of
1364           mkvmerge(1) is used with the same source files, the same set of
1365           options and the same seed. Note that the "date" segment information
1366           field is not written in this mode.
1367
1368           The seed can be an arbitrary string and does not have to be a
1369           number.
1370
1371           The result of byte-identical files is only guaranteed under the
1372           following conditions:
1373
1374            1. The same version of mkvmerge(1) built with the same versions of
1375               libEBML and libMatroska is used.
1376
1377            2. The source files used are byte-identical.
1378
1379            3. The same command line options are used in the same order (with
1380               the notable exception of --output ...).
1381
1382           Using other versions of mkvmerge(1) or other command-line options
1383           may result in the same byte-identical file but is not guaranteed to
1384           do so.
1385
1386       --debug topic
1387           Turn on debugging for a specific feature. This option is only
1388           useful for developers.
1389
1390       --engage feature
1391           Turn on experimental features. A list of available features can be
1392           requested with mkvmerge --engage list. These features are not meant
1393           to be used in normal situations.
1394
1395       --gui-mode
1396           Turns on GUI mode. In this mode specially-formatted lines may be
1397           output that can tell a controlling GUI what's happening. These
1398           messages follow the format '#GUI#message'. The message may be
1399           followed by key/value pairs as in
1400           '#GUI#message#key1=value1#key2=value2...'. Neither the messages nor
1401           the keys are ever translated and always output in English.
1402
1403       @options-file.json
1404           Reads additional command line arguments from the file options-file.
1405           See the section about option files for further information.
1406
1407       --capabilities
1408           Lists information about optional features that have been compiled
1409           in and exit. The first line output will be the version information.
1410           All following lines contain exactly one word whose presence
1411           indicates that the feature has been compiled in. These features
1412           are:
1413
1414           •   'FLAC' -- reading raw FLAC files and handling FLAC tracks in
1415               other containers, e.g.  Ogg(TM) or Matroska(TM).
1416
1417       -h, --help
1418           Show usage information and exit.
1419
1420       -V, --version
1421           Show version information and exit.
1422

USAGE

1424       For each file the user can select which tracks mkvmerge(1) should take.
1425       They are all put into the file specified with -o. A list of known (and
1426       supported) source formats can be obtained with the -l option.
1427
1428           Important
1429           The order of command line options is important. Please read the
1430           section "Option order" if you're new to the program.
1431

OPTION ORDER

1433       The order in which options are entered is important for some options.
1434       Options fall into two categories:
1435
1436        1. Options that affect the whole program and are not tied to any input
1437           file. These include but are not limited to --command-line-charset,
1438           --output or --title. These can appear anywhere on the command line.
1439
1440        2. Options that affect a single input file or a single track in an
1441           input file. These options all apply to the following input file on
1442           the command line. All options applying to the same input (or to
1443           tracks from the same input file) file can be written in any order
1444           as long as they all appear before that input file's name. Examples
1445           for options applying to an input file are --no-chapters or
1446           --chapter-charset. Examples for options applying to a single track
1447           are --default-duration or --language.
1448
1449       The options are processed from left to right. If an option appears
1450       multiple times within the same scope then the last occurrence will be
1451       used. Therefore the title will be set to "Something else" in the
1452       following example:
1453
1454           $ mkvmerge -o output.mkv --title 'This and that' input.avi --title 'Something else'
1455
1456       The following example shows that using the --language option twice is
1457       OK because they're used in different scopes. Even though they apply to
1458       the same track ID they apply to different input files and therefore
1459       have different scopes:
1460
1461           $ mkvmerge -o output.mkv --language 0:fre français.ogg --language 0:deu deutsch.ogg
1462

EXAMPLES

1464       Let's assume you have a file called MyMovie.avi and the audio track in
1465       a separate file, e.g. 'MyMovie.wav'. First you want to encode the audio
1466       to OggVorbis(TM):
1467
1468           $ oggenc -q4 -oMyMovie.ogg MyMovie.wav
1469
1470       After a couple of minutes you can join video and audio:
1471
1472           $ mkvmerge -o MyMovie-with-sound.mkv MyMovie.avi MyMovie.ogg
1473
1474       If your AVI already contains an audio track then it will be copied as
1475       well (if mkvmerge(1) supports the audio format). To avoid that simply
1476       do
1477
1478           $ mkvmerge -o MyMovie-with-sound.mkv -A MyMovie.avi MyMovie.ogg
1479
1480       After some minutes of consideration you rip another audio track, e.g.
1481       the director's comments or another language to 'MyMovie-add-audio.wav'.
1482       Encode it again and join it up with the other file:
1483
1484           $ oggenc -q4 -oMyMovie-add-audio.ogg MyMovie-add-audio.wav
1485           $ mkvmerge -o MM-complete.mkv MyMovie-with-sound.mkv MyMovie-add-audio.ogg
1486
1487       The same result can be achieved with
1488
1489           $ mkvmerge -o MM-complete.mkv -A MyMovie.avi MyMovie.ogg MyMovie-add-audio.ogg
1490
1491       Now fire up mplayer(TM) and enjoy. If you have multiple audio tracks
1492       (or even video tracks) then you can tell mplayer(TM) which track to
1493       play with the '-vid' and '-aid' options. These are 0-based and do not
1494       distinguish between video and audio.
1495
1496       If you need an audio track synchronized you can do that easily. First
1497       find out which track ID the Vorbis track has with
1498
1499           $ mkvmerge --identify outofsync.ogg
1500
1501       Now you can use that ID in the following command line:
1502
1503           $ mkvmerge -o goodsync.mkv -A source.avi -y 12345:200 outofsync.ogg
1504
1505       This would add 200ms of silence at the beginning of the audio track
1506       with the ID 12345 taken from 'outofsync.ogg'.
1507
1508       Some movies start synced correctly but slowly drift out of sync. For
1509       these kind of movies you can specify a delay factor that is applied to
1510       all timestamps -- no data is added or removed. So if you make that
1511       factor too big or too small you'll get bad results. An example is that
1512       an episode I transcoded was 0.2 seconds out of sync at the end of the
1513       movie which was 77340 frames long. At 29.97fps 0.2 seconds correspond
1514       to approx.  6 frames. So I did
1515
1516           $ mkvmerge -o goodsync.mkv -y 23456:0,77346/77340 outofsync.mkv
1517
1518       The result was fine.
1519
1520       The sync options can also be used for subtitles in the same manner.
1521
1522       For text subtitles you can either use some Windows software (like
1523       SubRipper(TM)) or the subrip(TM) package found in transcode(1)'s
1524       sources in the 'contrib/subrip' directory. The general process is:
1525
1526        1. extract a raw subtitle stream from the source:
1527
1528               $ tccat -i /path/to/copied/dvd/ -T 1 -L | tcextract -x ps1 -t vob -a 0x20 | subtitle2pgm -o mymovie
1529
1530        2. convert the resulting PGM images to text with gocr:
1531
1532               $ pgm2txt mymovie
1533
1534        3. spell-check the resulting text files:
1535
1536               $ ispell -d american *txt
1537
1538        4. convert the text files to a SRT file:
1539
1540               $ srttool -s -w -i mymovie.srtx -o mymovie.srt
1541
1542       The resulting file can be used as another input file for mkvmerge(1):
1543
1544           $ mkvmerge -o mymovie.mkv mymovie.avi mymovie.srt
1545
1546       If you want to specify the language for a given track then this is
1547       easily done. First find out the ISO 639-2 code for your language.
1548       mkvmerge(1) can list all of those codes for you:
1549
1550           $ mkvmerge --list-languages
1551
1552       Search the list for the languages you need. Let's assume you have put
1553       two audio tracks into a Matroska(TM) file and want to set their
1554       language codes and that their track IDs are 2 and 3. This can be done
1555       with
1556
1557           $ mkvmerge -o with-lang-codes.mkv --language 2:ger --language 3:dut without-lang-codes.mkv
1558
1559       As you can see you can use the --language switch multiple times.
1560
1561       Maybe you'd also like to have the player use the Dutch language as the
1562       default language. You also have extra subtitles, e.g. in English and
1563       French, and want to have the player display the French ones by default.
1564       This can be done with
1565
1566           $ mkvmerge -o with-lang-codes.mkv --language 2:ger --language 3:dut --default-track-flag 3 without-lang-codes.mkv --language 0:eng english.srt --default-track-flag 0 --language 0:fre french.srt
1567
1568       If you do not see the language or default track flags that you've
1569       specified in mkvinfo(1)'s output then please read the section about
1570       default values.
1571
1572       Turn off the compression for an input file.
1573
1574           $ mkvmerge -o no-compression.mkv --compression -1:none MyMovie.avi --compression -1:none mymovie.srt
1575

TRACK IDS

1577   Regular track IDs
1578       Some of the options for mkvmerge(1) need a track ID to specify which
1579       track they should be applied to. Those track IDs are printed by the
1580       readers when demuxing the current input file, or if mkvmerge(1) is
1581       called with the --identify option. An example for such output:
1582
1583           $ mkvmerge -i v.mkv
1584           File 'v.mkv': container: Matroska(TM)
1585           Track ID 0: video (V_MS/VFW/FOURCC, DIV3)
1586           Track ID 1: audio (A_MPEG/L3)
1587
1588       Do not confuse the track IDs that are assigned to the tracks that are
1589       placed in the output MKV file with the track IDs of the input files.
1590       Only the input file track IDs are used for options needing these
1591       values.
1592
1593       Also note that each input file has its own set of track IDs. Therefore
1594       the track IDs for file 'file1.ext' as reported by 'mkvmerge --identify'
1595       do not change no matter how many other input files are there or in
1596       which position 'file1.ext' is used.
1597
1598       Track IDs are assigned like this:
1599
1600       •   AVI files: The video track has the ID 0. The audio tracks get IDs
1601           in ascending order starting at 1.
1602
1603       •   AAC, AC-3, MP3, SRT and WAV files: The one 'track' in that file
1604           gets the ID 0.
1605
1606       •   Most other files: The track IDs are assigned in order the tracks
1607           are found in the file starting at 0.
1608
1609       The options that use the track IDs are the ones whose description
1610       contains 'TID'. The following options use track IDs as well:
1611       --audio-tracks, --video-tracks, --subtitle-tracks, --button-tracks and
1612       --track-tags.
1613
1614   Special track IDs
1615       There are several IDs that have special meaning and do not occur in the
1616       identification output.
1617
1618       The special track ID '-1' is a wild card and applies the given switch
1619       to all tracks that are read from an input file.
1620
1621       The special track ID '-2' refers to the chapters in a source file.
1622       Currently only the --sync option uses this special ID. As an
1623       alternative to --sync -2:...  the option --chapter-sync ...  can be
1624       used.
1625

LANGUAGE HANDLING

1627       Matroska(TM) has support for two different types of language elements:
1628       the old, deprecated "Language" element containing ISO 639-2 alpha 3
1629       codes and the new "LanguageIETF" tags containing IETF BCP 47 language
1630       tags. All of mkvmerge(1)'s options that accept a language accept a BCP
1631       47 language tag.  mkvmerge(1) will derive the value for the deprecated
1632       "Language" element from the BCP 47 language tags wherever possible.
1633
1634       When identifying a file in JSON mode, existing "LanguageIETF" track
1635       header elements will be output as the language_ietf track property.
1636
1637       When writing a file mkvmerge(1) will always write the "LanguageIETF",
1638       "ChapLanguageIETF" and "TagLanguageIETF" elements (the latter two only
1639       if chapters or tags are written respectively). In addition to those
1640       elements the corresponding old elements will be written; they'll be set
1641       to the ISO 639-2 code portion of the BCP 47 language tag. For example,
1642       when the track language is set to sr-Cyrl-RS "LanguageIETF" will be set
1643       to sr-Cyrl-RS and the old "Language" element will be set to srp.
1644
1645       When reading existing files (Matroska files, XML chapter or tag files
1646       etc.) that already contain "...LanguageIETF" elements the existing
1647       elements will be kept. Otherwise "...LanguageIETF" elements will be
1648       added based on command-line options and other existing deprecated
1649       "...Language" elements.
1650
1651       The creation of the new elements can be disabled completely with the
1652       command-line option --disable-language-ietf which operates on all three
1653       new elements.
1654
1655       You can chose the normalization method applied to extended language
1656       sub-tags with the parameter --normalize-language-ietf.
1657

TEXT FILES AND CHARACTER SET CONVERSIONS

1659           Note
1660           This section applies to all programs in MKVToolNix even if it only
1661           mentions mkvmerge(1).
1662
1663   Introduction
1664       All text in a Matroska(TM) file is encoded in UTF-8. This means that
1665       mkvmerge(1) has to convert every text file it reads as well as every
1666       text given on the command line from one character set into UTF-8. In
1667       return this also means that mkvmerge(1)'s output has to be converted
1668       back to that character set from UTF-8, e.g. if a non-English
1669       translation is used with --ui-language or for text originating from a
1670       Matroska(TM) file.
1671
1672       mkvmerge(1) does this conversion automatically based on the presence of
1673       a byte order marker (short: BOM) or the system's current locale. How
1674       the character set is inferred from the locale depends on the operating
1675       system that mkvmerge(1) is run on.
1676
1677   Byte order markers (BOM)
1678       Text files that start with a BOM are already encoded in one
1679       representation of UTF.  mkvmerge(1) supports the following five modes:
1680       UTF-8, UTF-16 Little and Big Endian, UTF-32 Little and Big Endian. Text
1681       files with a BOM are automatically converted to UTF-8. Any of the
1682       parameters that would otherwise set the character set for such a file
1683       (e.g.  --sub-charset) is silently ignored.
1684
1685   Linux and Unix-like systems including macOS
1686       On Unix-like systems mkvmerge(1) uses the setlocale(3) system call
1687       which in turn uses the environment variables LANG, LC_ALL and LC_CYPE.
1688       The resulting character set is often one of UTF-8 or the ISO-8859-*
1689       family and is used for all text file operations and for encoding
1690       strings on the command line and for output to the console.
1691
1692   Windows
1693       On Windows the default character set used for converting text files is
1694       determined by a call to the GetACP() system call.
1695
1696       Reading the command line is done with the GetCommandLineW() function
1697       which already returns a Unicode string. Therefore the option
1698       --command-line-charset is ignored on Windows.
1699
1700       Output to the console consists of three scenarios:
1701
1702        1. If the output is redirected with the option --redirect-output then
1703           the default charset is UTF-8. This can be changed with
1704           --output-charset.
1705
1706        2. If the output is redirected with cmd.exe itself, e.g. with mkvinfo
1707           file.mkv > info.txt, then the charset is always UTF-8 and cannot be
1708           changed.
1709
1710        3. Otherwise (when writing directly to the console) the Windows
1711           function WriteConsoleW() is used and the option --output-charset is
1712           ignored. The console should be able to output all Unicode
1713           characters for which the corresponding language support is
1714           installed (e.g. Chinese characters might not be displayed on
1715           English Windows versions).
1716
1717   Command line options
1718       The following options exist that allow specifying the character sets:
1719
1720--sub-charset for text subtitle files and for text subtitle tracks
1721           stored in container formats for which the character set cannot be
1722           determined unambiguously (e.g. Ogg files),
1723
1724--chapter-charset for chapter text files and for chapters and file
1725           titles stored in container formats for which the character set
1726           cannot be determined unambiguously (e.g. Ogg files for chapter
1727           information, track and file titles etc; MP4 files for chapter
1728           information),
1729
1730--command-line-charset for all strings on the command line,
1731
1732--output-charset for all strings written to the console or to a
1733           file if the output has been redirected with the --redirect-output
1734           option. On non-Windows systems the default for the output charset
1735           is the system's current charset. On Windows it defaults to UTF-8
1736           both for redirecting with --redirect-output and with cmd.exe
1737           itself, e.g.  mkvinfo file.mkv > info.txt.
1738

OPTION FILES

1740       An option file is a file mkvmerge(1) can read additional command line
1741       arguments from. This can be used in order to circumvent certain
1742       limitations of the shell or the operating system when executing
1743       external programs like a limited command line length.
1744
1745       An option file contains JSON-formatted data. Its content must be a
1746       valid JSON array consisting solely of JSON strings. The file's encoding
1747       must be UTF-8. The file should not start with a byte order marker
1748       (BOM), but if one exists, it will be skipped.
1749
1750       The rules for escaping special characters inside JSON are the ones in
1751       the official JSON specification, RFC 7159[4].
1752
1753       The option file's name itself must be specified as a command line
1754       argument prefixed with a '@' character.
1755
1756       The command line 'mkvmerge -o "my file.mkv" -A "a movie.avi" sound.ogg'
1757       could be converted into the following JSON option file called e.g.
1758       'options.json':
1759
1760           [
1761             "-o",
1762             "c:\\Matroska\\my file.mkv",
1763             "--title",
1764             "#65",
1765             "-A",
1766             "a movie.avi",
1767             "sound.ogg"
1768           ]
1769
1770       The corresponding command would then be 'mkvmerge @options.json'.
1771

FILE LINKING

1773       Matroska(TM) supports file linking which simply says that a specific
1774       file is the predecessor or successor of the current file. To be
1775       precise, it's not really the files that are linked but the Matroska(TM)
1776       segments. As most files will probably only contain one Matroska(TM)
1777       segment the following explanations use the term 'file linking' although
1778       'segment linking' would be more appropriate.
1779
1780       Each segment is identified by a unique 128 bit wide segment UID. This
1781       UID is automatically generated by mkvmerge(1). The linking is done
1782       primarily via putting the segment UIDs (short: SID) of the
1783       previous/next file into the segment header information.  mkvinfo(1)
1784       prints these SIDs if it finds them.
1785
1786       If a file is split into several smaller ones and linking is used then
1787       the timestamps will not start at 0 again but will continue where the
1788       last file has left off. This way the absolute time is kept even if the
1789       previous files are not available (e.g. when streaming). If no linking
1790       is used then the timestamps should start at 0 for each file. By default
1791       mkvmerge(1) does not use file linking. If you want that you can turn it
1792       on with the --link option. This option is only useful if splitting is
1793       activated as well.
1794
1795       Regardless of whether splitting is active or not the user can tell
1796       mkvmerge(1) to link the produced files to specific SIDs. This is
1797       achieved with the options --link-to-previous and --link-to-next. These
1798       options accept a segment SID in the format that mkvinfo(1) outputs: 16
1799       hexadecimal numbers between 0x00 and 0xff prefixed with '0x' each, e.g.
1800       '0x41 0xda 0x73 0x66 0xd9 0xcf 0xb2 0x1e 0xae 0x78 0xeb 0xb4 0x5e 0xca
1801       0xb3 0x93'. Alternatively a shorter form can be used: 16 hexadecimal
1802       numbers between 0x00 and 0xff without the '0x' prefixes and without the
1803       spaces, e.g. '41da7366d9cfb21eae78ebb45ecab393'.
1804
1805       If splitting is used then the first file is linked to the SID given
1806       with --link-to-previous and the last file is linked to the SID given
1807       with --link-to-next. If splitting is not used then the one output file
1808       will be linked to both of the two SIDs.
1809

DEFAULT VALUES

1811       The Matroska(TM) specification states that some elements have a default
1812       value. Usually an element is not written to the file if its value is
1813       equal to its default value in order to save space. The elements that
1814       the user might miss in mkvinfo(1)'s output are the language and the
1815       default track flag elements. The default value for the language is
1816       English ('eng'), and the default value for the default track flag is
1817       true. Therefore if you used --language 0:eng for a track then it will
1818       not show up in mkvinfo(1)'s output.
1819

ATTACHMENTS

1821       Maybe you also want to keep some photos along with your Matroska(TM)
1822       file, or you're using SSA subtitles and need a special TrueType(TM)
1823       font that's really rare. In these cases you can attach those files to
1824       the Matroska(TM) file. They will not be just appended to the file but
1825       embedded in it. A player can then show those files (the 'photos' case)
1826       or use them to render the subtitles (the 'TrueType(TM) fonts' case).
1827
1828       Here's an example how to attach a photo and a TrueType(TM) font to the
1829       output file:
1830
1831           $ mkvmerge -o output.mkv -A video.avi sound.ogg \
1832             --attachment-description "Me and the band behind the stage in a small get-together" \
1833             --attachment-mime-type image/jpeg \
1834             --attach-file me_and_the_band.jpg \
1835             --attachment-description "The real rare and unbelievably good looking font" \
1836             --attachment-mime-type application/octet-stream \
1837             --attach-file really_cool_font.ttf
1838
1839       If a Matroska(TM) containing attachments file is used as an input file
1840       then mkvmerge(1) will copy the attachments into the new file. The
1841       selection which attachments are copied and which are not can be changed
1842       with the options --attachments and --no-attachments.
1843

CHAPTERS

1845       The Matroska(TM) chapter system is more powerful than the old known
1846       system used by OGM files. The full specifications can be found at the
1847       Matroska(TM) website[1].
1848
1849       mkvmerge(1) supports two kinds of chapter files as its input. The first
1850       format, called 'simple chapter format', is the same format that the OGM
1851       tools expect. The second format is a XML based chapter format which
1852       supports all of Matroska(TM)'s chapter functionality.
1853
1854       Apart from dedicated chapter files mkvmerge(1) can also read chapters
1855       from other file formats (e.g. MP4, Ogg, Blu-rays or DVDs).
1856
1857   The simple chapter format
1858       This format consists of pairs of lines that start with 'CHAPTERxx=' and
1859       'CHAPTERxxNAME=' respectively. The first one contains the start
1860       timestamp while the second one contains the title. Here's an example:
1861
1862           CHAPTER01=00:00:00.000
1863           CHAPTER01NAME=Intro
1864           CHAPTER02=00:02:30.000
1865           CHAPTER02NAME=Baby prepares to rock
1866           CHAPTER03=00:02:42.300
1867           CHAPTER03NAME=Baby rocks the house
1868
1869       mkvmerge(1) will transform every pair or lines into one Matroska(TM)
1870       ChapterAtom. It does not set any ChapterTrackNumber which means that
1871       all chapters apply to all tracks in the file.
1872
1873       As this is a text file character set conversion may need to be done.
1874       See the section about text files and character sets for an explanation
1875       how mkvmerge(1) converts between character sets.
1876
1877   The XML based chapter format
1878       The XML based chapter format looks like this example:
1879
1880           <?xml version="1.0" encoding="ISO-8859-1"?>
1881           <!DOCTYPE Chapters SYSTEM "matroskachapters.dtd">
1882           <Chapters>
1883             <EditionEntry>
1884               <ChapterAtom>
1885                 <ChapterTimeStart>00:00:30.000</ChapterTimeStart>
1886                 <ChapterTimeEnd>00:01:20.000</ChapterTimeEnd>
1887                 <ChapterDisplay>
1888                   <ChapterString>A short chapter</ChapterString>
1889                   <ChapterLanguage>eng</ChapterLanguage>
1890                 </ChapterDisplay>
1891                 <ChapterAtom>
1892                   <ChapterTimeStart>00:00:46.000</ChapterTimeStart>
1893                   <ChapterTimeEnd>00:01:10.000</ChapterTimeEnd>
1894                   <ChapterDisplay>
1895                     <ChapterString>A part of that short chapter</ChapterString>
1896                     <ChapterLanguage>eng</ChapterLanguage>
1897                   </ChapterDisplay>
1898                 </ChapterAtom>
1899               </ChapterAtom>
1900             </EditionEntry>
1901           </Chapters>
1902
1903       With this format three things are possible that are not possible with
1904       the simple chapter format:
1905
1906        1. The timestamp for the end of the chapter can be set,
1907
1908        2. chapters can be nested,
1909
1910        3. the language and country can be set.
1911
1912       The mkvtoolnix distribution contains some sample files in the doc
1913       subdirectory which can be used as a basis.
1914
1915       The following lists the supported XML tags, their data types and, where
1916       appropriate, the valid range for their values:
1917
1918           Chapters (master)
1919             EditionEntry (master)
1920               EditionUID (unsigned integer, valid range: 1 <= value)
1921               EditionFlagHidden (unsigned integer, valid range: 0 <= value <= 1)
1922               EditionFlagDefault (unsigned integer, valid range: 0 <= value <= 1)
1923               EditionFlagOrdered (unsigned integer, valid range: 0 <= value <= 1)
1924               ChapterAtom (master)
1925                 ChapterAtom (master)
1926                 ChapterUID (unsigned integer, valid range: 1 <= value)
1927                 ChapterTimeStart (unsigned integer)
1928                 ChapterTimeEnd (unsigned integer)
1929                 ChapterFlagHidden (unsigned integer, valid range: 0 <= value <= 1)
1930                 ChapterFlagEnabled (unsigned integer, valid range: 0 <= value <= 1)
1931                 ChapterSegmentUID (binary, valid range: 1 <= length in bytes)
1932                 ChapterSegmentEditionUID (unsigned integer, valid range: 1 <= value)
1933                 ChapterPhysicalEquiv (unsigned integer)
1934                 ChapterTrack (master)
1935                   ChapterTrackNumber (unsigned integer, valid range: 1 <= value)
1936                 ChapterDisplay (master)
1937                   ChapterString (UTF-8 string)
1938                   ChapterLanguage (UTF-8 string)
1939                   ChapterCountry (UTF-8 string)
1940                 ChapterProcess (master)
1941                   ChapterProcessCodecID (unsigned integer)
1942                   ChapterProcessPrivate (binary)
1943                   ChapterProcessCommand (master)
1944                     ChapterProcessTime (unsigned integer)
1945                     ChapterProcessData (binary)
1946
1947   Reading chapters from Blu-rays
1948       mkvmerge(1) can read chapters from unencrypted Blu-rays. For that you
1949       can use the path to one of the MPLS play lists with the --chapters
1950       parameter.
1951
1952       Example: --chapters /srv/blurays/BigBuckBunny/BDMV/PLAYLIST/00001.mpls
1953
1954   Reading chapters from DVDs
1955       When MKVToolNix is compiled with the libdvdread(TM) library,
1956       mkvmerge(1) can read chapters from DVDs. For that you can use the path
1957       to one of the folders or files on the DVD with the --chapters
1958       parameter. As DVDs can contain more than one title and each title has
1959       its own set of chapters, you can append a colon and the desired title
1960       number to the end of the file name argument. The title number defaults
1961       to 1.
1962
1963       Example: --chapters /srv/dvds/BigBuckBunny/VIDEO_TS:2
1964
1965   General notes
1966       When splitting files mkvmerge(1) will correctly adjust the chapters as
1967       well. This means that each file only includes the chapter entries that
1968       apply to it, and that the timestamps will be offset to match the new
1969       timestamps of each output file.
1970
1971       mkvmerge(1) is able to copy chapters from Matroska(TM) source files
1972       unless this is explicitly disabled with the --no-chapters option. The
1973       chapters from all sources (Matroska(TM) files, Ogg files, MP4 files,
1974       chapter text files) are usually not merged but end up in separate
1975       ChapterEditions. Only if chapters are read from several Matroska(TM) or
1976       XML files that share the same edition UIDs will chapters be merged into
1977       a single ChapterEdition. If such a merge is desired in other situations
1978       as well then the user has to extract the chapters from all sources with
1979       mkvextract(1) first, merge the XML files manually and mux them
1980       afterwards.
1981

TAGS

1983   Introduction
1984       Matroska(TM)'s tag system is similar to that of other containers: a set
1985       of KEY=VALUE pairs. However, in Matroska(TM) these tags can also be
1986       nested, and both the KEY and the VALUE are elements of their own. The
1987       example file example-tags-2.xml shows how to use this system.
1988
1989   Scope of the tags
1990       Matroska(TM) tags do not automatically apply to the complete file. They
1991       can, but they also may apply to different parts of the file: to one or
1992       more tracks, to one or more chapters, or even to a combination of both.
1993       The Matroska(TM) specification[5] gives more details about this fact.
1994
1995       One important fact is that tags are linked to tracks or chapters with
1996       the Targets Matroska(TM) tag element, and that the UIDs used for this
1997       linking are not the track IDs mkvmerge(1) uses everywhere. Instead the
1998       numbers used are the UIDs which mkvmerge(1) calculates automatically
1999       (if the track is taken from a file format other than Matroska(TM)) or
2000       which are copied from the source file if the track's source file is a
2001       Matroska(TM) file. Therefore it is difficult to know which UIDs to use
2002       in the tag file before the file is handed over to mkvmerge(1).
2003
2004       mkvmerge(1) knows two options with which you can add tags to
2005       Matroska(TM) files: The --global-tags and the --tags options. The
2006       difference is that the former option, --global-tags, will make the tags
2007       apply to the complete file by removing any of those Targets elements
2008       mentioned above. The latter option, --tags, automatically inserts the
2009       UID that mkvmerge(1) generates for the tag specified with the TID part
2010       of the --tags option.
2011
2012   Example
2013       Let's say that you want to add tags to a video track read from an AVI.
2014       mkvmerge --identify file.avi tells you that the video track's ID (do
2015       not mix this ID with the UID!) is 0. So you create your tag file, leave
2016       out all Targets elements and call mkvmerge(1):
2017
2018           $ mkvmerge -o file.mkv --tags 0:tags.xml file.avi
2019
2020   Tag file format
2021       mkvmerge(1) supports a XML based tag file format. The format is very
2022       closely modeled after the Matroska(TM) specification[5]. Both the
2023       binary and the source distributions of MKVToolNix come with a sample
2024       file called example-tags-2.xml which simply lists all known tags and
2025       which can be used as a basis for real life tag files.
2026
2027       The basics are:
2028
2029       •   The outermost element must be <Tags>.
2030
2031       •   One logical tag is contained inside one pair of <Tag> XML tags.
2032
2033       •   White spaces directly before and after tag contents are ignored.
2034
2035   Data types
2036       The new Matroska(TM) tagging system only knows two data types, a UTF-8
2037       string and a binary type. The first is used for the tag's name and the
2038       <String> element while the binary type is used for the <Binary>
2039       element.
2040
2041       As binary data itself would not fit into a XML file mkvmerge(1)
2042       supports two other methods of storing binary data. If the contents of a
2043       XML tag starts with '@' then the following text is treated as a file
2044       name. The corresponding file's content is copied into the Matroska(TM)
2045       element.
2046
2047       Otherwise the data is expected to be Base64 encoded. This is an
2048       encoding that transforms binary data into a limited set of ASCII
2049       characters and is used e.g. in email programs.  mkvextract(1) will
2050       output Base64 encoded data for binary elements.
2051
2052       The deprecated tagging system knows some more data types which can be
2053       found in the official Matroska(TM) tag specs. As mkvmerge(1) does not
2054       support this system anymore these types aren't described here.
2055
2056   Known tags for the XML file format
2057       The following lists the supported XML tags, their data types and, where
2058       appropriate, the valid range for their values:
2059
2060           Tags (master)
2061             Tag (master)
2062               Targets (master)
2063                 TargetTypeValue (unsigned integer)
2064                 TargetType (UTF-8 string)
2065                 TrackUID (unsigned integer)
2066                 EditionUID (unsigned integer)
2067                 ChapterUID (unsigned integer)
2068                 AttachmentUID (unsigned integer)
2069               Simple (master)
2070                 Simple (master)
2071                 Name (UTF-8 string)
2072                 TagLanguage (UTF-8 string)
2073                 DefaultLanguage (unsigned integer)
2074                 String (UTF-8 string)
2075                 Binary (binary)
2076

SEGMENT INFORMATION

2078       With a segment info XML file it is possible to set certain values in
2079       the "segment information" header field of a Matroska(TM) file. All of
2080       these values cannot be set via other command line options.
2081
2082       Other "segment information" header fields can be set via command line
2083       options but not via the XML file. This includes e.g. the --title and
2084       the --timestamp-scale options.
2085
2086       There are other elements that can be set neither via command line
2087       options nor via the XML files. These include the following elements:
2088       DateUTC (also known as the "muxing date"), MuxingApp, WritingApp and
2089       Duration. They're always set by mkvmerge(1) itself.
2090
2091       The following lists the supported XML tags, their data types and, where
2092       appropriate, the valid range for their values:
2093
2094           Info (master)
2095             SegmentUID (binary, valid range: length in bytes == 16)
2096             SegmentFilename (UTF-8 string)
2097             PreviousSegmentUID (binary, valid range: length in bytes == 16)
2098             PreviousSegmentFilename (UTF-8 string)
2099             NextSegmentUID (binary, valid range: length in bytes == 16)
2100             NextSegmentFilename (UTF-8 string)
2101             SegmentFamily (binary, valid range: length in bytes == 16)
2102             ChapterTranslate (master)
2103               ChapterTranslateEditionUID (unsigned integer)
2104               ChapterTranslateCodec (unsigned integer)
2105               ChapterTranslateID (binary)
2106

MATROSKA(TM) FILE LAYOUT

2108       The Matroska(TM) file layout is quite flexible.  mkvmerge(1) will
2109       render a file in a predefined way. The resulting file looks like this:
2110
2111       [EBML head] [segment {meta seek #1} [segment information] [track
2112       information] {attachments} {chapters} [cluster 1] {cluster 2} ...
2113       {cluster n} {cues} {meta seek #2} {tags}]
2114
2115       The elements in curly braces are optional and depend on the contents
2116       and options used. A couple of notes:
2117
2118       •   meta seek #1 includes only a small number of level 1 elements, and
2119           only if they actually exist: attachments, chapters, cues, tags,
2120           meta seek #2. Older versions of mkvmerge(1) used to put the
2121           clusters into this meta seek element as well. Therefore some
2122           imprecise guessing was necessary to reserve enough space. It often
2123           failed. Now only the clusters are stored in meta seek #2, and meta
2124           seek #1 refers to the meta seek element #2.
2125
2126       •   Attachment, chapter and tag elements are only present if they were
2127           added.
2128
2129       The shortest possible Matroska(TM) file would look like this:
2130
2131       [EBML head] [segment [segment information] [track information] [cluster
2132       1]]
2133
2134       This might be the case for audio-only files.
2135

EXTERNAL TIMESTAMP FILES

2137       mkvmerge(1) allows the user to chose the timestamps for a specific
2138       track himself. This can be used in order to create files with variable
2139       frame rate video or include gaps in audio. A frame in this case is the
2140       unit that mkvmerge(1) creates separately per Matroska(TM) block. For
2141       video this is exactly one frame, for audio this is one packet of the
2142       specific audio type. E.g. for AC-3 this would be a packet containing
2143       1536 samples.
2144
2145       Timestamp files that are used when tracks are appended to each other
2146       must only be specified for the first part in a chain of tracks. For
2147       example if you append two files, v1.avi and v2.avi, and want to use
2148       timestamps then your command line must look something like this:
2149
2150           $ mkvmerge ... --timestamps 0:my_timestamps.txt v1.avi +v2.avi
2151
2152       There are four formats that are recognized by mkvmerge(1). The first
2153       line always contains the version number. Empty lines, lines containing
2154       only whitespace and lines beginning with '#' are ignored.
2155
2156   Timestamp file format v1
2157       This format starts with the version line. The second line declares the
2158       default number of frames per second. All following lines contain three
2159       numbers separated by commas: the start frame (0 is the first frame),
2160       the end frame and the number of frames in this range. The FPS is a
2161       floating point number with the dot '.' as the decimal point. The ranges
2162       can contain gaps for which the default FPS is used. An example:
2163
2164           # timestamp format v1
2165           assume 27.930
2166           800,1000,25
2167           1500,1700,30
2168
2169   Timestamp file format v2
2170       In this format each line contains a timestamp for the corresponding
2171       frame. This timestamp must be given in millisecond precision. It can be
2172       a floating point number, but it doesn't have to be. You have to give at
2173       least as many timestamp lines as there are frames in the track. The
2174       timestamps in this file must be sorted. Example for 25fps:
2175
2176           # timestamp format v2
2177           0
2178           40
2179           80
2180
2181   Timestamp file format v3
2182       In this format each line contains a duration in seconds followed by an
2183       optional number of frames per second. Both can be floating point
2184       numbers. If the number of frames per second is not present the default
2185       one is used. For audio you should let the codec calculate the frame
2186       timestamps itself. For that you should be using 0.0 as the number of
2187       frames per second. You can also create gaps in the stream by using the
2188       'gap' keyword followed by the duration of the gap. Example for an audio
2189       file:
2190
2191           # timestamp format v3
2192           assume 0.0
2193           25.325
2194           7.530,38.236
2195           gap, 10.050
2196           2.000,38.236
2197
2198   Timestamp file format v4
2199       This format is identical to the v2 format. The only difference is that
2200       the timestamps do not have to be sorted. This format should almost
2201       never be used.
2202

EXIT CODES

2204       mkvmerge(1) exits with one of three exit codes:
2205
22060 -- This exit code means that muxing has completed successfully.
2207
22081 -- In this case mkvmerge(1) has output at least one warning, but
2209           muxing did continue. A warning is prefixed with the text
2210           'Warning:'. Depending on the issues involved the resulting file
2211           might be ok or not. The user is urged to check both the warning and
2212           the resulting file.
2213
22142 -- This exit code is used after an error occurred.  mkvmerge(1)
2215           aborts right after outputting the error message. Error messages
2216           range from wrong command line arguments over read/write errors to
2217           broken files.
2218

ENVIRONMENT VARIABLES

2220       mkvmerge(1) uses the default variables that determine the system's
2221       locale (e.g.  LANG and the LC_* family). Additional variables:
2222
2223       MKVMERGE_DEBUG, MKVTOOLNIX_DEBUG and its short form MTX_DEBUG
2224           The content is treated as if it had been passed via the --debug
2225           option.
2226
2227       MKVMERGE_ENGAGE, MKVTOOLNIX_ENGAGE and its short form MTX_ENGAGE
2228           The content is treated as if it had been passed via the --engage
2229           option.
2230

SEE ALSO

2232       mkvinfo(1), mkvextract(1), mkvpropedit(1), mkvtoolnix-gui(1)
2233

WWW

2235       The latest version can always be found at the MKVToolNix homepage[6].
2236

AUTHOR

2238       Moritz Bunkus <moritz@bunkus.org>
2239           Developer
2240

NOTES

2242        1. the Matroska(TM) website
2243           https://www.matroska.org/
2244
2245        2. the IANA homepage
2246           https://www.iana.org/assignments/media-types/
2247
2248        3. mkvmerge-identification-output-schema-v18.json
2249           https://mkvtoolnix.download/doc/mkvmerge-identification-output-schema-v18.json
2250
2251        4. RFC 7159
2252           https://tools.ietf.org/html/rfc7159
2253
2254        5. Matroska(TM) specification
2255           https://www.matroska.org/technical/specs/index.html
2256
2257        6. the MKVToolNix homepage
2258           https://mkvtoolnix.download/
2259
2260
2261
2262MKVToolNix 80.0                   2023-10-29                       MKVMERGE(1)
Impressum