View Full Version : MKV Seamless Branching
jonathonsunshine
7th September 2008, 20:01
Howdy yall.
I read somewhere on the iNet (which unfortunately I have since been unable to find again) about a chap who had a whole season of a tvshow on one dvd.
He had the opening and closing credits (intro.mkv and outro.mkv) and the episodes without the intro and outro (episode1.mkv, episode2.mkv) as separate files and a series of (I think) XML files that acted as indexs, one for each episode that would play "Intro.mkv - episode1.mkv - outro.mkv" in a row, and another that would play just the episodes themselves as a single 6 hour movie.
This was not just a playlist, the episodes were all seperate files, but the playtime in the player indicated that the length was 6 hours.
Can someone please explain how this was done, and cut and paste an example of the XML file here? I have a film with an alternate ending and I wanna put it on disc with the main movie and the two alternate endings and three separate files and be able to play either ending.
Thankyou.
setarip_old
7th September 2008, 21:13
Hi!I have a film with an alternate ending and I wanna put it on disc with the main movie and the two alternate endings and three separate files and be able to play either ending.Why "reinvent the wheel"? What you've described is already set up and available on your original DVD. So just duplicate your original DVD (with or without compressing)...
Inventive Software
9th September 2008, 11:41
Shoot him in the foot why doncha? :p
Something like that isn't available currently in Matroska, I *think*, but there is a Matroska 2.0 thread going, so explain what you want there and maybe it'll get recognised.
pdanpdan
9th September 2008, 18:57
I attached a small demo made by haali a long time ago - a proof of concept, but it works very well (I made the same thing - intro-episode-outro)8816
Daiz
9th September 2008, 21:06
The feature you're looking for is called ordered chapters and segment linking - What you want to do is use these combined with editions. It's very possible with the current available tools, you just need to learn how to use the mentioned features. Not much documentation exists, but this is pretty much the most complete guide you can find:
http://www.uppcon.se/thefluff/hurfdurf/?p=8
jonathonsunshine
13th March 2009, 10:52
I laid this to rest a little while ago, but I'm having another shot at it now. I am treating this as a reboot of the the thread. I have given up on manual segment linking, now I am fiddling with nested chapters or editions.
I am running this same thread at http://forum.corecodec.com/viewtopic.php?f=14&t=1882
hello
I have a film with an alternate ending.
I encoded the start of the film and two endings separately and then the credits and joined them altogether
Start > Ending1 > Ending2 > Credits
I set up two lots of chapters in two separate editions both exactly the same, four chapters based on the above, with ENDING2 disabled and hidden in edition 1 and ENDING1 disabled and hidden in edition 2.
I play it through Media Player Classic (1.2.908.0) and in the Haali Media Splitter menu thats in the taskbar I can choose between the two editions and the three enabled chapters for both editions, but it still plays through both endings. I muxed it all with MKVMerge 2.4.1.
So... Any ideas on what I am doing wrong ? (I have attached and posted the XML version of the chapter structure I am using)
<?xml version="1.0" encoding="UTF-8"?>
<!-- <!DOCTYPE Tags SYSTEM "matroskatags.dtd"> -->
<Chapters>
<EditionEntry>
<EditionFlagHidden>0</EditionFlagHidden>
<EditionFlagDefault>0</EditionFlagDefault>
<EditionUID>405581480</EditionUID>
<ChapterAtom>
<ChapterUID>2022898863</ChapterUID>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterDisplay>
<ChapterString>The Start</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>01:07:58.080000000</ChapterTimeEnd>
</ChapterAtom>
<ChapterAtom>
<ChapterUID>1190950809</ChapterUID>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterDisplay>
<ChapterString>2D Climax</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterTimeStart>01:07:58.120000000</ChapterTimeStart>
<ChapterTimeEnd>01:20:36.200000000</ChapterTimeEnd>
</ChapterAtom>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>3D Climax (Skipped)</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>4043888259</ChapterUID>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterFlagEnabled>0</ChapterFlagEnabled>
<ChapterTimeStart>01:20:36.240000000</ChapterTimeStart>
<ChapterTimeEnd>01:33:14.320000000</ChapterTimeEnd>
</ChapterAtom>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>Ending (Credits)</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>2576925873</ChapterUID>
<ChapterTimeStart>01:33:14.640000000</ChapterTimeStart>
<ChapterTimeEnd>01:38:07.360000000</ChapterTimeEnd>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
</ChapterAtom>
</EditionEntry>
<EditionEntry>
<EditionFlagHidden>0</EditionFlagHidden>
<EditionFlagDefault>0</EditionFlagDefault>
<EditionUID>3643159735</EditionUID>
<ChapterAtom>
<ChapterUID>1448660357</ChapterUID>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterDisplay>
<ChapterString>The Start</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>01:07:58.080000000</ChapterTimeEnd>
</ChapterAtom>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>2D Climax (Skipped)</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>1503568053</ChapterUID>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterFlagEnabled>0</ChapterFlagEnabled>
<ChapterTimeStart>01:07:58.120000000</ChapterTimeStart>
<ChapterTimeEnd>01:20:36.200000000</ChapterTimeEnd>
</ChapterAtom>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>3D Climax</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>3891051425</ChapterUID>
<ChapterTimeStart>01:20:36.240000000</ChapterTimeStart>
<ChapterTimeEnd>01:33:14.320000000</ChapterTimeEnd>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
</ChapterAtom>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>Ending (Credits)</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>3997266325</ChapterUID>
<ChapterTimeStart>01:33:14.640000000</ChapterTimeStart>
<ChapterTimeEnd>01:38:07.360000000</ChapterTimeEnd>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
</ChapterAtom>
</EditionEntry>
</Chapters>
setarip_old
13th March 2009, 17:33
I have a film with an alternate ending and I wanna put it on disc with the main movie and the two alternate endings and three separate files and be able to play either ending.
Again I would ask you: Why "reinvent the wheel"? What you've described is already set up and available on your original DVD. So just duplicate your original DVD (with or without compressing)...
jonathonsunshine
15th March 2009, 09:21
Again I would ask you: Why "reinvent the wheel"? What you've described is already set up and available on your original DVD. So just duplicate your original DVD (with or without compressing)...
That really isn't helpful.
This nested chapters and editions are supposedly a feature of the matroska chaptering system. I can't get it to work. I am asking for help or advice getting this feature to work.
Esurnir
15th March 2009, 17:01
Again I would ask you: Why "reinvent the wheel"? What you've described is already set up and available on your original DVD. So just duplicate your original DVD (with or without compressing)...
Because the wheel use mpeg2 and you can't make a full season fit one dvd with that, mkv use a single file instead of using a plethora of obscure file like bd-9 and that some player like my computer refuse to play them, that mkv is better at indexing and seeking than m2ts ever will be, and that mkv files have a far smaller over head than mpeg-2 program (vob) / transport streams, and if mkv got an awesome feature (tm) I think you should be able to use it.
setarip_old
15th March 2009, 18:13
@Esurnir
Hi!Because the wheel use mpeg2 and you can't make a full season fit one dvd with that
You response to me has nothing to do with the purpose stated by the OP:I have a film with an alternate ending.
jonathonsunshine
15th March 2009, 21:16
We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win, and the others, too.
setarip_old
15th March 2009, 22:59
JFK must be rolling over in his grave, using such important words for such a trivial thing ;>}
Esurnir
15th March 2009, 23:53
I dwelved a bit and here is a correct example of chapters.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- <!DOCTYPE Tags SYSTEM "matroskatags.dtd"> -->
<Chapters>
<EditionEntry>
<EditionFlagHidden>1</EditionFlagHidden>
<EditionUID>1</EditionUID>
<ChapterAtom>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:10.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 1</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>4251740982</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:10.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:20.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>2989020996</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:30.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>3735427744</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:30.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:40.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 2</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>2775998368</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:40.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:50.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 3</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>147745294</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:50.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:01:00.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 4</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>2183322204</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:01:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:01:10.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 5</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>676348898</ChapterUID>
</ChapterAtom>
</EditionEntry>
<EditionEntry>
<EditionUID>3</EditionUID>
<EditionFlagOrdered>1</EditionFlagOrdered>
<ChapterAtom>
<ChapterTimeStart>00:00:10.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:20.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 1</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>1765441366</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:30.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:40.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 2</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>35023622</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:40.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:50.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 3</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>3158857450</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:50.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:01:00.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 4</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>588565256</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:01:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:01:10.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 5</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>2299022178</ChapterUID>
</ChapterAtom>
</EditionEntry>
<EditionEntry>
<EditionUID>2</EditionUID>
<EditionFlagOrdered>1</EditionFlagOrdered>
<EditionFlagDefault>1</EditionFlagDefault>
<ChapterAtom>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:10.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 1</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>3930739914</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:10.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:20.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>599796446</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:30.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>894324640</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:10.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 2</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>2012922298</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:35.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:40.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>2002028294</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:30.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>400078196</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:10.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 3</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>2193243326</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:40.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:50.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>2446608412</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:30.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>3440002936</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:10.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 4</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>352889906</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:50.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:01:00.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>1971602944</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:30.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>3959296274</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:10.000000000</ChapterTimeEnd>
<ChapterDisplay>
<ChapterString>Episode 5</ChapterString>
<ChapterLanguage>eng</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>3592965856</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:01:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:01:10.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>3589017568</ChapterUID>
</ChapterAtom>
<ChapterAtom>
<ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:30.000000000</ChapterTimeEnd>
<ChapterFlagHidden>1</ChapterFlagHidden>
<ChapterUID>3879339148</ChapterUID>
</ChapterAtom>
</EditionEntry>
</Chapters>
Now you don't only need a chapter file, but also a tag file like this
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Tags SYSTEM "matroskatags.dtd">
<Tags>
<Tag>
<Targets>
<EditionUID>1</EditionUID>
</Targets>
<Simple>
<Name>TITLE</Name>
<String>Compatibility for old parsers</String>
</Simple>
</Tag>
<Tag>
<Targets>
<EditionUID>2</EditionUID>
</Targets>
<Simple>
<Name>TITLE</Name>
<String>With intro/credits</String>
</Simple>
</Tag>
<Tag>
<Targets>
<EditionUID>3</EditionUID>
</Targets>
<Simple>
<Name>TITLE</Name>
<String>Without intro/credits</String>
</Simple>
</Tag>
</Tags>
So for short, this script create three "edition" of chapter, those chapter are then assigned by the tags with the first tag being the one that is going to be parsed by player without any support for custom editions (and since that edition is <EditionFlagHidden>1</EditionFlagHidden> it won't appear in the list when loading the file), the second and third are other edition and the tag file mixed with the chapter file create that sort of "multiple playlist"
To create your single episode with alternate ending you need to encode a video/audio with :
Episode 1 with real ending++alternate ending.
After which you'll create three edition, one with the chapter going on the normal playlist (made twice for compatible tag file maybe ? Let's be on the safe side of the ballgame here) and another with one chapter that is going to "skip" the normal ending chapter, then maybe come back to the original movie for the credits if both are the same. Concerning making a perfectly synced video that way good luck and free advice (tm) does not guarantee you'll have a smouth play since there will be a seeking in the file (hope the directshow filters buffer aren't retarded and that the decoder will be able to display the frame correctly, especially since it may seek on a non I frame).
It worked well when extracting the tracks of the demo file from haali however I'm still in the process of trying that with an anime dvd rip to see if it'll be a smooth playback.
jonathonsunshine
16th March 2009, 13:01
JFK must be rolling over in his grave, using such important words for such a trivial thing ;>}
I'm glad to see the humour is not lost on you thou :)
jonathonsunshine
16th March 2009, 13:05
I dwelved a bit and here is a correct example of chapters.xml
I am too drunk right now to really look into this. But thank you, I will have a look tomorrow.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.