BluRay playback and ripping on Fedora (AACS, BD+, BD-J)

There are multiple ways that one can try to make BluRay decryption and playback in Linux. Of course, after some googling and fiddling around, you can see that is quite simple even if not the different instructions are quite confused as they span across multiple iterations of software development.

First of all a brief introduction. It is all explained here in great detail on the BluRay Wikipedia page, this is just an extract.

There are two different types of encryption:

  • AACS, performed using keys)
  • BD+, performed using a small embedded Java VM that executes programs and decrypts contents

And one type of “enhanced” java embedded menu (even small apps, like internet connected browsers, etc.) that can run on the BluRay player:

  • BD-J, using a GEM standard Java VM that includes also BDlive, for internet access

If any of these is implemented in a disk you own, the thing you need to do is simply insert a disk and run the bd_info command (from the libbluray-utils package) against your BD/DVD device.

Screenshot from 2015-08-27 10-59-57

This, of course, does work if you have the proper decryption keys or software installed on your system. That is, by default, nothing. 🙂

So, to enable decryption of the discs, you can proceed in two different ways, one using only open source software (not really, as you need anyway keys and a JVM dump of a BluRay Player) or going through commercial software (free at the moment while in beta).

Unfortunately none of my BluRays worked with open source tools on my system. I was not even able to get the required keys with the aacskeys program; so the proprietary software is my current choice.

Required repositories

In both cases, first of all enable the RPMFusion and the HandBrake/MakeMKV repository. Most of the keys required can be fetched from labDV, where you can also contribute back yours.

For the following examples I’m taking VideoLan as the main player, as it has good support (and a nice interface) to fiddle around with the various settings and is already available in RPMFusion.

Open Source AACS/BD+ decryption

First of all install libaacs and libbdplus from RPMFusion:

dnf install libaacs libbdplus

Then put the required AACS keys in a place, so that your AACS client can find them. For example:

mkdir -p ~/.config/aacs
wget -c http://www.labdv.com/aacs/KEYDB.cfg -O ~/.config/aacs/KEYDB.cfg

Now, VLC, using libbluray, should dynamically load the library if it finds it on the system and then decrypt the AACS protected content if the key for the specific disc is available.

Similar to AACS, put the required BD+ JVM dump in the appropriate folder, so that your BD+ client can find them. For example:

mkdir -p ~/.config/bdplus/
wget -c http://www.labdv.com/aacs/libbdplus/bdplus-vm0.bz2 -O ~/bdplus-vm0.bz2
tar -xvjf ~/bdplus-vm0.bz2 -C ~/.config/

Again, now libbluray should dynamically load the library if it finds it on the system and then decrypt the BD+ protected content using the VM dump in your personal folder.

Do not forget to update the AACS keys and the VM dump every once in a while!

Moving keys and dumps in a system wide location

This is required if you have multiple user for the system and you want to avoid each user into maintaining its own set of keys and dumps.
After installing everything in your personal folder, you will end up with a structure like the following:

$ find .config/bdplus .config/aacs | sort
.config/aacs
.config/aacs/KEYDB.cfg
.config/bdplus
.config/bdplus/vm0
.config/bdplus/vm0/aes_keys.bin
.config/bdplus/vm0/device_discovery_1.bin
.config/bdplus/vm0/device_discovery_2.bin
.config/bdplus/vm0/device_discovery_3.bin
.config/bdplus/vm0/device_discovery_4.bin
.config/bdplus/vm0/device_discovery_5.bin
.config/bdplus/vm0/ecdsa_keys.txt
.config/bdplus/vm0/mem_area_02.bin
.config/bdplus/vm0/mem_area_03.bin
.config/bdplus/vm0/mem_area_04.bin
.config/bdplus/vm0/mem_area_05.bin
.config/bdplus/vm0/mem_area_06.bin
.config/bdplus/vm0/mem_area_07.bin
.config/bdplus/vm0/mem_free.bin
.config/bdplus/vm0/memory.map
.config/bdplus/vm0/mem_player_executable.bin
.config/bdplus/vm0/mem_player_name.bin
.config/bdplus/vm0/mem_player_version.bin

To move up everything to a common location, just performs the following commands:

sudo mv ~/.config/{aacs,bdplus} /etc/xdg
sudo chown -R root:root /etc/xdg/{aacs,bdplus}

That’s it!

Proprietary AACS/BD+ decryption

This is done through MakeMKV, available from the HandBrake/MakeMKV repository, with the registration key available publicly from their forum. The software is fast, works really well, and although not open source is the only way to properly get access to your disks.

Support for external decoders has been added in libbluray some time ago, and allows you to specify different libraries than libaacs/libbdplus for decrypting content.

To proceed, remove the libaacs/libbdplus libraries if you have them installed, and install MakeMKV:

dnf remove libaacs libbdplus
dnf install libbdplus

As explained in the repository page, the MakeMKV package sets up environment variables that override the default libraries using for decryption and just uses MakeMKV’s libmmbd to launch a hidden MakeMKV instance for decryption in the background. To load the environment, logoff and login again, so it is picked up by any program starting.

After logging in, check that the environment is loaded with the following command:

$ env | egrep "LIBAACS_PATH|LIBBDPLUS_PATH"
LIBBDPLUS_PATH=/usr/lib64/libmmbd.so.0
LIBAACS_PATH=/usr/lib64/libmmbd.so.0

Then start VLC, select to open a BluRay disc, with or without the menus. Both will smoothly work as long as it is not a BD-J, as you can see in the pictures below. Menu is navigable, reactive to selections and clickable.

menus

Now also the command bd_info works fine, using the same mechanism.

BD-J Java menus

BD-J support is still in its infancy, at the moment of writing, with the latest libbluray 0.8.1 I am able to get part of the menus working. Most of the time I just got a video loop where the menu should be but not the actual menu. This is much better than having just VideoLan crashing, though. 🙂

Support for this is enabled by installing the libbluray-bdj package. The package puts an OpenJDK compiled Java Archive inside the classpath of the Java VM, so no further configuration is required. To install the package, just do:

dnf install libbluray-bdj

After this, in VideoLan you can just select “Open Disc”, “Blu-Ray” as the source and deselect “No disc menus”. As I said, support is not perfect, in the screnshot below I was able to see the menus but not click on them and in the background I was having a lot of errors.

bdj

I’m tracking the upstream project, so if the library can be rebuilt without breaking compatibility with the additional Fedora packages, I will add it to the repository along with MakeMKV. Before version 0.8.1 I was not even able to open a BD-J enabled BluRay disc with VideoLan.

One final curiosity

All my BD-J enabled discs have a Playstation 3 firmware update on the disc. Don’t know why, but probably because Sony owns the BluRay format so they can do as they please. Meh!

As always, feedback is welcome.

6 thoughts to “BluRay playback and ripping on Fedora (AACS, BD+, BD-J)”

  1. “Proprietary AACS/BD+ decryption

    This is done through MakeMKV, available from the HandBrake/MakeMKV repository, with the registration key available publicly from their forum. The software is fast, works really well, and although not open source is the only way to properly get access to your disks.

    Support for external decoders has been added in libbluray some time ago, and allows you to specify different libraries than libaacs/libddplus for decrypting content.

    To proceed, remove the libaacs/libddplus libraries if you have them installed, and install MakeMKV:

    dnf remove libaacs libbdplus
    dnf install libddplus”

    Am I correct in concluding that this:
    dnf remove libaacs libbdplus
    dnf install libddplus

    Should hav been this:
    dnf remove libaacs libbdplus
    dnf install libbdplus
    ?
    I think it’s a typo that switched the second b in libbdplus with a d.

  2. Thanks for this! I am very grateful for posts like these that help make Linux more usable everyday. Many of us want to enjoy our legal Blu-Ray content on Linux and we need more information on the topic.

  3. Thank you for this grat post!, By now I don’t have a Blu-Ray drive, but surely I’m keeping this for the future.
    Regards

Leave a Reply