Sep 192012
 

Last week I published a blog and video of watching a DVD in Raspbian using omxplayer. At that time, as far as I could make out, nobody had managed to watch a commercial encrypted DVD, with the DVD drive attached to the Pi, but I figured it was only a matter of time. I ended that blog with…

There is a way to watch encrypted DVDs in linux, but I haven’t sorted it out on my Pi yet. Hopefully a future video will detail that process.

Well, I tried a few different things but was unable to get it working. However, one of the forum members, mikerr, has come up with a creative way to get the job done. This is the thread mikerr started, here.

Basically, you install mplayer, compile and install the libdvdcss decryption library and then set up a video stream in the background, which you then view with omxplayer. It puts all the elements together in a way that works on the Raspberry Pi. :)

So now I’m going to show you how it’s done…

Starting Point

I started with a freshly flashed SD card containing the August release of Raspbian, then fully updated/upgraded it.

sudo apt-get update
sudo apt-get upgrade
(This takes a little while ~15 mins)

Then install mplayer, which handles the decryption and streaming for us…
I did the whole install starting from /home/pi

cd /home/pi
sudo apt-get install mplayer
Y
(to confirm)

Compiling libdvdcss

wget http://www.videolan.org/pub/libdvdcss/1.2.12/libdvdcss-1.2.12.tar.bz2 (download the zipped archive)
bunzip2 libdvdcss-1.2.12.tar.bz2 (unzip the archive)
tar -xvf libdvdcss-1.2.12.tar (unarchive the files)

cd libdvdcss-1.2.12 (change to the libdvdcss directory)
./configure (run the configuration)
make (compile libdvdcss)
sudo make install (install the compiled files)

sudo cp /usr/local/lib/libdvdcss* /lib (copy the installed files to /lib)

Streaming a DVD

For reasons that I don’t understand, this works for me when I use ssh for the last two commands and not if I do it from the keyboard attached to the Pi. I’m sure someone could figure this out, but not me. ;)

mkfifo /tmp/dvdpipe

Then I ssh into the Pi to execute the next two commands…

mplayer dvd://1 -dumpstream -dumpfile /tmp/dvdpipe 1>/dev/null 2>/dev/null </dev/null & (sets up the stream)

omxplayer -o hdmi -r /tmp/dvdpipe (uses omxplayer to view the stream)

That’s the quick and dirty instructional. I’ll see if I can make a video tomorrow. :)

  11 Responses to “Watch encrypted DVD on Raspberry Pi by streaming to omxplayer”

  1. About why last two commands only works when you use ssh, try looking at ‘echo $PATH’ on both environments, ssh and keyboard.

  2. What DVD drive did you use?

    • Samsung 22x Super WriteMaster SE-S224 :) I already had it. I certainly wouldn’t advise anyone to go out and buy a DVD drive to watch things on the Pi though. You’d be better off with a DVD player. I tried it because I had it. :)

  3. Rather than using a DVD drive hooked up to the Pi, I just stick the disk in my computer and mount the drive over the network using sshfs (I have ssh configured in both directions for this). I’ve been doing this with normal video files, but I’ll have to try this pipe trick to get DVDs working. With luck, it will also work for other video files that omxplayer doesn’t seem to like!

    • I haven’t really done much with this since that post. It was a bit experimental and, in reality, I don’t have many DVDs to watch. It was more of an experiment than anything. It’d be much easier to rip a DVD and watch the .H264 file on the Pi. Or just put the DVD in a DVD player. :-D But it’s nice to play about just to see what can be done. :)

  4. About why you can’t run the two commands at the end from keyboard, go into ‘XTerminal as root’ and execute them. Because doing echo $PATH in that terminal brings up the same result as doing it through SSH. I haven’t tested it with an actual drive, but that should work :)

  5. It appears that both DVD and Blu-Ray discs are supported, but disabled in the stock images, downloadable from openelec.tv . However, if you have a regular Linux box, you can download and compile the source code for OpenELEC, and compile, it should have support for such.

    Details available here:
    http://wiki.openelec.tv/index.php/Compile_from_source

    I am compiling now to test and be sure.

    • Ok, so everything compiled, but I discovered upon testing that I had the 8.0 alpha version of OpenELEC as this is apparently the default. In order to get version 6.0 of OpenELEC, I appended “OpenELEC-6.0” to the “git clone” line that is listed in the link I gave above. Thus, for Raspberry 2 & 3, the correct commands are:

      –begin code block–
      git clone https://github.com/OpenELEC/OpenELEC.tv.git OpenELEC-6.0
      cd OpenELEC-6.0/
      PROJECT=RPi2 ARCH=arm make image
      cd target/
      #secure erase sd card. Replace mmcblk0 with your computer’s SD card device node if different.
      sudo shred -vzn 0 /dev/mmcblk0
      #write image to SD Card. My SD card slot is /dev/mmcblk0. Change this below if yours is different.
      gzip -cd OpenELEC*.img.gz | sudo dd of=/dev/mmcblk0 bs=512
      sync
      –end code block–

      Take out the SD card, and pop into your Raspberry Pi 2 or 3.

      Below is a snippet of the output from the ‘make Image’ command.

      – Kodi version: kodi
      – Kodi include language files: yes
      – Kodi nonfree support: yes
      – Kodi Blu-Ray support: yes
      – Bluray BD+ support: yes
      – Bluray AACS support: yes
      – Kodi DVDCSS support: yes

  6. just a suggestion to work faster with tar.bz2 files: “tar -xjf file.tar.bz2”

Leave a Reply