ChapterMerger Beta

While trying to play my MKV files on a “Smart” TV (It’s just a low powered Android. LOL), I am struck by a very common problem with media boxes. The video seems to be shorter. Then, I’ve found out that it actually is missing a part, in this case, the opening sequence and the ending sequence (Some of you may be very familiar with this setup.). When I tried to play it in my workstation (fancy term for a good ‘ol desktop box), it plays fine, complete with the missing part! Acting like I didn’t know what the heck actually happened, I actually search for this phenomon in the Internet, and behold — the one thing that made MKV greater among its circle — segment linking.

So I’ve been wondering, “How can I make this file playable on my ‘Smart’ TV?” “How was it able to look for the correct file?” I took liberty of tinkering my MKV files, and I’ve found out that it’s able to do through the data provided by its chapter file. So this is where the name “Ordered Chapter” originated from. Luckily, this chapter is just a form of GUID-like hexadecimal code. Sounds like an an alien artifact? Yeah, I know. This SUID represents every MKV file and is used to locate the MKV file represented by the SUID the chapter track provided in the chapter file embedded in the MKV. And media players (that uses the standard MKV library) only finds this in the current directory the file resides. When the file is found, the media play inserts this file into the current stream as if it is part of the file being played. Hence, the segment linking name.

Now, the theory is apparently easy. In order for the file to appear “complete” on my media box, The great thing about MKV compared with others (like MP4) is that it is a very flexible container that you do not need to re-encode the feces of it just to add/remove media tracks, parts, and whatnots. So I can just merge the linked MKV file to the original MKV file, using a number of tools for this purpose. One of the most popular and successful tools in this realm is MKVToolNix – also available in Windows. It’s not just merging the file, you also need to readjust the time codes in the original MKV’s chapter file, or you can remove the chapter file completely. Some people call this “unordering“. By the purpose of this article, let’s use that term.

I am successful in doing that, but now I found myself a new problem — since I’m lazy, my brain decided — I can’t just do this manually (the process takes approximately 30 minutes every file, damn it) for every file, all with the finding the correct time code to insert the externally linked file, to splitting the entire MKV file. Especially if it’s a TV series we’re dealing with (12 – 24 episodes, and sometimes 50+). Out of this frustration, I eventually ended up building a C# application to carry all the tasks I needed to do, complete with GUI (Although I could just spend the time I took building this application on actually merging the files manually by myself).

ChapterMerger Beta

Capture

This program is very, very simple. And it needs equally simple prerequisites in order to run:

For starters, it is just a mere wrapper for the great MKVToolNix. I am not yet that low as a programmer (Low as in low-level programming, got it? Forgive me.). This program must be run besides the MKVToolNix tools inside mkvtoolnix folder, or it can be run anywhere provided that mkvtoolnix is included in the PATH variable.

Now, you were able to run it, you are presented by a really simple interface like the above. Reading what I describe about “unordering” the MKV file, you can get a gist of how to operate this little program. You just have to add the MKV files, or the folder containing them. Make sure the segment linked MKV file comes along (99.9% of the time, these files come together). Then click ‘Analyze’. After analyze is complete, you can now click ‘Merge!’. This outputs the new MKV file in an ‘output’ folder, inside the folder containing the MKV files. Play it, and you now have an “Unordered” MKV file!

You can also organize and manage project files that contains information, like the files/folders to process, its configuration, and its analyze data (optional). Just use the appropriately named ‘Save Project’ and ‘Open Project’

This is pretty useful (as I say confidently) on Anime TV-series-related releases, and even though, not a lot of Fansubbing groups does this today (compared to the time when segment linking was first popularized by the Anime scene), you’ll find it useful in older releases that you might have, as well as today’s.

So, if you have done what I have done, and you’ve been doing it, I hope this program can help you as it helped me.

The program is quite very early in its stage of life, and it doesn’t deserve an alpha tag (it’s barely functional), so it’s in the Beta stage now. I will update this program as time progresses as long as it allows me, so stay tuned!


Currently for Windows. I may add MONO support later on for cross-platform support.

You can grab the program via github — https://github.com/koohiikappu/chapter-merger/releases/.

You have a github? You can add me! Let’s follow each other!

Beware, it’s still in beta and may have bugs and unexpected things.

Advertisements