I promised my friends a glorious, full HD Star Trek experience in my birthday party invitation, which means i've had to spend some time trying to finally achieve the Blu-ray experience i had envisioned when i put together my current box (almost two years ago, yes). Practical Blu-ray playback in linux has been a long time coming. The question is, has it arrived?
For those late to the party, one of the big "features" of Sony's Blu-ray format is a really elaborate copy-protection scheme (yes, this is from the same company that released CDs with a rootkit, an act which would have landed mortals in jail for many moons). The encryption makes it nigh impossible to play the discs without officially licensed playback software (which seldom, if ever, gets released for linux). DVDs had their own copy protection scheme which was rather quickly defeated (but not without some legal repercussions) and that made it possible to play (or back up) DVDs using almost any video playback software. The DMCA has since been passed, which has the ludicrous provision of making it illegal to circumvent copy protection of your owned media for your own use, and specifies harsher penalties for those who might publish a countermeasure for future DVD-like encryption schemes.
So, to play Blu-rays in linux will require cracking the protection, or the release of a commercial program. I followed the progress over on the doom9 forum (it was quite a fascinating project) but things never really came together as hoped, in large part due to the fear of those involved of being arrested and prosecuted in the US. The efforts did reach a certain degree of success, however, and i committed a few acts of civil disobedience last year and ripped my three Blu-ray discs to hard drive: the two direct-to-DVD Stargate movies and the new, audience-friendly addition to the Star Trek franchise.
The problem has been in playing back those (huge) files, and that's what i've been banging my head against. I have now concluded that the rips are a bit broken (thanks again, Sony), but here's what i did to get to the point that i could draw that conclusion. So without further ado, here is...
How to smoothly playback 1080p video in Kubuntu
The default video player in Kubuntu Maverick (10.10), much like the default browser, is poor. It provides no real configuration options and crashes on a regular basis when trying to change media. It does do a fairly reasonable job playing back the 30+ GB Matroska files that the Blu-ray ripping process spits out, but on closer examination the playback is stilted. This is because 1080p playback is computationally expensive, and the quad-core CPU in this box (Core 2 6600) is clocked at a relatively low 2.4 GHz. Unfortunately, Dragon Player doesn't seem to have any provision for multithreading, so it pegs a single core at 100% utilization and then bogs down.
There are two solutions to this problem. The first is to use the built-in hardware acceleration of h.264 video playback in the nvidia graphics card in the system. Fortunately, nvidia and mplayer* have made this possible in linux. The second approach is to install the experimental multi-threaded version of mplayer to use multiple cores of the CPU. I installed mplayer and smplayer (a really nice frontend that has all kinds of configuration options), but even though i tried to enable multithreaded playback, it didn't work. I've read that this might be due to the ripped MKV not having multiple slices, and hence not being amenable to farming out to multiple threads. It also might just be that the mplayer version in the kubuntu repository is still not multithreaded.
However, when i installed the vdpau drivers (roughly following this guide) and enabled vdpau as the renderer in smplayer, the CPU utilization dropped to less than 10% and the video magically got a lot smoother. However, the video would still break up at long intervals. What solved that problem was creating a 40MB buffer (yes, even though it was playing from a hard drive) in smplayer settings... until the climax where it shows the red matter reaching critical mass. I could not get this part to play without serious breakage and have concluded the rip is bad. Back to the drawing board for my all-linux media box.
I'll be booting into windows XP and using the cheesy software that came with the Blu-ray drive on Tuesday night. Oh, the shame.
* mplayer is the ideal software for the media box because of its support for edit lists, a feature championed (not so coincidentally) and hacked in some years ago by some blokes at BYU. Edit lists let you specify segments of a video to include (or exclude) during playback, making it possible to easily create and legally share a sanitized version of an otherwise lovely film that has a few undesirable scenes or expletives. Think about the possibilities of the Clearplay or CleanFlicks paradigm, but as a free, open source, community effort with no risk of being shut down by lawsuits over copyrights.