PDA

View Full Version : Linking external file in Matroska


vlada
18th October 2007, 09:59
A friend of mine asked me following question, which I couldn't answer, so I'm hoping to get an answer here. He told me he heard that it is possible to include an external file in Matroska. Sounds strange, I know, I'll try te explain you the idea.

Let's say there are TV series all with the same intro. His idea was to make a file containing only the intro and then have the episodes without intro. But when he starts one of the episode, the intro will play first and then continue with the episode.

Is it possible? If yes, then how could it be done?

Daodan
18th October 2007, 11:32
Ordered chapters would be most elegant (runtime appears as if it's full there etc), but linking can work as well (in mmg you have a box for that), but this way you won't be able to add a file in the middle of another let's say.

Nicholi
19th October 2007, 01:43
Ordered chapters would be most elegant (runtime appears as if it's full there etc), but linking can work as well (in mmg you have a box for that), but this way you won't be able to add a file in the middle of another let's say.You can of course use ordered chapters together with segment linking in order to place something "in the middle" of a file.

Daodan
19th October 2007, 09:09
You can of course use ordered chapters together with segment linking in order to place something "in the middle" of a file.

That IS what I said actually. Was refering to the fact you can't do that in mmg's easier to use "link dialog". :rolleyes:

Thunderbolt8
20th October 2007, 20:59
open an mkv file, Haali icon appears on toolbar, double click it > options > input > try to open linked files > yes

just dont ask me how to link them, maybe this has to be done at the muxing stage in mkvmerge? I guess some kind of info is needed so that the episode file needs to know which file to open at the beginning, before the episode is displayed itself.

Unearthly
21st October 2007, 17:56
Since I couldn't find any good instructions when trying to do this myself, I'll go ahead and lay out the steps to creating an mkv that uses Ordered Chapters.

Step 1: Find the Segment UID of the files you want to externally link. Run mkvinfo on the file to find the SUID.

Step 1a: If your file does not show a SUID (for example, if your file came straight out of x264), then you will need to remux with mkvmerge. The SUID should show up then.

Step 2: Create your chapters file. Below is an example with a single edition which has 5 chapters, 2 of which are actually external files.

<?xml version="1.0" encoding="UTF-8"?>

<!-- <!DOCTYPE Tags SYSTEM "matroskatags.dtd"> -->

<Chapters>
<EditionEntry>
<EditionFlagOrdered>1</EditionFlagOrdered>
<EditionFlagHidden>0</EditionFlagHidden>
<EditionFlagDefault>0</EditionFlagDefault>
<EditionUID>2572935589</EditionUID>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>Internal Part 1</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>1</ChapterUID>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:08.341675008</ChapterTimeEnd>
</ChapterAtom>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>External File 1</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>2</ChapterUID>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:08.341675008</ChapterTimeEnd>
<ChapterSegmentUID format="hex">0xbb 0x5c 0x5c 0x1a 0x9f 0x02 0xb2 0xce 0x8c 0x19 0x54 0x50 0x91 0x16 0x95 0x42</ChapterSegmentUID >
</ChapterAtom>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>Internal Part 2</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>3</ChapterUID>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterTimeStart>00:00:08.341675008</ChapterTimeStart>
<ChapterTimeEnd>00:00:16.66</ChapterTimeEnd>
</ChapterAtom>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>External File 2</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>4</ChapterUID>
<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
<ChapterTimeEnd>00:00:08.341675008</ChapterTimeEnd>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterSegmentUID format="hex">0xb9 0x58 0x7b 0x0a 0x6e 0x32 0x3a 0x16 0x99 0x7b 0x55 0x07 0x64 0x52 0x50 0x1e</ChapterSegmentUID >
</ChapterAtom>
<ChapterAtom>
<ChapterDisplay>
<ChapterString>Internal Part 3</ChapterString>
<ChapterLanguage>und</ChapterLanguage>
</ChapterDisplay>
<ChapterUID>5</ChapterUID>
<ChapterFlagHidden>0</ChapterFlagHidden>
<ChapterFlagEnabled>1</ChapterFlagEnabled>
<ChapterTimeStart>00:00:16.66</ChapterTimeStart>
<ChapterTimeEnd>00:00:25.025025025</ChapterTimeEnd>
</ChapterAtom>
</EditionEntry>
</Chapters>

The "ChapterSegmentUID" is what signals that the given chapter is an external file. If the tag isn't present, it will assume that it is part of the muxed mkv.

Step 3: Remux with the new chapters file. When you play the file it should link everything together as long as they are in the same directory.