2016-01-10

Handbrake, LibDVDCSS, and Windows 10.

While on my work laptop (A Lenovo T430 that I'm exceptionally happy with, and can heartily recommend, but sadly is only available used these days) I'm very happy with my Linux Mint install, at home I still have what was in the (not so?) distant past called a "Wintendo".

With this in mind, after setting up a reasonably sized NAS at home, I decided that it was time for me to start digitizing media that I have currently. Most of it is DVD or CD Audio, as I haven't made the jump to BluRay as of yet.

My go-to for almost all DVD ripping in the past has been Handbrake. It's a reasonably usable interface with a reasonably fast encoding engine behind it. What's happened since the last time I set it up has been that DVD copy protection has become massively onerous, due to many reasons which are beyond the scope of this article. Most places that you start to look for side-stepping this stuff (which is a massive grey area legally in the United States and possibly other places. You have been warned.) say "download libDVDCSS from [some weirdly site] and drop it in your handbrake folder".  This kind of works, but most of the links seem to be to an older version of the library (1.2.x) instead of being built off a current copy of the code.  So I decided to document what I did to compile this myself on my wintendo, which happens to be running Windows 10 64B at this point in time.

You'll need to set up and download some things to get all this to work, so if you're into "one click solutions", this isn't for you.  Due to the legal nature of mentioned above, I'm not going to provide a link to the finished product.  Have fun and learn something.  Or not, I'm not your conscience.

You'll need to install a build environment.  The recommendation from VideoLAN (who wrote the library you're going to be compiling) is to use the suite of tools provided by MinGW.  MinGW has a very nice installer that you can get from http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download.

When you get that installed, accepting all the defaults (they appear to be mostly sane), run the installation manager.  You'll be presented with a fairly simple 3 pane UI.  In the top right pane, select "mingw-developer-toolkit".  It'll spin for a few moments before coming back and putting a check in the box.  Click the "Installation" menu and then select "Apply Changes".  This should complete what you need to do with this application.

You'll need to download the code that you're going to be compiling from VideoLAN.  You can grab it from http://download.videolan.org/pub/libdvdcss/last/.  It looks like the latest as of this writing is 1.4.0.  It also looks like it only is available in a bz2 file.  7-Zip (http://7-zip.org), one of many compressed file managers, can open this for you.  I personally like 7-zip because it's scriptable and open. However you unpack this, put it somewhere you can find it easily.  I'm lazy and generally put stuff like this on my desktop. 

Once you decompress the files, you'll need to open a command prompt, but not the one you think you need to:  You'll need to open a MinGW prompt to make things easy.  You can open this by running "C:\MinGW\msys\1.0\msys.bat", assuming that C:\MinGW is where you configured the installer to put all of the MinGW stuff.  This will open a command prompt that looks a bit strange, but will make your life MUCH easier.

Now's when it gets a bit more complicated.  You'll need to change directory to where you unpacked your copy of the DeCSS code.  Since I put mine on my desktop, in my MinGW bash window, I change directory like so:

cd /c/Users/captslaq/desktop/libdvdcss-1.4.0/  

Once in the proper directory, it's pretty straight forward, and documented in the INSTALL text document:
./configure
Configure, in a nutshell, checks the state of your system and then builds out a file to tell the compiler what it needs to do.  This will spit out a list of status messages before exiting without any real complaint, assuming everything works.
make
Make runs all the things that the file(s) spit out by configure tells it to.  It'll carp about some things, but in the end it will exit without an error.  When this is done, you'll have a new folder, .libs, in your folder.  Inside there, you'll find a copy of libdvdcss-2.dll. You don't even have to rename it anymore.  Using windows explorer, just copy libdvdcss-2.dll into your handbrake folder.  You now have a current version of libdvdcss that should work as expected.




5 comments:

proprocks said...

Did the resulting DLL work for you? I tried pub/libdvdcss/last/ and pub/libdvdcss/1.4.0/ with no luck. The best I get is garbled video in Handbrake. I tried building both in Win7x64 and Win10x64.

I did notice that just mingw-developer-toolkit wasn't enough for me to build. I also had to select/install mingw32-base in order to get the C compiler.

BrokenAtari said...

Hello, I tried compiling many versions and the only that actually worked with handbrake was the older 1.2.x branch.

Anonymous said...

I was able to to do it following the instructions on a post at rootengineeer.net.

Jonathan Ou-yang said...

Following the instructions I got compile errors about conflicting types:

src/common.h:37:19: error: conflicting types for '_off_t'

Instead of calling "./configure" directly, I did as instructed in rootengineer.net :

./configure --host=x86_64-w64-mingw32

This allowed me to call "make" and build the dll successfully (the dll will be located in ".libs" folder).

Anonymous said...

rootengineer guide has moved to: https://stackengineer.com/multimedia/build-libdvdcss.html