101 things you never knew you could do with Matroska

Today on the Fluffy Channel: magic tricks with the Matroska container. Namely, editions, file linking and ordered chapters. (Warning: very large amounts of techobabble walls of text ahead.)

These are easily some of the most (if not the most) obfuscated features of the format; a few people know how to use them (and it has been used in one or a few releases) but absolutely noone has written any simple guides to it (hence this blog post). Which is a pity, because it’s an immensely powerful feature. To start off, why would you want to hack XML files and play with obscure hexadecimal segment ID’s? Well, with the above features you can do things like:

  • Make any combination of audio/video/subtitle tracks into one choice in the track selection menu (useful to change between dub/original+sub in one click)
  • Create chapters-only Matroska files that when played display a virtual timeline pulling video/audio/subtitles from other Matroska files
  • A practical implementation of the above might mean that you encode the OP of a TV series only once and then use chapters to get it inserted into the timeline of each episode
  • Let the viewer choose between multiple “angles” or versions of the video (said versions may or may not be in the same file)
  • Arbitrarily link MKV files or parts of MKV files so that they appear to the viewer as a whole
  • And so on and so forth.

For this exercise, you will need: a) the latest version of mkvtoolnix, b) the latest version of Haali’s Matroska splitter (or just latest CCCP), c) your favorite text editor (never leave home without it) – preferably one with XML syntax highlighting, and d) a brain (in good working condition, fully awake). Let’s boldly go, etc.

File (or Segment) Linking and Segment UID’s

All of these concepts tie into each others somewhat, but linking is probably the most simple to understand, as well as the simplest to accomplish. Any combination of Matroska files with the same set of tracks and the same codecs can be linked so that when any one of them is opened, a virtual file containing the entire timeline of linked files is created and displayed to the viewer. The most common usage of this is to encode a full-length movie into one 1.4 GiB file and then split it into two 700 MiB parts that, when one of them is played, behave as if it contained the entire movie in one file. This simple use of the feature is very easy to accomplish; in mkvmerge GUI (henceforth known as mmg) just hit the Global tab and enable splitting in whatever form you want and make sure to tick the box “link files”.

If you look further down in the same tab you’ll notice that there’s an option for “File/segment linking”. This feature lets you link the muxed file to any two other files (with the same set of tracks and codecs used). Anyway the option asks you for something called a Segment UID. What is that, where do we find it and how do we use it?

First of all, I have to let you in on a dirty secret. File linking isn’t actually file linking at all, since the linking isn’t done by files or by filenames. It’s actually segment linking, and it’s done by segment Unique Identifiers or “segment UID’s” (SUID’s). Most Matroska files contain only one segment, but there’s absolutely nothing that stops you from having more than one segment per file. When the splitter looks for linked files, it just scans all Matroska files in the same folder until it finds the linked segment UID; hence you can rename the files all you want and the linking will still work. On the other hand you can’t remux the files because that changes the UID.

So how do we know what segment UID we should link to? The answer is, we use mkvinfo on the file we want to link to. You can use the GUI or the CLI, what you’re looking for is something like this:
Segment UID: 0xa2 0xa6 0xa2 0xa7 0x45 0x22 0x6b 0x85 0x85 0xd4 0x75 0x5e 0x6c 0xf4 0x67 0x60
You then copypaste that string of hexadecimal digits (everything after the colon) in the boxes in mmg to do the linking.

If you had a TV series that always had the opening theme as the first thing of each episode, this means you could encode the OP as a separate file, chop it off from all the actual episodes, and then use linking to link in the OP as “previous segment” to all the episode files. Which would mean that to a user with the proper splitter all the episodes would appear to have the OP encoded in, but in reality it’s actually only encoded once and stored in a separate file. Nifty, you think? You haven’t seen a tenth of it yet. Read on…

Chapters, Black Magic Style: Ordered Chapters

Some of you may have used the simple (OGM-based) chapters format before, but that won’t suffice for what we want to do here, so let’s take a look at an example of a Matroska XML chapters file: chapters-example.xml
This section and the following ones will involve a lot of hacking of these in a text editor; you can either create them yourself by hand or you can use mkvextract chapters "file.mkv" > chapters.xml to extract them from existing MKV files (you can then use that as a template for further hacking).

Anyway, the first thing you’ll notice is that the big tag enveloping all the chapter entries (<ChapterAtom>) is the <EditionEntry> one. If you want multiple editions in the same chapter file, you will need more than one of these (we’ll get to this later). The rest is fairly straightforward, you have an unique chapter ID (automatically generated, but you can edit it yourself too), a start time (i.e. where your video player seeks when you click “go to this chapter”), and some display stuff (what will show up in the splitter menu). You’ll also notice that you can hide chapters so they don’t show up in the menu. Personally I’ve never used that particular feature.

You can also look at the XML in the mmg Chapter Editor to get a nice tree-view of all the tags. It also prevents you from writing invalid syntax, and creates chapter UID’s for you automagically so using it may be a good idea, but I’m far from sure it supports all the interesting features we’re going to use (it doesn’t support ordered chapters or segment linking at all for example) so I’m going to stick with my trusted text editor.
Update: Harukalover mentions that avimux GUI has a surprisingly good editor for this.

So what’s so interesting about this? It’s just chapters, isn’t it? Well, there are some tags you can add yourself to make things more interesting, the most important being <EditionFlagOrdered>1</EditionFlagOrdered>. This turns on heavy magic mode and turns our plain old chapters into ordered chapters, which are quite different. Normal chapters are just seek points; ordered chapters are a description of a virtual timeline. Each ordered chapter has both a start time and an end time. To help you understand this concept, let’s do something silly with ordered chapters. Say that we have a 30 second clip that we want to loop 3 times, but to save space we only want to encode it once. Ordered chapters to the rescue! orderedchapters-example.xml

Take a look at the example. First off, ordering is turned on by setting the edition flag. Then, the section of the file given by ChapterTimeStart to ChapterTimeEnd is played once per ChapterAtom (note that both ChapterTimeStart and ChapterTimeEnd are mandatory). Note that the two last chapters are hidden so they won’t show up as seek points in the splitter. See the virtual timeline? When this is played, the viewer will just see one 1:30 long clip. Mux it for yourself and see; any input file will do, it just has to be longer than 30 seconds or weird things may happen (also make sure to tick “no chapters” in mmg).

To reiterate the virtual timeline stuff (this is important): normally when you play a file it plays all the encoded stuff within, from start to end (the “real timeline”. With ordered chapters on the other hand… instead of the splitter displaying the real timeline to the viewer, a virtual timeline is constructed from the real one. What is played when is determined by the chapter start and end points (which refer to the real timeline). To the viewer, it appears as if the virtual timeline is the real one, but internally the splitter seeks to the given points in the real timeline to construct the virtual one.
(You may want to read the above paragraph more than once.)

Ordered Chapters and Segment Linking

Now that we understand the virtual timeline, how about this linking stuff from other files thing we’ve been hearing about? Well, that can be done too and it isn’t too hard. Ordered chapters are not limited to creating the timeline just from the current file, you can also specify that a given chapter should use a certain part of another file, specified by its segment UID. It’s not hard, really. Say that in the example before we wanted the middle of the three iterations to be taken from another file (presumably containing something else). orderedchapters-example2.xml

See what I did there? Just add <ChapterSegmentUID format="hex"> followed by the SUID you want to pull in things from (0x before each hex digit optional) and blammo, you have linked in stuff from another file. Not specifying a ChapterSegmentUID means that the current segment will be used.

You can mux this yourself to any file and see what happens too, you just need to replace the SUID with one pointing to another of your MKV’s in the same folder. Just make sure that both of them have same number of tracks in the same order and that they all are using the same codecs. Also make sure to tick “no chapters” in mmg or weird things can happen.

Editions and You

In Matroska, an edition is a set of chapters that is presented to the viewer; you could define it as a “timeline”. Most Matroska files (and indeed most if not all other multimedia files) only has one edition. However, Matroska isn’t limited to just one edition per file, you can have as many as you want. By itself it doesn’t have any immediately obvious uses other than the fact that you could abuse it to have several sets of chapter names in different languages, but if you combine it with ordered chapters things become very interesting. Among other things, it means you can have several virtual timelines co-existing in the same file; the viewer can (if he has a proper splitter (i.e. Haali’s)) choose between them as he wishes.
Update: Haali pointed out to me that you can actually have multi-language chapters without editions; by default the language matching the system’s default language will be displayed.

Ever wanted to have two versions of an opening theme and letting the viewer choose between them seamlessly? With editions you can. Encode both versions of the opening and the rest of the episode or what-have-you to one file (order doesn’t matter). Now create two ordered chapters files, one for each timeline (one for op1 + main episode, one for op2 + main episode). Then you combine them using your trusted text editor by adding another <EditionEntry>, like so: orderedchapters+editions-example.xml

Note that there are now two <EditionEntry> tags, each with its own set of chapters and hence each with its own timeline. When played, regardless of which edition is chosen (it will default to the first, see the <EditionFlagDefault> flag) will appear to be a clip that is 4 minutes long, the first 30 seconds being identical, the next 60 differing and the last 180 being identical again. If you look at the XML, you will notice that the first edition/timeline will play the source file like this: [chapter point] 30s [chapter point] 60s [chapter point] JUMP to 02:30, 180s.
The second edition on the other hand looks like this: [chapter point] 30s [chapter point] JUMP to 01:30, 60s [chapter point] 180s.

As usual you can test-mux my sample XML with any MKV longer than 5 minutes (remember to tick “no chapters”) and see what happens.

For added confusion and/or awesomeness you can of course combine editions with segment linking in the ordered chapters, so you can have one (or both) of the openings in a separate file(s). This may actually be a good idea to avoid making things difficult for people without proper splitters (such as MPlayer users on *nix for example). For bonus points, combine ordered editions with unordered ones.

Sky’s the Limit: Advanced Haxing etc.

You might have noticed that in the previous example that the editions showed up as Edition 1 and Edition 2. Not too descriptive, is it? Well, you can name them too, but it isn’t so easy as to just adding something to the chapters XML file. Instead you have to add a tags file as well. This is XML too, and it would look something like this for the previous example: tags-example.xml

Just set the EditionUID in the Targets tag to the UID of the edition you want to change the name of, and then set the String to the name of it. Note that the Name tag is actually the name of the tag itself (must be TITLE to make anything show up) and not what will actually show up in the splitter menu.

Another potentially interesting thing you can do with ordered chapters is to create small chapters-only files that when played show an entire TV series as one single long virtual file. Just create a 5 or 10 frames long blank video with the same settings that you’re using for the rest of the series, with corresponding audio and subtitle tracks, create ordered chapters file with segment linking, mux, and blammo 50 KiB file that when played display as a 5 hour long TV series. Of course you can include editions in it as well for added awesomeness.

Yet another opportunity: tracksets. This is actually not included in the Matroska specs, it’s just a feature of Haali’s splitter. By abusing the tags file you can set and/or disable/enable combinations of tracks when a certain edition is selected. Hello, multi-language stuff! To use, add a tag with the Name set to TRACKSETEX, and the String value set to: EditionUID VideotrackUID AudiotrackUID SubtitletrackUID Three-letter_language_code Optional_name
No Target is necessary. Setting any of the track UID’s to “.” (a dot, full stop, whatever; without quotes) means “don’t change”, setting the subtitle track UID to “x” (lowercase letter X; again without quotes) means “disable subtitles”. When the edition given by the EditionUID is activated, the given set of tracks will be chosen. The track UID’s can be found with mkvinfo. If you’re too lazy for that you can also just specify track numbers if you say # before the number.
Example for the same sample as before: tags-trackset-example.xml

Note that since you can’t remux a file without changing the SUID, it might be worth to know that there’s a feature in mmg’s chapter editor that allows you to write chapters straight into an MKV file without remuxing it; it can be found under the Chapter Editor menu -> Save to Matroska file. Don’t do it to a file that already has chapters or you may get weird issues though.
Update: This is slightly incorrect; Haali’s GDSMux (comes with the splitter package and with the CCCP) lets you specify the SUID yourself, so if you use that you can remux while keeping it.

Caveats, Assorted Traps and Various Interesting Things to Note

  • Make sure all your various UID’s really are U or you’ll run into trouble. (They must at the very least be unique to the set of files/segments you’re working with.)
  • Never try to add ordered chapters to a file that already has chapters (ordered or not). Always tick “no chapters” when remuxing, just to be safe!
  • Remember that the virtual timeline created by ordered chapters replaces the ordinary timeline; if there is a part of the source video that is not covered between your ChapterTimeStart/End’s, that part will never be displayed to the user at all (might be useful for hiding easter eggs in your releases).
  • On a related note, remember that all ChapterTimeStart/End’s refer to timestamps of the underlying segment. If the underlying segment is VFR, this means you must take the timestamps after the timecodes have been applied! One method of doing this is using Aegisub with timecodes loaded, another is to demux the v2 timecodes and amuse yourself by counting frames and matching them to line numbers.
  • If a subtitle line spans an ordered chapters segment switch point, there will probably be artefacts and/or other problems. So don’t do that.
  • Likewise, there may be audio artefacts during such switch points under certain circumstances, so try placing the switch points where the audio is either silent or has a lot of noise going on.
  • The requirement that the linked segments have the same sets of tracks and codecs used has a few caveats; similar settings has to be used as well. To be precise, the CodecPrivate header has to be the same (update: this may not be so strict after all, YMMV). Usually if something is encoded with the same settings, it will be, but your mileage may vary. See Haali’s codecs list for more information.
  • Related to the above, if you want to have different editions with or without certain audio and/or subtitle tracks, remember that you can abuse silent audio tracks and/or subtitle tracks without any actual lines to satisfy the track number/codec requirement.
  • Still related: for the commonly used subtitle formats S_TEXT/ASS and S_TEXT/SSA, the entire [v4 Styles] section is stored in the CodecPrivate header, so if you use ordered chapters and softsubs, all styles you use have to be present (and identical) in all subtitle tracks.
  • Since the timelines of all ordered chapters are taken directly from the underlying source timeline, to get subtitles to synch you need to make sure they synch with the “real” timeline.
  • If you’re using x264 to encode, you can force certain frames to be I-frames even if they normally wouldn’t be by manipulating the stats file, which may be interesting for handling virtual timelines efficiently. (Hint: if you seek to somewhere that isn’t an I-frame, for the seek to take effect you need to decode everything from the last I-frame to the sought frame, and virtual timelines are all internally constructed by seeking. Translation of the hint: you might get “hiccups” when going over chapter switch points if the chapter doesn’t start on a keyframe.)
  • You can also do the same with XviD if you are so inclined, by using zones.
  • While the video resolution of all the included segments has to be the same, the DAR (display aspect ratio) does not necessarily have to be. This has interesting implications for stuff that changes AR somewhere in the middle. (Player support for changing AR mid-stream may vary a lot, test thoroughly before using.)

Acknowledgements

The author would like to thank the following people and/or entities (in alphabetical order):

  • #darkhold
  • Haali
  • Harukalover
  • Kaverin
  • Nicholi
  • Phar
  • Unearthly

Without them, this guide probably wouldn’t be here.

References

None.

Or, OK, well, if two or three doom9 forum posts by Haali and some random #darkhold logs count as references then I guess…

See http://forum.doom9.org/showthread.php?t=99489 for the thing that started it all.
See the mkvmerge documentation for information on the XML chapter and tags file formats.
See Haali’s page for the TRACKSET/TRACKSETEX details.

Comments (42)

  1. Harukalover wrote:

    Good job with another useful guide.

    As you said mmg’s chapter editor is pretty light for this kind of work. But I’ve found avi-mux gui to be pretty good for this kind of work.

    It supports making multiple editions and noting whether one is ordered. Also outputs tags for you. It even allows you to setup segment ids for linking. (note: the 0x is not optional in avimux gui and must NOT be used)

    Just be sure to save the chapters as xml for mkvmerge and not as the default mkc format.

    Monday, December 17, 2007 at 01:09 #
  2. sSs wrote:

    So i heard that one of these days you’re going to make a couple of AMVs using only CHAPTERz and a few raw clips in a single mkv file ?
    You know… JUST TO SHOW THOSES FUCKERS HOW THINGS ARE SUPPOSED TO BE DONE…

    Monday, December 17, 2007 at 19:33 #
  3. TheFluff wrote:

    sSs: One of these days, one of these days. (read: never, hurr)

    Harukalover: nice tip, included in the guide.

    Monday, December 17, 2007 at 20:34 #
  4. Anarchy wrote:

    Very nice guide and d00d I just added this blog to my favorites so keep it up you got readers!!! ^__^

    Wednesday, December 26, 2007 at 00:08 #
  5. SirCanealot wrote:

    This explodes my brain!!!!!

    Friday, January 4, 2008 at 23:55 #
  6. keije wrote:

    Awesome guide, but I’ve hit a snag with the simplest thing…

    I have two files, I get the UID’s of each using mkvinfo, now I want to link them. I open up file1 (in mmg) and set link to next as the UID of file2 and then remux. Now I have file1 linked to file2, but according to the guide it changes UID of file1. Now repeat same procedure for file2 (with new UID of file1), upon remux the UID of file2 changes, so now I have file2 linked to file1, but file1 no longer linked to file2. A vicious circle ensues.

    So how do I update the information “File/segment linking” section of mmg without remuxing the mkv and changing UIDs?

    Tuesday, January 22, 2008 at 06:09 #
  7. TheFluff wrote:

    You have a few options:
    – remux with GDSMux instead
    – concatenate the files with mmg, then use the split feature and tick “link files”
    – use ordered chapters to do the linking instead (you can hide the mid-point chapter if you want to)

    Monday, January 28, 2008 at 22:36 #
  8. del wrote:

    Er, sorry for being noob, but where are GDSMux located? I have the splitter package, but I have no clue where it is. Could you please answer it?

    Wednesday, February 27, 2008 at 20:00 #
  9. del wrote:

    Oops! I pick the wrong one. Sorry. I found it. Thanks for your guide.

    Wednesday, February 27, 2008 at 20:09 #
  10. martino wrote:

    “Just create a 5 or 10 frames long blank video with the same settings that you’re using for the rest of the series, with corresponding audio and subtitle tracks…”

    You don’t actually have to in regards with the video as I’ve noticed. You can easily create a 704×400 video file and order a 1280×720 encoded (for example) series/whatever in it. Same codec was used though, or at least I’ve not tried it with different ones but I’d assume it wouldn’t work.

    Friday, May 2, 2008 at 00:50 #
  11. Nagato wrote:

    Thanks for the guide.
    I have some questions (very very n00b questions maybe) about chapter point.
    Is it possible to use frame number instead of time for chapter start & end?
    Then, how you get the time for chapter start time from the keyframe you specified as chapter point (as showed in virtualdub/other programs?).It’s needed to shift (add) the time slightly?

    OK, next question, what is the safest method to edit stats file? I got this error message in the 2nd pass encoding logs, using the edited 1st pass stats file.
    “x264 [error]: slice=P but 2pass stats say B”
    Changing a (say) B-frame to I-frame might change the type of other frame as well?

    Thursday, May 8, 2008 at 21:25 #
  12. martino wrote:

    As far as I’m aware you cannot use frame numbers, so you need to put in the timestamps. Just open the video in VirtualDub, scroll to the frame which you want to chapter, and copy over the time. Just make sure that the timestamp format is the same as the XML chapters require it. Not sure what you exactly mean about shifting…

    As for your second question; It should be safe to just open the stats file and change P/B to I. I remember getting errors as well (didn’t bother looking too much into them) but the end point is that I-frames were placed where I needed them to be and the encoded file looked fine. Can’t tell you much about how x264 would decide to change the frames based on the edited stats file, but there probably isn’t much to worry about in this regard.

    You also may want to take a look at the –qpfile option for x264, however I’m personally not exactly sure how and whether it actually does work.

    Another thing to do is to encode the two parts separately (since a stream always needs to start with an I-frame), split the encodes where you want the I-frame and then splice them together (append) with mkvmerge once encoded.

    Friday, May 9, 2008 at 21:48 #
  13. Nagato wrote:

    Thanks Martino. Yeah, I forgot to say it in the first place, despite the error messages the video just plays fine; I was just worried if it would result in playback glitch, etc.

    Regarding the shift time, well, for 23.976 clip, virtual dub show the time like 0.042 for frame 1, then 0.083 for frame 2, while in actual calculation it’s 0.834….
    That’s why I think it’s safer to shift the time a bit.
    Well I don’t really understand this frame and time stuff; like when you split audio based on the timeline converted from frame number.

    @fluff
    I see in the xml file you posted the capter has precission higher than milisecond for timestart/end. Are those extra zeros there just for nothing?

    about “hiccups” you said,
    Is it because the frame where the chapter begins is not a keyframe or because it’s too far from keyframe? If the latter, then I guess I don’t need to worry about this time precision thing.

    Saturday, May 10, 2008 at 00:02 #
  14. Nagato wrote:

    sorry for double posting
    @Martino
    The trouble with encoding the clips separately is that short clip can’t be compressed efficiently even with more than 2pass. Like when encoding a OP/ED (about ~2 minutes) 1.4~ bitrate allocation is needed to achieve the same quality of (say) 20~ minutes clip encode. Yes it’s karaoke-less, credits-less. Or maybe I was just doing wrong somewhere.

    Saturday, May 10, 2008 at 00:15 #
  15. TheFluff wrote:

    Nagato: Virtualdub gives you enough precision. The displayed time is most likely either rounded or “in the middle” of the frame’s duration.

    The extra zeroes are there for copypasting reasons; most of them will be truncated by default. You can control how precise timestamps mkvmerge should write with the –timecodes-scale parameter.

    The “hiccups” are most common if you happen to place the chapter start point slightly too early so it ends up on one of the frames just before a keyframe, so the decoder has to go back to the previous keyframe and decode up to max GOP size frames (usually 240-300) to get the sought frame. If the sought frame is one or two frames AFTER a keyframe on the other hand, the “hiccup” probably won’t be noticeable at all except maybe on very slow computers.

    OP’s/ED’s usually require very high bitrates to look good because of the usually high amount of very high-motion and generally hard-to-compress material. If you encode the entire file and look at it with some kind of stream analyzer tool or even just the info window in ffdshow, you’ll find that the encoder tends to allocate a LOT of bitrate there; on some shows I’ve seen, cutting out the OP/ED almost halved the filesize.
    tl;dr: the OP/ED requiring a higher bitrate than the entire file by itself is normal. On the contrary you can probably lower the bitrate for the rest of the episode instead.

    Saturday, May 10, 2008 at 00:55 #
  16. Nagato wrote:

    Thanks guys.
    @Fluff
    The more reason to not encode OP/ED for every episode, besides most people just skip OP/ED anyway. Well, there’s per-episode-credits thing though I wonder how many people care about it.

    Saturday, May 10, 2008 at 01:49 #
  17. martino wrote:

    The only people that care about those are the ones that ALWAYS have something to bitch about. So none. ^^

    Tuesday, May 13, 2008 at 17:14 #
  18. Maniac wrote:

    Thanks for this post, was quite helpful!

    Tuesday, May 20, 2008 at 00:14 #
  19. Nagato wrote:

    OTZ
    Fluff, ordered chapter wont work nicely with coreavc. Damnit, I spent a whole day (lie) just to figure out this shit.

    I made mkv ordered chapter video. Test with coreavc and the segment point messed up, but worked well with ffdshow. Anyway to tweak coreavc so this feature will work with it too?

    Wednesday, May 21, 2008 at 08:38 #
  20. Nagato wrote:

    OK, somehow I can fix the problem now. I should search more about this keyframe and GOP thingy I guess. When you open a x264 stats file there’s i frame and I frame. Because the chapter point I set is the scene change I though I don’t need to change it anymore; in fact I found it’s a i frame in the stats file. If I didn’t change it to I frame core avc messed up the chapter point, but with changing it to I frame it works fine. So the difference between i frame and I frame is that i frame is just a normal keyframe while I frame is different keyframe?

    Wednesday, May 21, 2008 at 15:32 #
  21. Nagato wrote:

    Edit:
    from http://mewiki.project357.com/wiki/X264_Settings#keyint
    “IDR frames are ‘delimiters’ in the stream – no frame can reference data from the other side of the IDR. These mean they can be used as points to randomly seek in the movie (you can’t just start playback from anywhere, the frame will reference previous frames, and they will reference previous frames, and etc). Note that while an IDR frame is necessarily an I frame, not all I frames are IDR frames.”

    From http://www.doom9.org/index.html?/gknot-main6.htm
    “Now you might wonder what IDR frames are: And IDR frame is what has been traditionally known as an I frame. In AVC you can also have I frames inside a GOP, which are not seekable, since the long time references introduced in AVC could result in a P frame after the I frame to reference a P frame before the I frame.”

    Well, so i-frame (normal i frame) and I-frame (IDR-frame) is different thing.

    Sorry for this mumbo-jumbo; no intention to spam here XD

    Wednesday, May 21, 2008 at 15:43 #
  22. martino wrote:

    One more thing I came across; For segment linking to work the files don’t even need to have the same resolution it seems. Wish I had found out about that a bit sooner…

    Tuesday, May 27, 2008 at 12:04 #
  23. kemuri-_9 wrote:

    @martino:
    not all players will support the resolution changing midstream when using segmentation, it may often just skip the segment all together.

    And I developed a patch for x264 (with a tip from akupenguin) that will allow you to force specific frames through the qpfile, so no more stat file hacking to force key (IDR) frames
    -> http://forum.doom9.org/showthread.php?p=1151919#post1151919
    so for now you can use the patch until it possibly gets mainstreamed into the official source.

    Wednesday, June 25, 2008 at 20:51 #
  24. Veterinar wrote:

    I often make lean version of anime series. It takes to load 26 files in Bencos tool and click Start, then wait. Resulting episodes are 50Mb each with bitrate of 268 kbps.

    Are you saying that I can write some xml script and give it to Bencos insted of episode file, so that encoder will ‘see’ through this script and will receive on its input just episode body with opening/ending omitted?

    It would be not too hard to load in Bencos 26 ‘reparse scripts’ instead of episode files. Oops, not 26, but 2 more: window for opening and window for ending.

    Then later what should I do with resulting files? Hmm, I probably need 26 ‘reconstructing scripts’ for viewing purpose. Those would go in player and play exactly as episode files would.

    Do I understand this features right?

    Monday, December 15, 2008 at 01:11 #
  25. xyz wrote:

    Just curious , What if i have encoded anime (h264) a episode separately in to three parts: OP/ MAIN Episode/ ED, and because there is a preview after the ED. i had to placed that preview after the main episode and encoded them together so i wont have to have 4 files for each ep i have.

    Heres my question… now that i messed up the actual flow of this episode original timeline. Is there way for me to bring back or to have the ED appear first before the preview? Is it possible to this using the features describe above.

    Tuesday, March 31, 2009 at 19:56 #
  26. TheFluff wrote:

    xyz: yes of course, just use ordered chapters to reorder the timeline

    Tuesday, March 31, 2009 at 20:04 #
  27. ERQ wrote:

    orderedchapters+editions-example.xml and the description doesn’t match “the first 30 seconds being identical, the next 60 differing and the last ‘180’ being identical again”.
    Am I missing smthing?

    Thursday, April 23, 2009 at 10:00 #
  28. Dr4goN wrote:

    How do I make SUID and Ordered Chapters work? I have made a xml script that should do this:

    1. Play the opening.
    2. Play the episode.
    3. Play the ending.

    with all chapters being visible and enabled. Instead, I get to see only the main episode, and I can’t even select nor see any of the chapters in Haali’s… what’s wrong? Here’s the script:

    :::SCRIPT START:::

    <!– –>

    1
    0
    1
    932273050

    1935323318
    0
    1

    89 6b b1 1b 54 86 9e 73 b2 d0 f3 38 91 a5 f5 e3

    Opening
    jpn

    00:00:00.000000000
    00:01:34.011000000

    1558055356
    0
    1

    Odcinek
    pol

    00:00:00.000000000
    00:20:44.951000000

    800632248
    0
    1

    96 97 c0 a3 10 b6 e7 cf a8 34 c1 d8 60 65 93 54

    Ending
    jpn

    00:00:00.000000000
    00:01:30.007000000

    :::SCRIPT END:::

    Sunday, October 18, 2009 at 10:49 #
  29. Dr4goN wrote:

    Sorry for double post. I’ve made it work, but now I would like to try something different – how to make it work like this? I can’t figure out…

    1. Play the ep prologue.
    2. Then OP.
    3. Then the rest of the ep.
    4. Then ED.
    5. And finally, the next ep prologue.

    Sunday, October 18, 2009 at 16:52 #
  30. neo9k wrote:

    Nice Tut, but a Vidtut is missing xD

    Sunday, November 15, 2009 at 23:11 #
  31. HI wrote:

    is their any way to adjust the brightness or gamma of the video???

    Wednesday, October 6, 2010 at 16:09 #
  32. Bunkus wrote:

    I have a problem.

    I encoded a separate intro, episode + preview, and outro. I’ve followed the xml instructions to the letter.

    But every time I open mmg and drag in all the files (including the chapter xml), it doesn’t work because mmg changes all the damn UID’s. What now?

    keije (above) had the same problem, and you told him to “use ordered chapters instead.” Well, that’s of course what I’m doing, but it doesn’t stop mmg from changing my UID’s!

    Thursday, October 28, 2010 at 00:55 #
  33. Alex wrote:

    I cannot write DVD using built-in Windows 7 DVD studio, that progam does not see mkv file. How can I enable mkv filter in that program? Thank you.

    Tuesday, January 4, 2011 at 13:51 #
  34. Trxysubj wrote:

    owl tattos,

    Monday, July 4, 2011 at 15:54 #
  35. tombu wrote:

    A question regarding changing of some defaults in a ready MKV file – i.e. if there are two subtitle languages embedded into MKV, is there a way to change a default language mark in a simply/fast way, or the whole file must be reprocessed using. i.e. mkvmerge?

    Thursday, July 7, 2011 at 13:28 #
  36. ZerOscuro wrote:

    Header Editor (ctrl+e on mkvmerge)

    Friday, July 8, 2011 at 21:40 #
  37. krizoo wrote:

    There is an error in “orderedchapters+editions-example.xml”: Edition 2 > Chapter 2 (“Opening 2″) should start at 00:00:30, NOT at 00:01:30

    Friday, September 2, 2011 at 00:37 #
  38. krizoo wrote:

    ooooops, sorry, that’s correct, I made a mistake

    Friday, September 2, 2011 at 00:39 #
  39. lovelove wrote:

    What exactly do you mean by “For bonus points, combine ordered editions with unordered ones.” ?

    Friday, September 2, 2011 at 00:43 #
  40. Realcool wrote:

    @ERQ

    I guess the video file has 2 openings within.
    With the Edition1, it will be used the opening 1 — that starts at 0:00:30 to 0:01:30 — and then playback will jump to Episode at 0:03:00
    With the Edition2, it will be used the opening 2 — that starts at 0:01:30 to 0:03:00 — and then playback will continue to Episode at 0:03:00

    Friday, October 14, 2011 at 17:40 #
  41. DarkSpace wrote:

    I just wanted to point out a few things:

    1st It might be easier to use mkvToolnix’ HeaderEditor to get the respective UIDs (and, if necessary, change them), as that one doesn’t add all those “0x”es.
    2nd About I-frames, wouldn’t it make more sense nowadays to use a QP-file in x264 to set frame types?

    Thank you for the guide, anyway!

    Sunday, October 23, 2011 at 10:34 #
  42. hubblec4 wrote:

    Hiho

    here is my thread:
    http://forum.doom9.org/showthread.php?t=169984

    You find an Editor for XML (and more).

    A next feature will be the automatically generated Menu.xml for linked files like described in this article.

    Tuesday, October 28, 2014 at 12:09 #

Trackbacks/Pingbacks (8)

  1. […] http://www.uppcon.se/thefluff/hurfdurf/?p=8 […]

  2. […] that other post about MKV features, I mentioned that it’s possible for an MKV file to contain more than one segment, but […]

  3. Ordered Chapters and You : A Dev Blag of Some Sort on Sunday, January 4, 2009 at 12:05

    […] more information, read what TheFluff has written over on Walls of TL;DR January 4, 2009 | Filed Under Fansubbing, Linux, Ophion […]

  4. Why use anything other then SMPlayer? - openSUSE Forums on Sunday, January 25, 2009 at 15:54

    […] Doesn’t support segment linking […]

  5. Animania » Blog Archive » Baccano! – 08 on Sunday, May 2, 2010 at 14:18

    […] sistema que permite poupar espaço: Ordered Chapters and Segment Linking. (para mais informações: http://mod16.org/hurfdurf/?p=8) Basicamente terão de fazer download do opening e do ending e metê-los na mesma pasta que o […]

  6. […] first time the last version a try and i had a problem with the Seamless branching with MKV files 101 things you never knew you could do with Matroska < WALLS OF TL;DR http://www.makemkv.com • View topic – Seamless branching with MKV If i switch the chapters I get […]

  7. Yabai-Fansubs » Matroska Editions on Thursday, March 31, 2011 at 18:38

    […] now and you want to know more about what is possible with Matroska, I highly suggest you check Fluff’s post on his […]

  8. MKV: Nutzt ihr Edition, File Linking, Ordered Chapters? on Saturday, February 15, 2014 at 17:16

    […] […]