|2013-02-27, 15:53||Link #1|
Join Date: Jun 2010
Converting THORAnime and other Ordered Chapters
UPDATE: SOLVED! YAYAYAYAYAY!!!
OK! So the ordered chapters have been defeated by the stubborn, resourceful, creative (lol), and thankful Zeni. Here I will detail exactly how to smack these sons of guns in the face and make them bend to your will, if they are giving you problems.
Keep in mind, I'm working on a mac. I'm confident that there is a similar process with alternative programs on the Windows side… but I unfortunately do not have the experience to write a tutorial for that. Sorry.
Things you will need:
1. Patience. Lots of it. You may not get this right the first time..... keep trying!
2. A basic understanding of MKVs and how they work. Not too hard.
3. MKVtools - Shareware. Free to use, Nag removed and batches added for 5 bucks.
4. Mkvtoolnix - Freeware. Download link provided below.
5. Handbrake - Also freeware. Download link provided below.
6. Unlinkmkv - Freeware. CLI (Command Line Interface) based program that puts the ordered chapters back where they belong. I highly recommend getting this out of the way before you start, or you're gonna have to wait for a few hours in the middle of everything... Get this here: http://thisdoesnotcompute.org/2012/1...files-on-os-x/
Step 1: Turn off MKV's Header Removal Compression (optional?):
I put (optional?) with a question mark due to the fact that I actually haven't tried this process without this first step. I would recommend doing it as it takes a very short amount of time and has resolved many issues with re-encoding videos for me in the past. Skip this step at your own discretion…
In order to accomplish this you will need the Shareware MKVtools. You can accomplish all of these steps with the free version (at least I believe..) but last time I checked the free version didn't support batch processes and would give you a nag window for every action you attempted to complete. The full version is only 5 bucks and it has been some of the best 5 bucks I have ever spent on any program.
Once you have MKVtools open you should see 3 tabs in the middle of the window, titled: MKV | Edit Tracks | Edit Files. Click on Edit Files, and drag the MKVs into the program. Click on the "Re-Mux" button next to "Turn off MKV's Header Removal Compression" to accomplish this.
(Turning Off MKV Header Removal Compression)
In my experience it takes anywhere from 2-10 seconds per file, and will result in a second file named "(filename).mkv.remux.mkv". I would suggest putting these new files into their own directory to avoid clutter and confusion.
(Example of different directories I used)
Step 2: Re-encode the .mkv.remux.mkv files to play nice with more programs and more media players:
For step 2 we will continue to use MKVtools. Click on the "MKV" tab (in the middle) and you should see a set of options for "Video" , "Audio" and "Subtitles" respectively. These settings are really up to you, to a degree.
For "Video" you should choose H264 (1-pass is faster, 2-pass is slower but usually better), and then for Bit Rate, a number should populate automatically. Sometimes this number is abnormally low, and will need to be raised by you. Keep in mind the higher the number larger your file size will be, but to a degree there will also be less compression and it will look better after it is done re-encoding. Leave the Frame Rate and Resolution as they are unless you want to screw things up :P.
For Audio try Pass Thru first. If you try this and the audio ends up sounding bad (too quiet, off sync, etc) run the process again and re-encode it with one of the available settings.
For Subtitles, mark the "Mux (soft)" option. I know what you're thinking "but I want my subs burned into the video! That's why I'm converting this to an mp4 in the first place is so I can watch it on my PS3/Xbox/iPhone/iPad/PSP/Other random media player!" we'll get to that. Mux it for now, as MKVtools doesn't do a super good job of burning subs in. (For the record, it WILL do it.. I just don't like how they look… because I'm a snob.)
Once you have your settings in place, click Convert. If you're completing a batch the program may yell at you telling you you can't use "Manual" presets. Just create a new preset (click the Edit button next to settings) with the parameters you would like and continue on your way.
Re-encoding can take awhile depending on the specs of your machine. I myself am running a 2010 27" iMac with a 2.8GHz Quad-Core i5 and 16GB of RAM. With these specs a H264 2-pass conversion of a 20 minute 720p episode takes between 5-10 minutes, depending on a few variables. If you have a lot of episodes to convert, I suggest doing them in a batch and watching a movie/going to sleep/playing a video game/watching OTHER anime that you have already prepared while you wait.
(Re-encoding the files to play nice. it's not too hard.)
When the re-encoding is done you should have a file ending in ".mkv.remux.mkv.muxed.mkv". Does your head hurt yet?
Now for the fun part…
Step 3: Those dang SUIDs. (Chapter Segments): How to find them, how to change them, and how to make them cry for their mommy:
Ok maybe not that last part. Sorry I'm pretty bitter about the SUIDs as they were a major roadblock for me… :P
Once you have your re-encoded file you'll need a program called Mkvtoolnix (download: http://www.bunkus.org/videotools/mkv...downloads.html).
No this program is not associated with MKVtools in any way, shape, or form. In fact I hated Mkvtoolnix for a long time because it's hard to use (for me at least) and never ends up giving me what I want when I try to use it for muxing… but that's not what we're using it for!
So once you've downloaded and installed Mkvtoolnix, go ahead and open the program. Up at the top of your screen, choose File>Header Editor (this can also be brought up using Command+E).
Once you have this window open, choose File>Open (Command+O) and select the original (not the re-encoded) MKV file (whether it be an OP, ED, or the actual episode). Once loaded, click on the arrow next to "Segment information", to bring the collapsable menu down. From here, click on "Segment unique ID".
On the right hand side of the window, you should see a "Original value" and a "Current value", as of right now, these should match. Copy the value and paste it into a document of some sort for safe keeping. Close this file.
Once again you need to open a file, only this time you need to open the corresponding newly re-encoded file (so if you were just working with OP1.mkv, choose OP1.mkv.remux.mkv.muxed.mkv). Again, click on Segment Information>Segment Unique ID. The value you see should differ from the original file's value. Take the value you copied into a separate document, and paste it over the one in the "Current Value" box. Once you have done this, Save the file (Command+S or File>Save).
Repeat steps 3.a-3.c for all of the relevant pieces to your episode (for example OP1.mkv, EP1.mkv, and ED1.mkv note: this may or may not be required for the EP portion of your files, but you may want to do it just to be safe). Once you have finished this, you have linked the episode pieces so that they should be properly connected and can now be joined back together.
If you would like more information in regards to the steps above, please visit this amazing article that helped me solve this case: http://thisdoesnotcompute.org/2013/0...itles/#respond
Step 4: Unlinkmkv
Before moving on, please follow the steps located at: http://thisdoesnotcompute.org/2012/1...files-on-os-x/ to install unlinkmkv and get it ready to go. FYI, this will take a few hours, at least. Most of it can be automated (read: watch a movie while you wait, don't be a brainless zombie like me and stare at the screen for hours on end), so don't worry about it too much.
Once you have unlinkmkv installed, it's time to put your new files to the test.
Run the command on the file (either by having the program in the same folder and navigating to it in your terminal, as is described in the blog post, or if you plan on using this quite often like I do, simply put the program in a folder you know it won't get deleted from and make an alias to the program in your .bash_profile. If you're not sure how to do that, it's not hard, though it might take a little research. Google it. Or ask me for help.. Hopefully I'll still be around to help. If I'm not then yeah, Google. Google is your friend. .
Your command should look something like this:
perl unlinkmkv (filename-ep01).mkv.remux.mkv.muxed.mkv
If it works, you should see something similar to the following:
found segment: /(filename-op1).mkv.remux.mkv.muxed.mkv
found segment: /(filename-ed1).mkv.remux.mkv.muxed.mkv
splitting file: /(filename-ep01).mkv.remux.mkv.muxed.mkv
building file: /(filename-ep01).mkv.remux.mkv.muxed.mkv.REBUILT.mkv
Once this is finished, you should have (filename-ep01).mkv.remux.mkv.muxed.mkv.REBUILT.mkv in the same folder as your re-encoded file. I prefer to put this in it's own folder, again to avoid clutter. But hey that's up to you.
So now you have an MKV file you can use for viewing on your computer, or archiving… but let's be honest. If that was all you wanted the MKV for in the first place, wouldn't you just leave the Ordered Chapters how they were? VLC actually supports them now and so do a few other programs. Long story short, the only real reason to "undo" these Ordered Chapters is to convert them for viewing on other devices. So remember how I told you not to burn those subs in back in Step 2 with MKVtools? Well the time has come for that.
Step 5: Burn those subs in, mother trucker!
For Step 5 you will need the (free) program, Handbrake. I suggest downloading the nightly build: (https://build.handbrake.fr).
Handbrake is really easy to use, but maybe not super user friendly from the get-go. First of all, you need to define your Source. In the newer builds of Handbrake, you can click and drag the file (or folder) of your choice for converting. Once Handbrake has scanned the source, you'll have a few options on how you want the file converted. I suggest leaving most of them default, though there are some presets over on the right hand side.
You can adjust the quality of the video either by using the slider in the middle of the program, or using the alternative method of specifying the bitrate of the file. It's really up to you. Now for the important part: don't forget to click on the Subtitles tab and specify how you want those handled.
Under "Track" select the subtitle track (there is usually only one) and then check the box labeled "Burned In". From here, you should be ready to go. Make sure if you want the converted file to end up in a specific directory that you click "Browse" and specify that. Click "Start" and watch Handbrake do it's thing!
My computer typically takes about 5 minutes for a 20 minute 720p conversion, depending on quality settings and such.
(Handbrake doing it's thing. Also where to check the subtitles box.)
Something I learned a few days ago was that Handbrake actually can apply the same settings to a batch of files. In order to do this, select a folder as your "Source" with all the files you want converted in it. Select one of the files, specify your parameters and then click on File>Add All Titles to Queue. Something I found out after a little more testing with this though, is that it doesn't seem to save your subtitles settings between videos. Major bummer.
Once Handbrake is done, you should have a file that looks nice, and plays nice with all your different devices! Or if you're like me, all of your FRIENDS devices. So that they can bask in the glory that is beautiful HD anime, just like the rest of us.
One more thing I found during my Geass project. Sometimes there will be a certain segment of the Ordered Chapters that will give you grief and break the episode (in my case it was ED1, and it only broke the "Preview" portion of the episode). If the episode happens to break at the end and result in Handbrake spitting out a super long file (for example a 46 minute file when it should be 24 minutes) you can specify in the Handbrake settings to only convert a portion of the episode.
Next to "Title", over on the right hand side you should see a drop down, likely with "Chapters" selected. If you change this to "Seconds", you can convert the minutes wanted into a seconds based value and tell Handbrake not to convert past that point of the episode. In my case it was 1450 seconds.
Hopefully this has been helpful to some degree... Even if it only helps one person, that will be good enough for me.
Just a brief rundown of my situation and history working with mkv conversions:
I first started converting mkv anime to mp4 back in 2008/2009. Up until that point I hated mkvs with a passion because they made viewing anime on anything other than the computer complete and utter hell. Now before you say "just watch them on the computer", I tend to do that myself these days... but often my friends do not have a computer they can use to view anime on, so I prefer to always have a PS3/Xbox/Etc friendly version to give to them for watching.
Shortly after the struggles mentioned above I found an easy solution for burning the subtitles into the videos and it's been an on and off battle with other problems since then.
The problem that I'm currently facing is as such:
A few days ago I read an article (http://thisdoesnotcompute.org/2012/1...files-on-os-x/) that gave me a rather simple solution to fix the issues I have been having with ordered chapters since they popped up. Of course I was ecstatic as I thought "I can finally use (insert fansub group here) videos and not be OCD about the OP/ED missing!!"
I created the files (Code Geass in this case) I was going to be re-converting and quickly popped them into Handbrake (my program of choice at the moment) for conversion. I let it go on it's way and after a couple hours all 25 episodes were converted and ready to go. I opened the first episode for a quick quality check and remembered immediately the other reason I hadn't been using THORA releases whenever possible.
For some reason, when I convert THORA videos, there tends to be issues with artifacts/fragments/whatever you want to call them in the resulting video. These are especially prevalent in the OP/ED which if you remember was the first issue due to ordered chapters (now resolved).
My question is this: does anybody have any experience with this? Is there a way to change the settings and/or fix the file so that the converted file doesn't freak out like that?
I can provide screenshots if necessary, but I don't have time to right at this moment as I've typed this up on my lunch break and it's time to go back to work >.>
Any help would be much appreciated. If there is no solution to this I can always go find another subbing group/try to find another method/something, but I figured I'd ask. The one thing I've never done is actually ask for help on a forum... I've always found the answer by finding other threads with similar questions. Unfortunately I was unable to find record of anything quite like this problem so... Here I am.
Thanks in advance and if anybody needs any additional information from me please let me know!!
Last edited by Zenigame96; 2013-03-01 at 20:19. Reason: Solved!
|2013-02-27, 19:28||Link #2|
Join Date: Jun 2010
I made a few screenshots to illustrate what I'm talking about now that I'm home from work:
Again, any input or help at all would be much appreciated. Also if there's somewhere else I should post this or something please feel free to let me know.
|2013-02-27, 22:04||Link #4|
Join Date: Jun 2010
The settings I use are usually default configurations, but I have toggled and fiddled with just about everything trying to get these issues to go away. As I mentioned before I use Handbrake to burn the subs in to the resulting video.
Something strange I noticed that I forgot to include earlier was that if I convert the OP/ED sequences separately, they tend to come out fine. It's only once they are stitched to the other videos (whether this is done through re-muxing or even just stitching them all together after converting separately) that they start giving me crap like this.
Last thing I should mention (as is noted in the subject) is this happens most commonly with THORA projects. Another example of issues like this is with their K-ON! BD Rips... I can post screenshots of those if necessary as well, they look absolutely horrid.
Let me know if I accidentally omitted any information or if anybody has any other questions. I'll be leaving this thread up constantly on both my computer and phone in case of any replies.
|2013-02-27, 23:01||Link #5|
Join Date: Jun 2010
So I made some headway. This particular instance actually hasn't been the result of Handbrake, though I know I have definitely had issues in the past with that (so any advice on that is still welcome). It seems the issue with these projects specifically has actually been that when I use the method to put the ordered chapters back together, the resulting mkv file is actually messed up. So I guess a new question is this:
Any alternative suggestions on how I could merge the ordered chapters back together easily? I've read up on segment linking and such, but nothing has quite clicked with me in regards to how to actually merge the files. I've fiddled around with mkvtoolnix in the past and it always seems to end up in disaster, but maybe I just haven't been using it right :/
|2013-03-01, 13:18||Link #6|
Fade In, Fade Out
Join Date: Mar 2003
Location: Northeast USA
While this isn't something I'd make use of, I wanted to thank you for taking the time and effort to write up such an extensive guide to follow up with the question that you originally posted. It's rare enough that people even report back with whether something worked or not; this guide is phenomenal. I'm sure it will be very useful to many people.
|2013-03-04, 14:22||Link #7|
Join Date: Jun 2010
Well I figure I've spent so much time looking into this crap over the last few years it's about time I start giving something back.
Something to note, sometimes the unlinkmkv tool will actually do the job just fine with the original files. I ran into an issue with Code Geass R2 episodes 15 and 23, and after a few hours of trying to work with them I started from scratch and ran the script on the original files... And it worked! Lol funny how that happens sometimes. Anyway thanks for the kind words, if this helps even one person I'll be satisfied with it.