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

USAGE

1320       For each file the user can select which tracks mkvmerge(1) should take.
1321       They are all put into the file specified with -o. A list of known (and
1322       supported) source formats can be obtained with the -l option.
1323
1324           Important
1325           The order of command line options is important. Please read the
1326           section "Option order" if you're new to the program.
1327

OPTION ORDER

1329       The order in which options are entered is important for some options.
1330       Options fall into two categories:
1331
1332        1. Options that affect the whole program and are not tied to any input
1333           file. These include but are not limited to --command-line-charset,
1334           --output or --title. These can appear anywhere on the command line.
1335
1336        2. Options that affect a single input file or a single track in an
1337           input file. These options all apply to the following input file on
1338           the command line. All options applying to the same input (or to
1339           tracks from the same input file) file can be written in any order
1340           as long as they all appear before that input file's name. Examples
1341           for options applying to an input file are --no-chapters or
1342           --chapter-charset. Examples for options applying to a single track
1343           are --default-duration or --language.
1344
1345       The options are processed from left to right. If an option appears
1346       multiple times within the same scope then the last occurrence will be
1347       used. Therefore the title will be set to "Something else" in the
1348       following example:
1349
1350           $ mkvmerge -o output.mkv --title 'This and that' input.avi --title 'Something else'
1351
1352       The following example shows that using the --language option twice is
1353       OK because they're used in different scopes. Even though they apply to
1354       the same track ID they apply to different input files and therefore
1355       have different scopes:
1356
1357           $ mkvmerge -o output.mkv --language 0:fre français.ogg --language 0:deu deutsch.ogg
1358

EXAMPLES

1360       Let's assume you have a file called MyMovie.avi and the audio track in
1361       a separate file, e.g. 'MyMovie.wav'. First you want to encode the audio
1362       to OggVorbis(TM):
1363
1364           $ oggenc -q4 -oMyMovie.ogg MyMovie.wav
1365
1366       After a couple of minutes you can join video and audio:
1367
1368           $ mkvmerge -o MyMovie-with-sound.mkv MyMovie.avi MyMovie.ogg
1369
1370       If your AVI already contains an audio track then it will be copied as
1371       well (if mkvmerge(1) supports the audio format). To avoid that simply
1372       do
1373
1374           $ mkvmerge -o MyMovie-with-sound.mkv -A MyMovie.avi MyMovie.ogg
1375
1376       After some minutes of consideration you rip another audio track, e.g.
1377       the director's comments or another language to 'MyMovie-add-audio.wav'.
1378       Encode it again and join it up with the other file:
1379
1380           $ oggenc -q4 -oMyMovie-add-audio.ogg MyMovie-add-audio.wav
1381           $ mkvmerge -o MM-complete.mkv MyMovie-with-sound.mkv MyMovie-add-audio.ogg
1382
1383       The same result can be achieved with
1384
1385           $ mkvmerge -o MM-complete.mkv -A MyMovie.avi MyMovie.ogg MyMovie-add-audio.ogg
1386
1387       Now fire up mplayer(TM) and enjoy. If you have multiple audio tracks
1388       (or even video tracks) then you can tell mplayer(TM) which track to
1389       play with the '-vid' and '-aid' options. These are 0-based and do not
1390       distinguish between video and audio.
1391
1392       If you need an audio track synchronized you can do that easily. First
1393       find out which track ID the Vorbis track has with
1394
1395           $ mkvmerge --identify outofsync.ogg
1396
1397       Now you can use that ID in the following command line:
1398
1399           $ mkvmerge -o goodsync.mkv -A source.avi -y 12345:200 outofsync.ogg
1400
1401       This would add 200ms of silence at the beginning of the audio track
1402       with the ID 12345 taken from 'outofsync.ogg'.
1403
1404       Some movies start synced correctly but slowly drift out of sync. For
1405       these kind of movies you can specify a delay factor that is applied to
1406       all timestamps -- no data is added or removed. So if you make that
1407       factor too big or too small you'll get bad results. An example is that
1408       an episode I transcoded was 0.2 seconds out of sync at the end of the
1409       movie which was 77340 frames long. At 29.97fps 0.2 seconds correspond
1410       to approx.  6 frames. So I did
1411
1412           $ mkvmerge -o goodsync.mkv -y 23456:0,77346/77340 outofsync.mkv
1413
1414       The result was fine.
1415
1416       The sync options can also be used for subtitles in the same manner.
1417
1418       For text subtitles you can either use some Windows software (like
1419       SubRipper(TM)) or the subrip(TM) package found in transcode(1)'s
1420       sources in the 'contrib/subrip' directory. The general process is:
1421
1422        1. extract a raw subtitle stream from the source:
1423
1424               $ tccat -i /path/to/copied/dvd/ -T 1 -L | tcextract -x ps1 -t vob -a 0x20 | subtitle2pgm -o mymovie
1425
1426        2. convert the resulting PGM images to text with gocr:
1427
1428               $ pgm2txt mymovie
1429
1430        3. spell-check the resulting text files:
1431
1432               $ ispell -d american *txt
1433
1434        4. convert the text files to a SRT file:
1435
1436               $ srttool -s -w -i mymovie.srtx -o mymovie.srt
1437
1438       The resulting file can be used as another input file for mkvmerge(1):
1439
1440           $ mkvmerge -o mymovie.mkv mymovie.avi mymovie.srt
1441
1442       If you want to specify the language for a given track then this is
1443       easily done. First find out the ISO 639-2 code for your language.
1444       mkvmerge(1) can list all of those codes for you:
1445
1446           $ mkvmerge --list-languages
1447
1448       Search the list for the languages you need. Let's assume you have put
1449       two audio tracks into a Matroska(TM) file and want to set their
1450       language codes and that their track IDs are 2 and 3. This can be done
1451       with
1452
1453           $ mkvmerge -o with-lang-codes.mkv --language 2:ger --language 3:dut without-lang-codes.mkv
1454
1455       As you can see you can use the --language switch multiple times.
1456
1457       Maybe you'd also like to have the player use the Dutch language as the
1458       default language. You also have extra subtitles, e.g. in English and
1459       French, and want to have the player display the French ones by default.
1460       This can be done with
1461
1462           $ mkvmerge -o with-lang-codes.mkv --language 2:ger --language 3:dut --default-track 3 without-lang-codes.mkv --language 0:eng english.srt --default-track 0 --language 0:fre french.srt
1463
1464       If you do not see the language or default track flags that you've
1465       specified in mkvinfo(1)'s output then please read the section about
1466       default values.
1467
1468       Turn off the compression for an input file.
1469
1470           $ mkvmerge -o no-compression.mkv --compression -1:none MyMovie.avi --compression -1:none mymovie.srt
1471

TRACK IDS

1473   Regular track IDs
1474       Some of the options for mkvmerge(1) need a track ID to specify which
1475       track they should be applied to. Those track IDs are printed by the
1476       readers when demuxing the current input file, or if mkvmerge(1) is
1477       called with the --identify option. An example for such output:
1478
1479           $ mkvmerge -i v.mkv
1480           File 'v.mkv': container: Matroska(TM)
1481           Track ID 0: video (V_MS/VFW/FOURCC, DIV3)
1482           Track ID 1: audio (A_MPEG/L3)
1483
1484       Do not confuse the track IDs that are assigned to the tracks that are
1485       placed in the output MKV file with the track IDs of the input files.
1486       Only the input file track IDs are used for options needing these
1487       values.
1488
1489       Also note that each input file has its own set of track IDs. Therefore
1490       the track IDs for file 'file1.ext' as reported by 'mkvmerge --identify'
1491       do not change no matter how many other input files are there or in
1492       which position 'file1.ext' is used.
1493
1494       Track IDs are assigned like this:
1495
1496       ·   AVI files: The video track has the ID 0. The audio tracks get IDs
1497           in ascending order starting at 1.
1498
1499       ·   AAC, AC-3, MP3, SRT and WAV files: The one 'track' in that file
1500           gets the ID 0.
1501
1502       ·   Most other files: The track IDs are assigned in order the tracks
1503           are found in the file starting at 0.
1504
1505       The options that use the track IDs are the ones whose description
1506       contains 'TID'. The following options use track IDs as well:
1507       --audio-tracks, --video-tracks, --subtitle-tracks, --button-tracks and
1508       --track-tags.
1509
1510   Special track IDs
1511       There are several IDs that have special meaning and do not occur in the
1512       identification output.
1513
1514       The special track ID '-1' is a wild card and applies the given switch
1515       to all tracks that are read from an input file.
1516
1517       The special track ID '-2' refers to the chapters in a source file.
1518       Currently only the --sync option uses this special ID. As an
1519       alternative to --sync -2:...  the option --chapter-sync ...  can be
1520       used.
1521

TEXT FILES AND CHARACTER SET CONVERSIONS

1523           Note
1524           This section applies to all programs in MKVToolNix even if it only
1525           mentions mkvmerge(1).
1526
1527   Introduction
1528       All text in a Matroska(TM) file is encoded in UTF-8. This means that
1529       mkvmerge(1) has to convert every text file it reads as well as every
1530       text given on the command line from one character set into UTF-8. In
1531       return this also means that mkvmerge(1)'s output has to be converted
1532       back to that character set from UTF-8, e.g. if a non-English
1533       translation is used with --ui-language or for text originating from a
1534       Matroska(TM) file.
1535
1536       mkvmerge(1) does this conversion automatically based on the presence of
1537       a byte order marker (short: BOM) or the system's current locale. How
1538       the character set is inferred from the locale depends on the operating
1539       system that mkvmerge(1) is run on.
1540
1541   Byte order markers (BOM)
1542       Text files that start with a BOM are already encoded in one
1543       representation of UTF.  mkvmerge(1) supports the following five modes:
1544       UTF-8, UTF-16 Little and Big Endian, UTF-32 Little and Big Endian. Text
1545       files with a BOM are automatically converted to UTF-8. Any of the
1546       parameters that would otherwise set the character set for such a file
1547       (e.g.  --sub-charset) is silently ignored.
1548
1549   Linux and Unix-like systems including macOS
1550       On Unix-like systems mkvmerge(1) uses the setlocale(3) system call
1551       which in turn uses the environment variables LANG, LC_ALL and LC_CYPE.
1552       The resulting character set is often one of UTF-8 or the ISO-8859-*
1553       family and is used for all text file operations and for encoding
1554       strings on the command line and for output to the console.
1555
1556   Windows
1557       On Windows the default character set used for converting text files is
1558       determined by a call to the GetACP() system call.
1559
1560       Reading the command line is done with the GetCommandLineW() function
1561       which already returns a Unicode string. Therefore the option
1562       --command-line-charset is ignored on Windows.
1563
1564       Output to the console consists of three scenarios:
1565
1566        1. If the output is redirected with the option --redirect-output then
1567           the default charset is UTF-8. This can be changed with
1568           --output-charset.
1569
1570           If the output is redirected with cmd.exe itself, e.g. with mkvinfo
1571           file.mkv > info.txt, then the charset is always UTF-8 and cannot be
1572           changed.
1573
1574           Otherwise (when writing directly to the console) the Windows
1575           function WriteConsoleW() is used and the option --output-charset is
1576           ignored. The console should be able to output all Unicode
1577           characters for which the corresponding language support is
1578           installed (e.g. Chinese characters might not be displayed on
1579           English Windows versions).
1580
1581   Command line options
1582       The following options exist that allow specifying the character sets:
1583
1584       ·   --sub-charset for text subtitle files and for text subtitle tracks
1585           stored in container formats for which the character set cannot be
1586           determined unambiguously (e.g. Ogg files),
1587
1588       ·   --chapter-charset for chapter text files and for chapters and file
1589           titles stored in container formats for which the character set
1590           cannot be determined unambiguously (e.g. Ogg files for chapter
1591           information, track and file titles etc; MP4 files for chapter
1592           information),
1593
1594       ·   --command-line-charset for all strings on the command line,
1595
1596       ·   --output-charset for all strings written to the console or to a
1597           file if the output has been redirected with the --redirect-output
1598           option. On non-Windows systems the default for the output charset
1599           is the system's current charset. On Windows it defaults to UTF-8
1600           both for redirecting with --redirect-output and with cmd.exe
1601           itself, e.g.  mkvinfo file.mkv > info.txt.
1602

OPTION FILES

1604       An option file is a file mkvmerge(1) can read additional command line
1605       arguments from. This can be used in order to circumvent certain
1606       limitations of the shell or the operating system when executing
1607       external programs like a limited command line length.
1608
1609       An option file contains JSON-formatted data. Its content must be a
1610       valid JSON array consisting solely of JSON strings. The file's encoding
1611       must be UTF-8. The file should not start with a byte order marker
1612       (BOM), but if one exists, it will be skipped.
1613
1614       The rules for escaping special characters inside JSON are the ones in
1615       the official JSON specification, RFC 7159[4].
1616
1617       The command line 'mkvmerge -o "my file.mkv" -A "a movie.avi" sound.ogg'
1618       could be converted into the following JSON option file called e.g.
1619       'options.json':
1620
1621           [
1622             "-o",
1623             "c:\\Matroska\\my file.mkv",
1624             "--title",
1625             "#65",
1626             "-A",
1627             "a movie.avi",
1628             "sound.ogg"
1629           ]
1630

SUBTITLES

1632       There are several text and bitmap subtitle formats that can be embedded
1633       into Matroska(TM). Text subtitles must be recoded to UTF-8 so that they
1634       can be displayed correctly by a player (see the section about text
1635       files and character sets for an explanation how mkvmerge(1) converts
1636       between character sets). Kate subtitles are already encoded in UTF-8
1637       and do not have to be re-encoded.
1638
1639       The following subtitle formats are supported at the moment:
1640
1641       ·   Subtitle Ripper (SRT) files
1642
1643       ·   Substation Alpha (SSA) / Advanced Substation Alpha scripts (ASS)
1644
1645       ·   Universal Subtitle Format (USF) files
1646
1647       ·   OggKate streams
1648
1649       ·   VobSub bitmap subtitle files
1650
1651       ·   PGS bitmap subtitle files as found on BluRay discs
1652

FILE LINKING

1654       Matroska(TM) supports file linking which simply says that a specific
1655       file is the predecessor or successor of the current file. To be
1656       precise, it's not really the files that are linked but the Matroska(TM)
1657       segments. As most files will probably only contain one Matroska(TM)
1658       segment the following explanations use the term 'file linking' although
1659       'segment linking' would be more appropriate.
1660
1661       Each segment is identified by a unique 128 bit wide segment UID. This
1662       UID is automatically generated by mkvmerge(1). The linking is done
1663       primarily via putting the segment UIDs (short: SID) of the
1664       previous/next file into the segment header information.  mkvinfo(1)
1665       prints these SIDs if it finds them.
1666
1667       If a file is split into several smaller ones and linking is used then
1668       the timestamps will not start at 0 again but will continue where the
1669       last file has left off. This way the absolute time is kept even if the
1670       previous files are not available (e.g. when streaming). If no linking
1671       is used then the timestamps should start at 0 for each file. By default
1672       mkvmerge(1) does not use file linking. If you want that you can turn it
1673       on with the --link option. This option is only useful if splitting is
1674       activated as well.
1675
1676       Regardless of whether splitting is active or not the user can tell
1677       mkvmerge(1) to link the produced files to specific SIDs. This is
1678       achieved with the options --link-to-previous and --link-to-next. These
1679       options accept a segment SID in the format that mkvinfo(1) outputs: 16
1680       hexadecimal numbers between 0x00 and 0xff prefixed with '0x' each, e.g.
1681       '0x41 0xda 0x73 0x66 0xd9 0xcf 0xb2 0x1e 0xae 0x78 0xeb 0xb4 0x5e 0xca
1682       0xb3 0x93'. Alternatively a shorter form can be used: 16 hexadecimal
1683       numbers between 0x00 and 0xff without the '0x' prefixes and without the
1684       spaces, e.g. '41da7366d9cfb21eae78ebb45ecab393'.
1685
1686       If splitting is used then the first file is linked to the SID given
1687       with --link-to-previous and the last file is linked to the SID given
1688       with --link-to-next. If splitting is not used then the one output file
1689       will be linked to both of the two SIDs.
1690

DEFAULT VALUES

1692       The Matroska(TM) specification states that some elements have a default
1693       value. Usually an element is not written to the file if its value is
1694       equal to its default value in order to save space. The elements that
1695       the user might miss in mkvinfo(1)'s output are the language and the
1696       default track flag elements. The default value for the language is
1697       English ('eng'), and the default value for the default track flag is
1698       true. Therefore if you used --language 0:eng for a track then it will
1699       not show up in mkvinfo(1)'s output.
1700

ATTACHMENTS

1702       Maybe you also want to keep some photos along with your Matroska(TM)
1703       file, or you're using SSA subtitles and need a special TrueType(TM)
1704       font that's really rare. In these cases you can attach those files to
1705       the Matroska(TM) file. They will not be just appended to the file but
1706       embedded in it. A player can then show those files (the 'photos' case)
1707       or use them to render the subtitles (the 'TrueType(TM) fonts' case).
1708
1709       Here's an example how to attach a photo and a TrueType(TM) font to the
1710       output file:
1711
1712           $ mkvmerge -o output.mkv -A video.avi sound.ogg \
1713             --attachment-description "Me and the band behind the stage in a small get-together" \
1714             --attachment-mime-type image/jpeg \
1715             --attach-file me_and_the_band.jpg \
1716             --attachment-description "The real rare and unbelievably good looking font" \
1717             --attachment-mime-type application/octet-stream \
1718             --attach-file really_cool_font.ttf
1719
1720       If a Matroska(TM) containing attachments file is used as an input file
1721       then mkvmerge(1) will copy the attachments into the new file. The
1722       selection which attachments are copied and which are not can be changed
1723       with the options --attachments and --no-attachments.
1724

CHAPTERS

1726       The Matroska(TM) chapter system is more powerful than the old known
1727       system used by OGM files. The full specifications can be found at the
1728       Matroska(TM) website[1].
1729
1730       mkvmerge(1) supports two kinds of chapter files as its input. The first
1731       format, called 'simple chapter format', is the same format that the OGM
1732       tools expect. The second format is a XML based chapter format which
1733       supports all of Matroska(TM)'s chapter functionality.
1734
1735   The simple chapter format
1736       This format consists of pairs of lines that start with 'CHAPTERxx=' and
1737       'CHAPTERxxNAME=' respectively. The first one contains the start
1738       timestamp while the second one contains the title. Here's an example:
1739
1740           CHAPTER01=00:00:00.000
1741           CHAPTER01NAME=Intro
1742           CHAPTER02=00:02:30.000
1743           CHAPTER02NAME=Baby prepares to rock
1744           CHAPTER03=00:02:42.300
1745           CHAPTER03NAME=Baby rocks the house
1746
1747       mkvmerge(1) will transform every pair or lines into one Matroska(TM)
1748       ChapterAtom. It does not set any ChapterTrackNumber which means that
1749       the chapters all apply to all tracks in the file.
1750
1751       As this is a text file character set conversion may need to be done.
1752       See the section about text files and character sets for an explanation
1753       how mkvmerge(1) converts between character sets.
1754
1755   The XML based chapter format
1756       The XML based chapter format looks like this example:
1757
1758           <?xml version="1.0" encoding="ISO-8859-1"?>
1759           <!DOCTYPE Chapters SYSTEM "matroskachapters.dtd">
1760           <Chapters>
1761             <EditionEntry>
1762               <ChapterAtom>
1763                 <ChapterTimeStart>00:00:30.000</ChapterTimeStart>
1764                 <ChapterTimeEnd>00:01:20.000</ChapterTimeEnd>
1765                 <ChapterDisplay>
1766                   <ChapterString>A short chapter</ChapterString>
1767                   <ChapterLanguage>eng</ChapterLanguage>
1768                 </ChapterDisplay>
1769                 <ChapterAtom>
1770                   <ChapterTimeStart>00:00:46.000</ChapterTimeStart>
1771                   <ChapterTimeEnd>00:01:10.000</ChapterTimeEnd>
1772                   <ChapterDisplay>
1773                     <ChapterString>A part of that short chapter</ChapterString>
1774                     <ChapterLanguage>eng</ChapterLanguage>
1775                   </ChapterDisplay>
1776                 </ChapterAtom>
1777               </ChapterAtom>
1778             </EditionEntry>
1779           </Chapters>
1780
1781       With this format three things are possible that are not possible with
1782       the simple chapter format:
1783
1784        1. The timestamp for the end of the chapter can be set,
1785
1786        2. chapters can be nested,
1787
1788        3. the language and country can be set.
1789
1790       The mkvtoolnix distribution contains some sample files in the doc
1791       subdirectory which can be used as a basis.
1792
1793       The following lists the supported XML tags, their data types and, where
1794       appropriate, the valid range for their values:
1795
1796           Chapters (master)
1797             EditionEntry (master)
1798               EditionUID (unsigned integer, valid range: 1 <= value)
1799               EditionFlagHidden (unsigned integer, valid range: 0 <= value <= 1)
1800               EditionFlagDefault (unsigned integer, valid range: 0 <= value <= 1)
1801               EditionFlagOrdered (unsigned integer, valid range: 0 <= value <= 1)
1802               ChapterAtom (master)
1803                 ChapterAtom (master)
1804                 ChapterUID (unsigned integer, valid range: 1 <= value)
1805                 ChapterTimeStart (unsigned integer)
1806                 ChapterTimeEnd (unsigned integer)
1807                 ChapterFlagHidden (unsigned integer, valid range: 0 <= value <= 1)
1808                 ChapterFlagEnabled (unsigned integer, valid range: 0 <= value <= 1)
1809                 ChapterSegmentUID (binary, valid range: 1 <= length in bytes)
1810                 ChapterSegmentEditionUID (unsigned integer, valid range: 1 <= value)
1811                 ChapterPhysicalEquiv (unsigned integer)
1812                 ChapterTrack (master)
1813                   ChapterTrackNumber (unsigned integer, valid range: 1 <= value)
1814                 ChapterDisplay (master)
1815                   ChapterString (UTF-8 string)
1816                   ChapterLanguage (UTF-8 string)
1817                   ChapterCountry (UTF-8 string)
1818                 ChapterProcess (master)
1819                   ChapterProcessCodecID (unsigned integer)
1820                   ChapterProcessPrivate (binary)
1821                   ChapterProcessCommand (master)
1822                     ChapterProcessTime (unsigned integer)
1823                     ChapterProcessData (binary)
1824
1825   General notes
1826       When splitting files mkvmerge(1) will correctly adjust the chapters as
1827       well. This means that each file only includes the chapter entries that
1828       apply to it, and that the timestamps will be offset to match the new
1829       timestamps of each output file.
1830
1831       mkvmerge(1) is able to copy chapters from Matroska(TM) source files
1832       unless this is explicitly disabled with the --no-chapters option. The
1833       chapters from all sources (Matroska(TM) files, Ogg files, MP4 files,
1834       chapter text files) are usually not merged but end up in separate
1835       ChapterEditions. Only if chapters are read from several Matroska(TM) or
1836       XML files that share the same edition UIDs will chapters be merged into
1837       a single ChapterEdition. If such a merge is desired in other situations
1838       as well then the user has to extract the chapters from all sources with
1839       mkvextract(1) first, merge the XML files manually and mux them
1840       afterwards.
1841

TAGS

1843   Introduction
1844       Matroska(TM)'s tag system is similar to that of other containers: a set
1845       of KEY=VALUE pairs. However, in Matroska(TM) these tags can also be
1846       nested, and both the KEY and the VALUE are elements of their own. The
1847       example file example-tags-2.xml shows how to use this system.
1848
1849   Scope of the tags
1850       Matroska(TM) tags do not automatically apply to the complete file. They
1851       can, but they also may apply to different parts of the file: to one or
1852       more tracks, to one or more chapters, or even to a combination of both.
1853       The Matroska(TM) specification[5] gives more details about this fact.
1854
1855       One important fact is that tags are linked to tracks or chapters with
1856       the Targets Matroska(TM) tag element, and that the UIDs used for this
1857       linking are not the track IDs mkvmerge(1) uses everywhere. Instead the
1858       numbers used are the UIDs which mkvmerge(1) calculates automatically
1859       (if the track is taken from a file format other than Matroska(TM)) or
1860       which are copied from the source file if the track's source file is a
1861       Matroska(TM) file. Therefore it is difficult to know which UIDs to use
1862       in the tag file before the file is handed over to mkvmerge(1).
1863
1864       mkvmerge(1) knows two options with which you can add tags to
1865       Matroska(TM) files: The --global-tags and the --tags options. The
1866       difference is that the former option, --global-tags, will make the tags
1867       apply to the complete file by removing any of those Targets elements
1868       mentioned above. The latter option, --tags, automatically inserts the
1869       UID that mkvmerge(1) generates for the tag specified with the TID part
1870       of the --tags option.
1871
1872   Example
1873       Let's say that you want to add tags to a video track read from an AVI.
1874       mkvmerge --identify file.avi tells you that the video track's ID (do
1875       not mix this ID with the UID!) is 0. So you create your tag file, leave
1876       out all Targets elements and call mkvmerge(1):
1877
1878           $ mkvmerge -o file.mkv --tags 0:tags.xml file.avi
1879
1880   Tag file format
1881       mkvmerge(1) supports a XML based tag file format. The format is very
1882       closely modeled after the Matroska(TM) specification[5]. Both the
1883       binary and the source distributions of MKVToolNix come with a sample
1884       file called example-tags-2.xml which simply lists all known tags and
1885       which can be used as a basis for real life tag files.
1886
1887       The basics are:
1888
1889       ·   The outermost element must be <Tags>.
1890
1891       ·   One logical tag is contained inside one pair of <Tag> XML tags.
1892
1893       ·   White spaces directly before and after tag contents are ignored.
1894
1895   Data types
1896       The new Matroska(TM) tagging system only knows two data types, a UTF-8
1897       string and a binary type. The first is used for the tag's name and the
1898       <String> element while the binary type is used for the <Binary>
1899       element.
1900
1901       As binary data itself would not fit into a XML file mkvmerge(1)
1902       supports two other methods of storing binary data. If the contents of a
1903       XML tag starts with '@' then the following text is treated as a file
1904       name. The corresponding file's content is copied into the Matroska(TM)
1905       element.
1906
1907       Otherwise the data is expected to be Base64 encoded. This is an
1908       encoding that transforms binary data into a limited set of ASCII
1909       characters and is used e.g. in email programs.  mkvextract(1) will
1910       output Base64 encoded data for binary elements.
1911
1912       The deprecated tagging system knows some more data types which can be
1913       found in the official Matroska(TM) tag specs. As mkvmerge(1) does not
1914       support this system anymore these types aren't described here.
1915
1916   Known tags for the XML file format
1917       The following lists the supported XML tags, their data types and, where
1918       appropriate, the valid range for their values:
1919
1920           Tags (master)
1921             Tag (master)
1922               Targets (master)
1923                 TargetTypeValue (unsigned integer)
1924                 TargetType (UTF-8 string)
1925                 TrackUID (unsigned integer)
1926                 EditionUID (unsigned integer)
1927                 ChapterUID (unsigned integer)
1928                 AttachmentUID (unsigned integer)
1929               Simple (master)
1930                 Simple (master)
1931                 Name (UTF-8 string)
1932                 TagLanguage (UTF-8 string)
1933                 DefaultLanguage (unsigned integer)
1934                 String (UTF-8 string)
1935                 Binary (binary)
1936

THE SEGMENT INFO XML FILES

1938       With a segment info XML file it is possible to set certain values in
1939       the "segment information" header field of a Matroska(TM) file. All of
1940       these values cannot be set via other command line options.
1941
1942       Other "segment information" header fields can be set via command line
1943       options but not via the XML file. This includes e.g. the --title and
1944       the --timestamp-scale options.
1945
1946       There are other elements that can be set neither via command line
1947       options nor via the XML files. These include the following elements:
1948       DateUTC (also known as the "muxing date"), MuxingApp, WritingApp and
1949       Duration. They're always set by mkvmerge(1) itself.
1950
1951       The following lists the supported XML tags, their data types and, where
1952       appropriate, the valid range for their values:
1953
1954           Info (master)
1955             SegmentUID (binary, valid range: length in bytes == 16)
1956             SegmentFilename (UTF-8 string)
1957             PreviousSegmentUID (binary, valid range: length in bytes == 16)
1958             PreviousSegmentFilename (UTF-8 string)
1959             NextSegmentUID (binary, valid range: length in bytes == 16)
1960             NextSegmentFilename (UTF-8 string)
1961             SegmentFamily (binary, valid range: length in bytes == 16)
1962             ChapterTranslate (master)
1963               ChapterTranslateEditionUID (unsigned integer)
1964               ChapterTranslateCodec (unsigned integer)
1965               ChapterTranslateID (binary)
1966

MATROSKA(TM) FILE LAYOUT

1968       The Matroska(TM) file layout is quite flexible.  mkvmerge(1) will
1969       render a file in a predefined way. The resulting file looks like this:
1970
1971       [EBML head] [segment {meta seek #1} [segment information] [track
1972       information] {attachments} {chapters} [cluster 1] {cluster 2} ...
1973       {cluster n} {cues} {meta seek #2} {tags}]
1974
1975       The elements in curly braces are optional and depend on the contents
1976       and options used. A couple of notes:
1977
1978       ·   meta seek #1 includes only a small number of level 1 elements, and
1979           only if they actually exist: attachments, chapters, cues, tags,
1980           meta seek #2. Older versions of mkvmerge(1) used to put the
1981           clusters into this meta seek element as well. Therefore some
1982           imprecise guessing was necessary to reserve enough space. It often
1983           failed. Now only the clusters are stored in meta seek #2, and meta
1984           seek #1 refers to the meta seek element #2.
1985
1986       ·   Attachment, chapter and tag elements are only present if they were
1987           added.
1988
1989       The shortest possible Matroska(TM) file would look like this:
1990
1991       [EBML head] [segment [segment information] [track information] [cluster
1992       1]]
1993
1994       This might be the case for audio-only files.
1995

EXTERNAL TIMESTAMP FILES

1997       mkvmerge(1) allows the user to chose the timestamps for a specific
1998       track himself. This can be used in order to create files with variable
1999       frame rate video or include gaps in audio. A frame in this case is the
2000       unit that mkvmerge(1) creates separately per Matroska(TM) block. For
2001       video this is exactly one frame, for audio this is one packet of the
2002       specific audio type. E.g. for AC-3 this would be a packet containing
2003       1536 samples.
2004
2005       Timestamp files that are used when tracks are appended to each other
2006       must only be specified for the first part in a chain of tracks. For
2007       example if you append two files, v1.avi and v2.avi, and want to use
2008       timestamps then your command line must look something like this:
2009
2010           $ mkvmerge ... --timestamps 0:my_timestamps.txt v1.avi +v2.avi
2011
2012       There are four formats that are recognized by mkvmerge(1). The first
2013       line always contains the version number. Empty lines, lines containing
2014       only whitespace and lines beginning with '#' are ignored.
2015
2016   Timestamp file format v1
2017       This format starts with the version line. The second line declares the
2018       default number of frames per second. All following lines contain three
2019       numbers separated by commas: the start frame (0 is the first frame),
2020       the end frame and the number of frames in this range. The FPS is a
2021       floating point number with the dot '.' as the decimal point. The ranges
2022       can contain gaps for which the default FPS is used. An example:
2023
2024           # timestamp format v1
2025           assume 27.930
2026           800,1000,25
2027           1500,1700,30
2028
2029   Timestamp file format v2
2030       In this format each line contains a timestamp for the corresponding
2031       frame. This timestamp must be given in millisecond precision. It can be
2032       a floating point number, but it doesn't have to be. You have to give at
2033       least as many timestamp lines as there are frames in the track. The
2034       timestamps in this file must be sorted. Example for 25fps:
2035
2036           # timestamp format v2
2037           0
2038           40
2039           80
2040
2041   Timestamp file format v3
2042       In this format each line contains a duration in seconds followed by an
2043       optional number of frames per second. Both can be floating point
2044       numbers. If the number of frames per second is not present the default
2045       one is used. For audio you should let the codec calculate the frame
2046       timestamps itself. For that you should be using 0.0 as the number of
2047       frames per second. You can also create gaps in the stream by using the
2048       'gap' keyword followed by the duration of the gap. Example for an audio
2049       file:
2050
2051           # timestamp format v3
2052           assume 0.0
2053           25.325
2054           7.530,38.236
2055           gap, 10.050
2056           2.000,38.236
2057
2058   Timestamp file format v4
2059       This format is identical to the v2 format. The only difference is that
2060       the timestamps do not have to be sorted. This format should almost
2061       never be used.
2062

EXIT CODES

2064       mkvmerge(1) exits with one of three exit codes:
2065
2066       ·   0 -- This exit code means that muxing has completed successfully.
2067
2068       ·   1 -- In this case mkvmerge(1) has output at least one warning, but
2069           muxing did continue. A warning is prefixed with the text
2070           'Warning:'. Depending on the issues involved the resulting file
2071           might be ok or not. The user is urged to check both the warning and
2072           the resulting file.
2073
2074       ·   2 -- This exit code is used after an error occurred.  mkvmerge(1)
2075           aborts right after outputting the error message. Error messages
2076           range from wrong command line arguments over read/write errors to
2077           broken files.
2078

ENVIRONMENT VARIABLES

2080       mkvmerge(1) uses the default variables that determine the system's
2081       locale (e.g.  LANG and the LC_* family). Additional variables:
2082
2083       MKVMERGE_DEBUG, MKVTOOLNIX_DEBUG and its short form MTX_DEBUG
2084           The content is treated as if it had been passed via the --debug
2085           option.
2086
2087       MKVMERGE_ENGAGE, MKVTOOLNIX_ENGAGE and its short form MTX_ENGAGE
2088           The content is treated as if it had been passed via the --engage
2089           option.
2090

SEE ALSO

2092       mkvinfo(1), mkvextract(1), mkvpropedit(1), mkvtoolnix-gui(1)
2093

WWW

2095       The latest version can always be found at the MKVToolNix homepage[6].
2096

AUTHOR

2098       Moritz Bunkus <moritz@bunkus.org>
2099           Developer
2100

NOTES

2102        1. the Matroska(TM) website
2103           http://www.matroska.org/
2104
2105        2. the IANA homepage
2106           http://www.iana.org/assignments/media-types/
2107
2108        3. mkvmerge-identification-output-schema-v12.json
2109           https://mkvtoolnix.download/doc/mkvmerge-identification-output-schema-v12.json
2110
2111        4. RFC 7159
2112           https://tools.ietf.org/html/rfc7159
2113
2114        5. Matroska(TM) specification
2115           http://matroska.org/technical/specs/index.html
2116
2117        6. the MKVToolNix homepage
2118           https://mkvtoolnix.download/
2119
2120
2121
2122MKVToolNix 45.0.0                 2020-04-04                       MKVMERGE(1)
Impressum