Featured Posts

Play DVD disks on Raspberry Pi

Posted by Mike Redrobe | Posted in Technology | Posted on 19-09-2012

Tags: ,


In August the Raspberry Pi Foundation started selling MPEG2 codec licenses for the popular Raspberry Pi.

With this installed, the Pi can decode MPEG2 directly on its GPU chip, with very little CPU usage. The ARM CPU used in the Pi isn’t really powerful enough to decode MPEG2 on its own.

Since DVDs use MPEG2, this is a very welcome addition as it means hardware accelerated playback for DVDs.

Unfortunately due to the legal position on decrypting the CSS encryption on DVD disks, many distributions don’t include the relevent files.

You can get around this by compiling it yourself on the Pi, and here’s how:

Download and extract the libdvdcss source code:

wget http://www.videolan.org/pub/libdvdcss/1.2.12/libdvdcss-1.2.12.tar.bz2
sudo apt-get install -y bzip2
tar -xvjpf libdvdcss-1.2.12.tar.bz2

Compile it (only takes a few minutes):

cd libdvdcss-1.2.12
sudo make install

All done, now copy the libraries over:

sudo cp /usr/local/lib/libdvdcss* /lib

Now we can play a DVD direct from the disk:

mkfifo /tmp/dvdpipe
mplayer dvd://1 -dumpstream -dumpfile /tmp/dvdpipe 1>/dev/null 2>/dev/null &
omxplayer -r /tmp/dvdpipe

This may come to XBMC eventually, but current XBMC DVD code doesn’t allow for hardware acceleration.

Comments (3)

Hi mike,

your tutorial is great. I am now able to play DVDs using your methode without copying anything to a hard drive or anything.

I had to adjust the dvd device for mplayer but than it worked:
mplayer dvd://1 -dvd-device /dev/sr0 -dumpstream -dumpfile /tmp/dvdpipe 1>/dev/null 2>/dev/null &

There is only one little problem left. Every DVD i tried was played with an aspect ratio of 720×576. omxplayer doesnt offer any option to set the resolution – i dont have found one. So my question is, do you know how to fix this last problem?

Hi mike,

thank you for making this wonderful tutorial. I also would like to play DVD’s on my pi, but I’m still having problems with your instructions. As I understood it, the basic steps are, assuming the license and libdvdcss etc. are set up:
#creating a virtual .mpg file
#Letting mplayer dump the DVD cotents into this file
#Finally playing the file using the HW-accelerated omxplayer.

Creating the file is no problem. Dumping the DVD is a bit more complicated: In the mplayer-command, using dvd1://1 does not work at all, I can only reach my DVD drive if I explicitly call “mplayer /dev/sr0 […]” or “mplayer /dev/dvd1 […]”. Appending the ://1 (I assume this is for selecting a title, correct me if I’m wrong), so that is says “mplayer /dev/sr0://1 […]”, always leads to mplayer aborting with “No stream found to handle url /dev/dvd1://1”. Similarly, the 1>null etc. does not work, only if I explicitly say 1>/dev/null. What the heck is wrong here? And why does the ://1 not work?

Well, as this does not work, I was trying to dump only /dev/sr0 to the file (which is the DVD main menu) – which seems to work, as mplayer starts dumping (about 0.1% every 10 seconds). After about 1.8% it says “Stream dump complete”.

Now I tried playing the stream using omxplayer (“omxplayer -o local pipe.mpg”, with pipe being in the current directory). But that doesn’t work either, omxplayer just tells me about which audio and video codec it uses and how many subtitles are available. After that, nothing happens, the program seems to be stuck somewhere and I have to force it off. Why does omxplayer refuse to work???

Well – as I’m not able to play my file hardware-accelerated, I use “mplayer pipe.mpg” instead – and this works, but of course only at 8fps.

Can you help me with this? I really don’t know what to do… Thanks in advance!!!


On OSMC, “make” is not installed by default.
You must first run “sudo apt-get install make”.

Write a comment