html-2-pdf

16
A guide to mkvmerge GUI (mmg) Moritz Bunkus Table of contents 1. Introduction 1. What is Matroska? 2. What is mkvmerge? What is mkvmerge GUI? 3. Obtaining the latest version 4. Scope of this guide 2. Setting up mkvmerge GUI 3. Creating Matroska files 1. Basics 2. Options for input files 3. Options for each track 4. Attachments 5. Global options 1. File/segment title 2. Automatic splitting and file linking 3. Manual file/segment linking 4. Chapters 5. Global tags 6. Starting the merge process 7. Saving and loading muxing settings 8. Queueing several jobs 4. The chapter editor 1. Matroska's chapter concept 2. Examples 3. Chapter formats supported by mkvmerge 1. Simple/OGM style chapter files 2. Full-featured XML style chapter files 3. Chapters found in Matroska files 4. Creating chapter files 5. Editing existing chapters 5. The header editor 1. Adding and removing header fields 2. Opening an existing file 3. Editing header fields 4. Validation 5. Saving the file 1. Introduction 1.1. What is Matroska? (Note: simply copied from www.matroska.org . ) generated with http://html-2-pdf.com Page 1 of 16

Transcript of html-2-pdf

Page 1: html-2-pdf

A guide to mkvmerge GUI (mmg)Moritz Bunkus

Table of contents

1. Introduction 1. What is Matroska?2. What is mkvmerge? What is mkvmerge GUI?3. Obtaining the latest version4. Scope of this guide

2. Setting up mkvmerge GUI3. Creating Matroska files

1. Basics2. Options for input files3. Options for each track4. Attachments5. Global options

1. File/segment title2. Automatic splitting and file linking3. Manual file/segment linking4. Chapters5. Global tags

6. Starting the merge process7. Saving and loading muxing settings8. Queueing several jobs

4. The chapter editor 1. Matroska's chapter concept2. Examples3. Chapter formats supported by mkvmerge

1. Simple/OGM style chapter files2. Full-featured XML style chapter files3. Chapters found in Matroska files

4. Creating chapter files5. Editing existing chapters

5. The header editor 1. Adding and removing header fields2. Opening an existing file3. Editing header fields4. Validation5. Saving the file

1. Introduction

1.1. What is Matroska?

(Note: simply copied from www.matroska.org.)

generated with http://html-2-pdf.com Page 1 of 16

Page 2: html-2-pdf

Matroska aims to become THE Standard of Multimedia Container Formats. It was derived from aproject called MCF, but differentiates from it significantly because it is based on EBML(Extensible Binary Meta Language), a binary derivative of XML. EBML enables the MatroskaDevelopment Team to gain significant advantages in terms of future format extensibility, withoutbreaking file support in old parsers.

If you need any more info please head over to Matroska's homepage.

1.2. What is mkvmerge? What is mkvmerge GUI?

mkvmerge and mkvmerge GUI (or just mmg) are two programs created by Moritz Bunkus. They'repart of the mkvtoolnix package. mkvmerge can read a lot of different multimedia files and put theircontents into Matroska files. Unfortunately this is a command line program, and not everyone iscomfortable working on the command line. This is where mkvmerge GUI comes into play. It is aGUI that provides the user with an intuitive but powerful interface to mkvmerge.

Both programs are available for both Windows and GNU/Linux and other Unix derivatives. Theprogram is licensed under the GPL, so the source code is available to anyone interested.

1.3. Obtaining the latest version

You can always find the latest version of mkvtoolnix on Moritz Bunkus' website. Windows userswill have to download the runtime DLLs as well as the mkvtoolnix binaries. Linux/Unix users willprobably download the sources and compile mkvtoolnix themselves.

1.4. Scope of this guide

This guide only focuses on the GUI part of these tools. All command line options are explained indetail in mkvmerge's man page/HTML page.

2. Setting up mkvmerge GUI

(Note: This section does not cover compilation and installation. mkvmerge's own documentationand the README files that are included in the mkvtoolnix package.)

Figure 1: Use this button to select the path to the mkvmerge program.

The only thing that mmg needs to know is the location of the mkvmerge binary. Under normalcircumstances it will be found automatically. But if not then you can select the binary to use onthe Settings tab.

3. Creating Matroska files

3.1. Basics

generated with http://html-2-pdf.com Page 2 of 16

Page 3: html-2-pdf

mkvmerge strictly differentiates between files and tracks. An input file usually contains one ormore tracks. mkvmerge needs at least one input file and the file name of the Matroska file itshould create before it can do any work. Starting with this minimal set of options the user can addmore input files, select advanced options for each track, apply some more global options etc.

The typical basic steps are:

1. Select some input files,2. set language options for the tracks,3. set the movie/file title,4. select the file to write to and5. start the muxing process.

Figure 2: Use these buttons to add and remove files.

When mmg starts up it shows the first and probably most important tab: the input tab . Here yousee four different elements. The topmost input box lists all input files. Directly under this box areoptions that apply to the currently selected input file.

Figure 2 shows the three buttons to the right of the upper list box that can be used to add files tothe list box with the add and append buttons and to remove the selected entry with the removebutton.

There is a difference between adding and appending a file. Normally, the tracks of all added filesare put into the resulting Matroska file in parallel. This is usually the case if you have e.g. a videotrack, one or more audio tracks and one or more subtitle tracks. They all contain material thatbelongs to the same timecodes and that has to be played simulatneously.

Appending a file on the other hand will cause all tracks of the second file to be appended totracks of a previously added file. That way the contents of those tracks will be played one afterthe other. You can only concatenate tracks that are of the same kind (video to video tracks etc),have the same codec (e.g. MP3 to MP3 but not MP3 to AC3) and the same parameters (e.g. thesample rate must match).

You can tell an added file from an appended one by looking at its name. Appended files andtracks start with "++>".

Figure 3: One enabled and one disabled track. The second track will not be copied into the output file.

generated with http://html-2-pdf.com Page 3 of 16

Page 4: html-2-pdf

Once the user has added at least one input file in the upper list box the second list box willcontains all available tracks. Each track is ENabled by default and will be muxed into theresulting file. However, you can change that by simply clicking on the check box right in front ofthe track's name in the second list box. This is shown in figure 3.

For each of these tracks the user can select track specific options with the input boxes and checkboxes below the track listing. These options will be described in the following sections.

To the right of the track list box there are two buttons with which you can control the order of thetracks in the output file. By hitting the up and down the currently selected track is moved in theappropriate direction. There are some restrictions to moving appended tracks around (the onesthat start with "++>") like an appended track must not be the first track etc.

3.2. Options for input file

Once the user has added and selected an input file he can set options that apply to this specificfile. At the moment three such options have been implemented, and they all are only available forMatroska files: No chapters, No attachments and No tags. These options tell mkvmerge not tocopy any chapters / attachments / tags from the current source file.

More information about chapters can be found in the section about the chapter editor in thisdocument and in mkvmerge's own documentation.

3.3. Options for each track

Depending on the type of the currently selected track (audio, video, subtitles) and evendepending on the contents of the track only a subset of all the track specific options are available.These options span over two sub-pages. There are general track options and format specificoptions.

Figure 4: Options common for all kinds of tracks

Note: Unless overridden by the user mkvmerge will either copy track settings from the input file ifthe source format supports such information, or it will use sensitive default values.

The available general options are:

Track name: The user can set a name for the current track. This name is a free-form string.Practical examples could be 'director's comments' or 'great view of Seattle'. Note that thesenames are not meant to contain the movie title!

generated with http://html-2-pdf.com Page 4 of 16

Page 5: html-2-pdf

Language: The user can select the language for each track regardless of its type. Thislanguage is coded in the ISO639-2 language code. The drop-down box contains allISO639-2 codes so the user does not have to worry about selecting the wrong languagecode.Cues: The cues are for Matroska what the index is for AVI files. They contain links to thekey frames. Usually this option should be left on the value 'default'. mkvmerge willautomatically chose the best method for any given track type. A full explanation of trackscan be found in mkvmerge's documentation.Make default track: Matroska knows a flag which tells the player that a specific trackshould be preferred upon playback if the user does not chose another one. Of course eachtrack type has its own default track - e.g. the default audio track is the English one, and thedefault subtitle track is the French one. If no track is set to be the default track thenmkvmerge will promote the first track of each type that it finds to be the default track. This isconsistent with the behavior of various media players.Tags: For each track you can create a XML tags file. For a full explanation of all tags pleaserefer to the example file and mkvmerge's own documentation. In probably 99% of all casesyou want to use THIS option and associate tags with a specific track. The tags option onthe global tab is probably not what you need.Timecodes: Normally mkvmerge will derive the timecodes for each frame from the sourcefile, but it can also read and use timecodes from an external text file whose name you canspecify here. This feature is a very advanced feature. Almost all users should leave thisentry empty.

Figure 5: Typical options for a video track

The format specific options include:

Aspect ratio: With this option the user can set the aspect ratio that should be used uponplayback. It defaults to the aspect ratio that the movie was encoded with but can bechanged, e.g. for anamorphic encodings. The GUI expects the format to be either a floatingpoint number (e.g. '2.33') or a fraction (e.g. '16/9'). Another possibility is to set the values for the display width and display height manually.This can come in handy if you want to adjust the parameters to a specific resolution. If youspecify the aspect ratio then mkvmerge will calculate the display dimensions based on thesize of the video track. This option is only available for video tracks.FourCC: Matroska does not normally store the Four-CC which is used in other containers toidentify the codec used. Matroska has its own format, called CodecID, but it also has an AVIcompatibility mode. In this mode the FourCC is also stored. With this option the FourCCcan be forced to a different value. However, you cannot change the CodecID used by

generated with http://html-2-pdf.com Page 5 of 16

Page 6: html-2-pdf

mkvmerge. This option is only available for video tracks.Stereo mode: There's a technology of providing pseudo three dimensional images byplaying back two video tracks that have been filmed from slightly different positionssimultaneously. Each eye only sees one of those tracks. This is called stereo mode. Mostusers should leave this empty. This option is only available for video tracks.FPS: Number of frames per second for AVC/h.264 video tracks. When you add AVC/h.264elementary streams then mkvmerge must be told which how many frames per second thisvideo was recorded with because that piece of information is not available in elementarystreams. If you don't select anything then mkvmerge defaults to 25. You can either enter afloating point number (e.g. 29.97) or a fraction (e.g. 30000/1001). This option is only available for AVC/h.264 video tracks read from AVC/h.264 elementarystreams.

Figure 6: Typical options for an audio track

Delay (in ms): In some cases audio and video are not synchronized properly. With thisoption the user can offset the timecodes of any track by a given amount, either positive ornegative. The number you enter here is the amount in milliseconds that is added to eachtimecode after the Stretch by factor has been applied (see below). This option is available for all track types. However, timecode adjustments work best forvideo and subtitle tracks during playback.Stretch by: In some cases audio and video slowly drift apart during playback. This can befixed by supplying a factor of how much the time codes should be stretched by mkvmerge. Ifnothing is entered then '1.0' is assumed which does not alter the time codes. The value you enter can either be a floating point number or a fraction, e.g. "1/2". The factoris applied before the Delay is added (see above). This option is available for all track types. However, timecode adjustments work best forvideo and subtitle tracks during playback.Subtitle charset: Some text subtitle formats do not store the charset that they werecreated with. This is important because text subtitles are automatically converted to theUTF-8 charset during muxing. mkvmerge will normally assume that the system's currentcharset is the same that the subtitle file was written in. But in case this is not true the usercan select the correct charset. This option is only available for text subtitle tracks.

generated with http://html-2-pdf.com Page 6 of 16

Page 7: html-2-pdf

Figure 7: Typical options for a text subtitle track

Compression: Matroska features a powerful system for compressing tracks with losslesscompression algorithms. Those compressions can be applied to any given track, but someplayers only support this for VobSub tracks. This is where it's most useful. Other tracks,especially audio and video tracks, are already compressed so that additional compressionwill not yield any result. For VobSubs you can achieve an additional gain of about 30% ifyou enable zlib compression. That's why it is the default for VobSub tracks. You should just leave this setting at default .AAC is SBR/HE-AAC/AAC+: The new technology called 'high efficiency AAC' has somedrawbacks when it is being stored in .AAC files: it is not possible to detect the HE-AAC partfor these files. Therefore the user has to check this option manually if it applies. Please notethat this problem does not exist for HE-AAC stored in .MP4 files.

3.4. Attachments

Matroska files can also contain other files, called attachments. This works basically just like withyour favorite email program. The idea is to provide additional information about the file. Someexamples could be cover photos for a CD rip, additional background information in text formabout the movie or even some compressed fonts for the subtitles.

Every attachment needs two things: the file name (obviously) and the MIME type that should beassociated with the file. The usage is very easy and similar to adding files on the input tab.

Figure 8: Add and remove attachments with these buttons.

On the second tab of the GUI, the attachment tab, you can add a file with the + button andremove the selected attachment with the - button. Once an attachment has been selected theother controls on this tab will be available. You do have to select a MIME type for eachattachment, but the description is optional - although it is a good idea to always provide adescription. This makes it easier for others to identify what you've attached to this Matroska file.

generated with http://html-2-pdf.com Page 7 of 16

Page 8: html-2-pdf

Figure 9: Typical options for an attachment

The last option, attachment style, is only evaluated when you also split the output into severalfiles. (Splitting in general is explained in the following section.) If the option To all files isselected then the current file will be attached to all output files created. If the option Only to thefirst is selected then the file is only attached to the very first output file created.

3.5. Global options

The third tab, Global , is packed full of options that apply to the complete file and not just to one ormore tracks.

3.5.1. File/segment title

Figure 10: Selecting a title for the movie

File/segment title: This title is used for the actual movie title, e.g. 'Vanilla Sky'.

3.5.2. Automatic splitting and file linking

The Split section handles how the output file is split into several smaller files. If no splitting isselected then only one big file is generated. If splitting is activated then you can tell mkvmerge tostart a new output file after either a specific amount of data has been written to the current file orafter a specific timecode has been reached. The accepted formats are:

For the size: A number optionally followed by the letter 'K', 'M' or 'G' indicating kilobytes(1024 bytes), megabytes (1024 * 1024 bytes) or gigabytes (1024 * 1024 * 1024 bytes).Examples: '700M' or '100000K'.For the time: The format is either HH:MM:SS.nnn with up to nine digits for up to nanosecondprecision or a number followed by the letter 's' indicating a number of seconds. Severaltimecodes can be entered separated by commas.Please note that the timecodes refer to the unsplit output stream. Therefore entering'00:10:00,00:20:00' will result in three files of which the first two will be roughly ten minuteslong. The third piece will contain the rest of the input stream. This is independant of the 'filelinking' feature.Examples: '01:20:00' (split after 1 hour, 20 minutes) or '1800s' (split after 1800 seconds = 30

generated with http://html-2-pdf.com Page 8 of 16

Page 9: html-2-pdf

minutes).

Figure 11: Typical options for splitting. Create two files which will be approx. 700megs big.

Don't link: This option controls how mkvmerge will handle splitting. A little explanation aboutthis feature:

Matroska supports file linking which simply says that a specific file is the predecessor orsuccessor of the current file. To be precise, it's not really the files that are linked but the Matroskasegments. As most files will probably only contain one Matroska segment I simply say 'filelinking' although 'segment linking' would be more appropriate.

Each segment is identified by a unique 128 bit wide segment UID. This UID is automaticallygenerated by mkvmerge. The linking is done primarily via putting the segment UIDs of theprevious/next file into the segment header information. mkvinfo prints these UIDs if it finds them.

If a file is split into several smaller ones and linking is used then the time codes will not start at 0again but will continue where the last file has left off. This way the absolute time is kept even ifthe previous files are not available (e.g. when streaming). If no linking is used then the timecodes should start at 0 for each file. By default mkvmerge does not use file linking because someplayers still don't handle linked files properly. If you want linking that you can turn it on byenabling this link files check box.

3.5.3. Manual file/segment linking

Regardless of whether splitting is active or not the user can tell mkvmerge to link the producedfiles to specific UIDs. This is done by entering a valid segment UID into the two input boxes,Previous segment UID and Next segment UID. These options accept a segment UID in the formatthat mkvinfo outputs: 16 hexadecimal numbers between 0x00 and 0xff prefixed with '0x' each andseparated with spaces, e.g. 0x41 0xda 0x73 0x66 0xd9 0xcf 0xb2 0x1e 0xae 0x78 0xeb 0xb40x5e 0xca 0xb3 0x93. Alternatively a shorter form can be used: 16 hexadecimal numbersbetween 0x00 and 0xff without the '0x' prefixes and without the spaces, e.g.41da7366d9cfb21eae78ebb45ecab393.

If splitting is used then the first file is linked to the UID given in the Previous segment UID inputbox, and the last file is linked to the UID given in the Next segment UID input box. If splitting is notused then the one output file will be linked to both of the two UIDs.

3.5.4. Chapters

With the browse button you can select the chapters to add to the output file. A full explanation ofall aspects around chapters can be found in the Chapter editor section.

3.5.5. Global tags

generated with http://html-2-pdf.com Page 9 of 16

Page 10: html-2-pdf

Unlike the tags you can select for each track on the input tab the tags selected here have tocontain the track UIDs. These tags are not assigned to any track automatically. In 99% of allcases this is NOT the option you want to use!

The full explanation can be found in mkvmerge's documentation.

3.6. Starting the merge process

Once everything has been set up the muxing process can be started. The last thing to do is tochose where to mux to. With the browse button you can select the output file. After this has beendone hit the Start muxing button or select the same entry from the Muxing menu.

If everything has been set up correctly mmg will show the muxing dialog. The progress is shownat the top, as is a general description of what mkvmerge is doing at the moment.

Figure 12: The muxing window

mkvmerge knows three different 'severity levels' for its messages: status reports, warnings anderrors. All status report messages are shown in the upper window. These include the track typesencountered and other interesting things.

Warnings are shown in the middle window. mkvmerge will not abort when it issues a warning,but it might stop muxing the track for which the warning was printed. You should pay closeattention to all warning messages.

Errors are show in the lower window. Errors are always fatal, and mkvmerge will stop muxingright after it has printed the error message. Such a message might be that the hard disc is full or

generated with http://html-2-pdf.com Page 10 of 16

Page 11: html-2-pdf

that the source file is damaged and cannot be processed any further.

The button Abort sends mkvmerge the signal to stop muxing. Unless mkvmerge is stuck in someendless loop it will stop soon after you've pressed the button. With Save log you can save thecomplete output from mkvmerge into a text file for further study or in case you've encountered abug and want to send me some additional information.

3.7. Saving and loading muxing settings

All your hard work of setting options does not have to be lost when you exit the program. You cansave all your muxing settings into text based configuration files with the Save settings option inthe File menu and restore them later with the Load settings option. The default extension is.mmg and is usually not used by other programs. You can also associate this extension with mmgso that it automatically loads the settings if it is called with the name of such a settings file.

3.8. Queueing several jobs

For the case that you have several files that you want to mux you don't have to prepare the firstfile, wait for it to finish muxing, prepare the second, wait for it to finish muxing etc. mkvmerge GUIcontains a job manager which can queue complete jobs and run them one after another at yourconveniance. The basic steps when using the job manager are:

1. Add all files, set all the options, set the output file name.2. Hit the Add to job queue button and select a title that this job will be referred under.3. Repeat as often as wanted.4. Bring up the job manager window by selecting Manage jobs from the Muxing menu.5. Hit the Start button.6. Get something to drink, go shopping or talk to your significant other ;)

Figure 13: The job management dialog

Each job has six attributes: an ID which is automatically chosen my mkvmerge GUI ; its status(pending - it hasn't been muxed yet, done - muxing has completed successfully, done with

generated with http://html-2-pdf.com Page 11 of 16

Page 12: html-2-pdf

warnings - muxing has completed successfully but there were warnings, failed - the muxingprocess failed); the name that you've entered before; the time and date on which the job wasadded to the job queue; the time and date when the muxing process was started for this job andthe time and date when the muxing process finished.

The general controls are located at the bottom. The Start button will start the muxing process forall jobs whose status is pending. The Start selected button will start the muxing process for alljobs that are currently selected independent of their status.

The buttons on the right manipulate all selected jobs. The Up and Down move the selected jobs upand down in the list. The Re-enable button sets the jobs' status to pending so that they will bestarted the next time the Start button is pressed. The Disable button will set the status to done.

During the muxing process mkvmerge's output will not be shown but saved. If you want to see ajob's output you can hit the View log button. This is useful if a job completed with warnings or if itfailed completely.

4. The chapter editor

One of the new features of mmg is a full-featured chapter editor. It can read text based chapterfiles, import chapters from existing Matroska files, write text based chapter files that can beselected on the global tab and write chapters directly to existing Matroska files.

4.1. Matroska's chapter concept

Unlike a lot of other systems Matroska supports nested chapters. This basically means that youcan define sub chapters for chapters.

A chapter entity in Matroska consists of at least four items: The UID of the track(s) it applies to,the chapter title/name, it's start time and the language code associated with it. Additionalelements are optional and include the end time, more language codes and country codes.Usually the user will only need the mandatory elements. Of these he can only specify the name,the start time and the language code. mkvmerge will then automatically assign all chapters to thecomplete file.

4.2. Examples

The first example is a simple one. The movie in question contains four parts: The intro starting atthe beginning, the first act, the second act, and the credits. Note that the end timestamps areoptional.

Intro (from 00:00:00, language English) Act 1 (from 00:01:00, language English) Act 2 (from 00:05:30, language English) Credits (from 00:12:20 until 00;12:55, language English)

A more complex example including sub chapters. Let's take Ludwig van Beethoven's operaFidelio. For the sake of brevity I'm only including the first three pieces of the two acts.

The first act contains:

1. Overtüre (6:24 long),

generated with http://html-2-pdf.com Page 12 of 16

Page 13: html-2-pdf

2. Arie: 'Jetzt, Schätzchen, jetzt sind wir allein' (4:46 long) and3. Dialog: 'Armer Jaquino' (0:10 long).

The second act contains:

1. Ouvertüre und Arie: 'Gott! welch Dunkel hier!' (10:46 long),2. Melodrama und Duett: 'Wie kalt ist es' (5:21 long) and3. Dialog: 'Er erwacht!' (0:59 long).

The first act, which will be our first chapter, has a combined length of 11:20. Our second act has alength of 17:06. These chapters would look like this:

Erster Akt (from 00:00:00 until 00:11:20, language German, country Germany) Ouvertüre (from 00:00:00 until 00:06:24, language German, country Germany) Arie: 'Jetzt, Schätzchen, jetzt sind wir allein' (from 00:06:24 until 00:11:10,language German, country Germany) Dialog: 'Armer Jaquino' (from 00:11:10 until 00:11:20, language German, countryGermany) Zweiter Akt (from 00:11:20 until 00:28:26, language German, country Germany) Ouvertüre und Arie: 'Gott! welch Dunkel hier!' (from 00:11:20 until 00:22:06,language German, country Germany) Melodrama und Duett: 'Wie kalt ist es' (from 00:22:06 until 00:27:27, languageGerman, country Germany) Dialog: 'Er erwacht!' (from 00:27:27 until 00:28:26, language German, countryGermany)

4.3. Chapter formats supported by mkvmerge

mkvmerge and mmg's chapter editor both support different formats for chapter files.

4.3.1. Simple/OGM style chapter files

One of the most basic formats is the format used in OGM files. It is a text based format. Eachchapter entry contains of two lines, the first containing the start time, the second the chapter'stitle/name. All lines are numbered.

The first example from above can be expressed in this format:CHAPTER01=00:00:00.000CHAPTER01NAME=IntroCHAPTER02=00:01:00.000CHAPTER02NAME=Act 1CHAPTER03=00:05:30.000CHAPTER03NAME=Act 2CHAPTER04=00:12:20.000CHAPTER04NAME=Credits

The second example cannot be expressed in this format because it supports neither languagespecifications nor end times or nested chapters. The advantage is that such files are very easy tocreate, and there are several tools available for both Windows and Unix/Linux that create suchfiles directly from DVDs.

Due to its limitations mmg cannot output chapters in this format.

4.3.2. Full-featured XML style chapter files

I've created a XML based chapter format that closely matches the system Matroska uses. With

generated with http://html-2-pdf.com Page 13 of 16

Page 14: html-2-pdf

this format you have the full control over all features. I won't describe this format here in detail.Please have a look at the example XML chapter files that came with mkvtoolnix .

4.3.3. Chapters found in Matroska files

The chapter editor can read chapters directly from Matroska files. These can be written to XMLchapter files or back to the same Matroska file or another Matroska file. All features aresupported.

4.4. Creating chapter files

The chapter editor consists of three parts: the tree view of all chapters, the four buttons used foradding and removing chapter entries, and the input boxes which are used for setting the chapterentry's data.

Figure 14: The chapter editor showing the example from above

In Matroska files one chapter is defined by having a start time, a name and a language that isassociated with that name. You can have several names for one chapter and each associatedwith a different language. You may also add an end time, but that is not mandatory.

A new chapter file is started with the New option from the Chapter editor menu. You can add anew chapter with the Add chapter or Add subchapter buttons. The difference between these twobuttons is that when a chapter has been selected Add chapter will append a new chapter directlyafter the selected chapter on the same level, and Add subchapter will add a new chapter as thelast child of the currently selected chapter.

generated with http://html-2-pdf.com Page 14 of 16

Page 15: html-2-pdf

The Remove chapter has to be used with care. It removes the complete subtree without asking forconfirmation, and there is no undo option available at the moment.

After selecting a chapter entry you can change its data. The format for the start and end time areeither HH:MM:SS.mmm or simply HH:MM:SS. One chapter name will already have been added. Youcan edit it and select the language that this name is given in. This way you could provide namesin several languages, e.g. 'The hero arrives' with 'eng' as the language and 'Der Held kommt an'with 'ger' as the language. Just hit the Add name button if you need more entries and Remove namein order to get rid of one.

Creating many chapters and always changing the language can be quite some work. Thereforeyou can select which language and country tags mmg should add by default with the Setdefault values menu entry in the Chapters menu. The Set values button does somethingsimilar. With it you can apply a language and/or country to the currently selected entry and all itschildren.

Saving chapters to XML files can be done with Save or Save as. Save as cannot be used to writechapters to an existing Matroska file - you'll have to use Save to Matroska file for that.

4.5. Editing existing chapters

You can load existing chapter files or chapters from Matroska files by selecting the Load optionfrom the Chapter editor menu. mmg will automatically detect the file type used and read thechapters.

5. The header editor

mmg features an editor for header fields of existing Matroska files. It can be started from mmg's"File" menu by chosing the "Header editor".

The header editor allows the user to edit certain fields of the segment information headers and ofthe headers of each track without having to remux the whole file. Its usage is simple: load a file,select the header fields you want to change, change its value, and save the file.

5.1. Adding and removing header fields

The Matroska file format allows for most header fields to be present or absent. mmg's headereditor will show inputs for all header fields it supports even if they're currently not present in thefile. It allows the user to add fields that are currently not present to the file and to remove currentlypresent fields from the file.

5.2. Opening an existing file

The user can start editing a file by chosing "Open" from the "File" menu. After selecting theappropriate file the header editor will scan the file for all important elements. This can take sometime depending on the file's size. This is neccessary due to Matroska's flexible file structure.

5.3. Editing header fields

After opening the file the left pane will show one element for the segment headers and oneelement for each track that is found in the file. Each node in the tree contains a number of sub-

generated with http://html-2-pdf.com Page 15 of 16

Page 16: html-2-pdf

elements which represent the actual header values. When the user selects such a sub-elementthe right pane is updated to show a number of facts about the element:

its type (a number, a string etc),its name,a short description of its contents,whether or not the element is currently present in the file including an option to remove it if itis or to to add it if it isn't,the element's original value if it was present when the file was opened anda control to modify its content.

Most value types are self-explanatory: numbers, strings etc. The binary type however is shown asa sequence of hex digits. The accepted formats are the same as mkvmerge's various options forspecifying segment UIDs: either a simple sequence of hex digits (e.g. 1857a7fe7d...) or the hexnumbers prefixed with "0x" before each pair (e.g. 0x18 0x57 0xa7 0xfe 0x7d...).

5.4. Validation

The user can validate your changes by chosing "Validate" from the "Headers" menu. Validationis also run automatically each time the user wants to save the files. Validation makes sure thatthe values the user supplied can be stored in the element in question. For example a numberelement must not contain characters.

If validation fails then the first element failing validation is selected so that the user can correctthe mistake.

5.5. Saving the file

The user can save the changes by selecting "Save" from the "File" menu. If no changes havebeen made then mmg will say so and not modify the file.

Before modifying the file mmg check if the file has been modified by another application since ithas been opened. If this is the case then mmg warns the user, discards all changes and reloadsthe file in order to ensure that the file will not be corrupted.

mmg tries very hard to find suitable spots for writing the modified headers. It will overwriteexisting header elements at their original position, EbmlVoid elements and all other instances ofthe headers it finds. It will also update the meta seek heads so that the headers can be foundeasily by applications reading that file.

After saving the file the header editor will automatically reload and analyze it again. This is doneto ensure that no file corruoption occurs. As it slows down the process of saving the fileconsiderably this safety feature will be removed in a future release of mmg after enough testinghas been done.

generated with http://html-2-pdf.com Page 16 of 16