I have an old saying I like to use now and then, which has always seemed particularly relevant to Gentoo. “If it ain’t broke, tweak it.” Of course, now, I’m starting to develop a new motto: “I get really cranky when things don’t work right.” :)
It turns out that the issue with the DVDs from Universal Studios weren’t completely related to disc quality after all. I sat down today determined to figure out why everything was out of sync so much, and the answer was that it has been happening in recent versions of mkvmerge. So, it was the Matroska muxer all along. Although, I’d gather, I imagine it’s probably the MPEG demuxer when it comes to TV DVDs. Everything with v2.4.x of mkvtoolnix would throw off the sync by -.400 to -.500 ms. I honestly wouldn’t mind if everything else wasn’t already “standard” at a smaller drift, only -.100.
It turns out, after much poking around, that I haven’t even done any ripping since September of last year. And that was the real key. I kept asking myself “what’s changed in the past few weeks that suddenly everything is out of sync.” Well, I forgot one big item: I added a second mythfrontend. And when I did that, I started watching shows from the ripped library more, and once I started watching things more, I wanted to rip some more shows to keep the recent titles stocked.
Believe it or not, after all this work I’ve gone through to setup this whole thing, I don’t actually *watch* stuff on there very often at all. In fact, it wasn’t until I got my second one that I even started using it regularly. About the only times I’d normally watch stuff on my original frontend was I usually watch a cartoon in the morning right before going to work, and I’ll sometimes watch an episode while I’m doing something else, or just get tired of watching movies that I’ll poke around the episodes. It’s not very common, though, which is what explains why I haven’t been ripping very often. In fact, one episode I just watched the other day, I originally ripped over a year ago. If it hadn’t been for the fact that mkvinfo prints out the exact versions of the Matroska libraries and binaries that it was created with, I probably never would have nailed down that it was a problem with mkvmerge.
It wasn’t just the Universal discs that were having problems, it was everything that I’d ripped recently. I did have one show that for some reason was a real anomaly (Perfect Strangers) and it would have the same drift regardless of the version of mkmerge … and the only other new stuff I had ripped was from Universal, so considering my past issues with them, I figured it was the cause.
So, the simple solution was to go back to the same versions that I was using 5 months ago to rip stuff. For the record, that’d be mkvtoolnix 2.1.0 and libebml 0.7.7. And, everything’s back to normal. I’m glad. :)
And I’m pretty sure about the bug being in mkvmerge, since if I re-encode the video with ffmpeg just by copying it (ffmpeg -i movie.vob -acodec copy -vcodec copy movie.vob) and then mux it, the sync will be just fine, regardless of the version. So, it looks like that ffmpeg does a bit better job than mkvmerge when it comes to poorly authored MPEG streams, which really isn’t quite a surprise. Honestly, I’m more impressed actually that ffmpeg can even handle and correct them so well.
The eventual, inevitable future though is that I’ll be encoding all my video someday. I’m just not up for it right now, for a couple of reasons. For one, my disk space is too small, so I have to rotate content on a regular basis. Since things come and go so often (relatively speaking), I don’t want to spend time encoding stuff if I’m not going to be keeping it long term. The second issue is that I just don’t want to wait for it to encode. Both issues will go away, with time, as I get a better computer that can encode much faster, and as I expand my harddrive space.
Speaking of encoding, one thing I finally did this morning was to take a systematic approach at what encoding options work well for me for ripping my DVDs. Since those files, unlike the TV shows, will not get removed anytime soon, they are a prime candidate for encoding to save some space. I know I keep saying that there’s no magic bullet for every media source out there, but at least for DVDs, I think I found something that’d work for me. It’s not as advanced as most people would use … in fact, one solution to my many problems was to use old codecs and formats so as to avoid any bugs that may still be present in newer codecs. I settled on using LAVC MPEG4, with no extra options, 2400k for the video, MP2 at 192k for the audio, and AVI. I know, not exciting at all. But, it works great so far, and I’ve tested it on DVDs from four studios (Fox, Disney, Warner, Paramount) and they all turned out perfect. The MPEG4s only get down to about 42% on average of the original size, which again isn’t all that impressive, but for a light set of options, it works great, and most importantly … the video quality is nice, and I have no complaints. That’s a first.
For the record, here’s the current command I’m using: ffmpeg -y -i movie.vob -r 30000/1001 -vcodec mpeg4 -ab 192k -b 2400k -acodec mp2 -map 0:0 -map 0.1:0.1 -ac 2 movie.avi
You gotta watch out for those audio streams when using ffmpeg — the ordering is sometimes flipped, so it would be (for example) starting at 0x83 and ending at 0x80, which means you’d probably get the wrong audio track by default. So I just throw in the default -map commands anyway, so it’s easy and quick to edit. I’ll eventually just throw in a way to check for the right one in my scripts (pretty simple really — check for your language and the highest number of channels from the VOB) and that’ll be that.
Anyway, I’m pooped, I’ve been hacking on this all day, but made some real progress. I’m glad I got my old setup back up and working. I tell you what. It was a pain to figure out, but I’m glad I managed to pinpoint the source. :)