Linux Format

Blu-ray on Linux....................

Is running Blu-ray on Linux smooth sailing or more like banging your head against the wall? John Knight finds it’s a little bit of both.

-

John Knight explores how Linux users can enjoy watching Blu-ray films, and finds a morass of hideous tools and DRM to circumvent.

Any Linux user who has tried to play a Blu-ray disc will have made the unpleasant discovery that they don’t just immediatel­y play and that some legwork is required. A quick Google will reveal varying states of grimness, and depending on when the website was written, you will receive differing accounts on how to play Blu-rays, and just how useful Linux/Blu-ray is right now.

The problem lies in copy protection and legal issues. Although Linux is more than capable of playing Blu-ray titles with perfect performanc­e (there is a decent chance that your Blu-ray player is in fact running a Linux kernel), since their inception, Blu-ray discs have been closely guarded by a draconian form of digital rights management. On top of this are legal difference­s from country to country as to what one can and cannot do with digitally protected media, creating further headaches for developers. And just to make things that little bit harder, there are vested interests from a conglomera­te of major corporatio­ns, including Microsoft, who back in the day would have had little desire to see Linux users have easy access to Blu-ray.

So is it all doom and gloom for Linux users? How do we play Blu-rays, and why can it be so hard in the first place? Let’s see how Linux/Blu-ray looks in 2017 and try to get it working in the process.

Project: www.labdv.com/aacs

“There is a decent chance that your Blu-ray player is in fact running a Linux kernel.”

If you’re as lazy as us, you glanced at the instructio­ns in that URL just given and thought, “too hard, can’t be bothered”. But stick with it – it’s easier than it first looks. You’re going to install some libraries, download a file and then copy it somewhere. That’s it. Two minutes and you’re done.

First, open your package manager and install the packages libbluray and libaacs (it’s probably also worth installing the -dev packages while you’re there). Now download the Blu-ray keys file from the URL provided (filename KEYDB.cfg), and copy it to the folder: ~/.config/aacs.

For any novice users, anything with a . before the file name is a hidden file or folder. So if you want to use a graphical file manager, turn on Show Hidden Files, and open the

.config folder hidden in your Home directory. If the aacs folder doesn’t exist then create it, and copy the keys file there.

For grumpy command line veterans, just enter these two commands: $ mkdir -p ~/.config/aacs/ $ cd ~/.config/aacs/ && wget http://vlc-bluray. whoknowsmy.name/files/KEYDB.cfg

Let’s get this out of the way now: there’s a reasonable chance your disc won’t work. Don’t panic, because we’ll explore what to do from there, but of the ten discs we tried, three didn’t work. This is due to encryption issues, which will form the second half of the article, but for now just grab a selection of Blu-rays to maximise your chances of a working title.

Unlike DVDs, you have to mount the disc first. Just use your desktop’s device manager – you don’t need to do any fancy command line stuff here.

VideoLAN is the best place to start because it’s the easiest way to find out if a disc will work, without needing to use the terminal. Click the Open Disc dialogue and choose Blu-ray. You’ll see “No disc menus” ticked – just leave that alone for now and we’ll re-explore it later. Now click Play and with any luck your Blu-ray will fire up. If not, move onto the next disc.

Congratula­tions if your movie is playing without incident – unfortunat­ely there’s a decent chance that you’ll have some kind of performanc­e issues, such as skipping and cracking. You may however be able to work around this by tweaking your settings, such as lowering the quality (which kind of defeats the point of Blu-ray), or setting all the video drivers to “VA API”.

Now let’s try MPlayer. Our favoured GUI, SMPlayer, didn’t have a dialogue for playing Blu-rays so you may need to use the terminal like we did. Panic not though, as it’s dead easy. Assuming your drive’s device name is “sr0” enter the following command – otherwise just

replace your drive’s device name: $ mplayer br:////dev/sr0

And yes, you need the four slashes – don’t ask us why.

On our machine the playback was much more stable than with VideoLAN and played without any skips, dropped frames, or graphical corruption. However – and it’s a big however – trying to seek through the video usually crashed MPlayer, whereas VideoLAN seeked just fine. Furthermor­e, unless you’ve edited your config file MPlayer will default to stereo, meaning that if you want surround sound, you’ll need to play around with some very awkward command line switches (which is not fun at all).

Neither of these players were working out for us, and we were very surprised to find a saviour in our long lost friend xine. If memory serves correctly, xine’s GUI dates back to the ‘90s but don’t discount it, because (a) it worked for us far better than VideoLAN or

MPlayer, and (b) it’s easy to configure your driver and sound options (such as speaker setup, digital or analogue sound, using Nvidia’s VDPAU driver, and so on).

Although xine has a Blu-ray button it didn’t work for us, so you’ll probably need to use the terminal. But once again, fear not – it’s even easier than MPlayer! Just enter this command and enjoy the results: $ xine bluray:/dev/sr0

Ultimately, if VideoLAN is working without performanc­e issues then stick with that: you can seek without crashing, and you can even

use menus if you have experiment­al libraries installed. But most importantl­y, you can open a disc without having to faff about in a terminal. Neverthele­ss, the aforementi­oned Blu-ray performanc­e issues are very common, though the VLC team are promising much better performanc­e in version 3.0. For now, ye olde xine might be your best bet if you don’t mind entering an easy terminal command.

MakeMKV

So why didn’t some of your discs work? Because in order to watch an encrypted Bluray – which will be most of them – you require a key: from keys that were in the file you downloaded earlier. If the key isn’t there, you don’t get access. Depressed? Well there is a workaround... for the moment.

MakeMKV is primarily a ripping program for decrypting Blu-ray in order to rip disc contents into Matroska videos, but it also has the wonderful ability to stream movies to a local port which can then be run in almost any player. So what’s the catch? For one thing, it’s shareware (we didn’t realise it was 1992). And it has a trial period of thirty days, after which you need to pay for it. Neverthele­ss, it is a pretty damn cool app and worth checking out.

If you head to bit.ly/1hIJcdn you’ll find a forum thread with the Linux version and installati­on instructio­ns. We’re sorry to say we don’t have the space to cover the installati­on, but we can tell you that it is slightly convoluted by two tarballs, though no harder to install than your usual source tarball. Thankfully they had the good manners to provide the package names for needed libraries and even a command for Ubuntu derivative­s.

When you stream a disc, you can’t just copy the URL given by MakeMKV and paste it into your player – nothing will happen. You first need to open the URL in a web browser where you can then navigate through the disc structure. Choose the title number you want, copy the link location from the browser, and then you can paste the needed URL into your favourite player.

Speaking of which, we found VideoLAN was glitchy with constantly cracking playback, however SMPlayer gave excellent performanc­e. Note that if you have no sound, you may have to change audio streams from your player menu: audio streams might not produce sound if it’s a direct surround signal and your sound setup is something like analogue stereo. If you have a surround amplifier, choose digital out ("AC3/DTS pass through S/PDIF” with SMPLayer) under Sound Options. (If you have a cheap sound card, you might be out of luck, sorry.)

Evil encryption

So what makes Blu-ray so hard to support, and why can’t we just crack its encryption the way we eventually did with DVD? JeanBaptis­te from the VideoLAN team: “Blu-ray is quite complex to support, for two major reasons: DRM and Interactiv­e Menus. The video part of the Blu-ray is not that hard to do, since it’s regular codecs, but the packaging is very complex to handle.

“Indeed, menus, navigation, bonuses and games can either be done in a simple format, similar to DVD menus, or with a Java runtime called BD-J. As usual, there are no public specificat­ions, and even if there were, a lot of the discs don’t really follow it, so that requires a lot of work.

“DRM is of course the second big mess. Blu-ray has multiple layers of DRM. The two that are of interest to us are AACS and BD+. AACS is a documented crypto-system that relies on cryptokeys and certificat­es. The open source community has a good implementa­tion of this, but without the keys, it’s not really useful. And the keys are permedia, per-software and per-drive and they get revoked all the time.

“To give you an idea, inserting a new Bluray could revoke your drive certificat­e and then you wouldn’t be able to read any Blu-ray with this device until you updated the firmware! Even the ones that you already played [owning stuff is great–Ed]! So people share large configurat­ion files containing disk keys on various websites... Not fun.

“The second DRM is BD+, which is a full virtual machine that executes the DRM code

that could come with the disk (we’re not joking). It’s very hard to implement correctly, and integrates also with the Java layers, and has certificat­es too. There are no good open source implementa­tions of this system.”

So how does Joe Public fight back against The Man, to rightfully play his own discs? Well the chief ways are supplying keys and bug reports on menus, with keys being the most needed resource – although for legal reasons, we cannot endorse this.

Being an experiment­al technology, Blu-ray menus are disabled by default. According to the Arch Linux wiki, Blu-ray menus can be used if you install libbluray-git instead of libbluray, so you might need to do a little digging if you’d like to get menus working and contribute bug reports.

So what about keys? Well that’s where things get harder. If you have a Windows system about, then you’re well catered for: just follow the link to where you can upload keys and read the info on what software to use, and how to use it. Linux on the other hand is a great deal harder: MakeMKV no longer works the way the given how tos rely upon – they reference files and folders that don’t seem to be there any more – and further software and documentat­ion is buried away in an endless maze of forum posts.

Despite spending several weeks chasing down leads and trying different methods, we just couldn’t get our software to squeeze out a key. And although we’d like to provide you with a simple guide on key grabbing, we’d probably find ourselves in considerab­le hot water – so if you’ll forgive us, we’ll remain deliberate­ly vague here. Either way, follow the links and forum instructio­ns, and hopefully you’ll fare better than we did.

What’s next?

Perhaps you’re depressed by this state of affairs, but seven out of ten discs (at least in our quick test) isn’t too bad a hit rate, is it? Plus, running without menus by default is actually kind of refreshing: instead of wading through endless menus and warning screens, you’re in the movie in a matter of seconds. Looking at where Linux Blu-ray was a few years ago, we can confirm that developmen­t has come a long way, and will only continue in leaps and bounds if we can really get behind it as a community.

Keys and menu testing aside, what we really need to provide as a community is boring old leg-work and organisati­on. We’re not trying to be rude towards the developers, but these last few weeks have been an endless maze of old and broken links, outdated documentat­ion, and broken bootstrap files. It’s understand­able. These people aren’t being paid for this, and maintenanc­e is the tedious aspect of any software project. Most programmer­s just want to get on with the coding. If you would like to contribute somehow but can’t program yourself, perhaps you can help out in these tedious admin jobs, and provide updated how tos so that the coders can spend more time on real tasks?

For any angry film executives who might be reading, most of us probably aren’t even interested in ripping, and just want to rightfully play the discs we’ve bought without having to change OS. As far as we know, there are no commercial­ly available Blu-ray players for Linux, and even though we are open source advocates, we’d still be interested in a shrewdly-priced proprietar­y program if given no alternativ­e –unless you can tell us better.

So where do we sit in terms of project completion and Blu-ray perfection? We’ll give Jean-Baptiste the final word on that:

“For code, it’s mostly done. For keys, it will be a long and never-ending battle.”

For more pointers on Blu-ray playback than you’ll know what to do with, see the excellent Arch Linux Wiki: https://wiki. archlinux.org/index.php/Blu-ray.

“We just want to play the discs we’ve bought without having to change OS.”

 ??  ?? MakeMKV + web browser + media player = play any Blu-ray you like... for 30 days.
MakeMKV + web browser + media player = play any Blu-ray you like... for 30 days.
 ??  ?? xine’s playback of Midnight in Paris was just as gorgeous as the film itself.
xine’s playback of Midnight in Paris was just as gorgeous as the film itself.
 ??  ?? Blu-ray menus will be disabled systemwide by default, but it is utter luxury skipping those endless warning screens!
Blu-ray menus will be disabled systemwide by default, but it is utter luxury skipping those endless warning screens!
 ??  ?? VLC skipped and cracked, MPlayer crashed whenever we tried to seek and was a pain to configure, but good old xine played perfectly.
VLC skipped and cracked, MPlayer crashed whenever we tried to seek and was a pain to configure, but good old xine played perfectly.
 ??  ??
 ??  ?? Playing legally owned Blu-rays? Madness.
Playing legally owned Blu-rays? Madness.
 ??  ??

Newspapers in English

Newspapers from Australia