Play DVD disks on RaspBMC - HOWTO


11 posts
by mikerr » Thu Sep 20, 2012 12:22 pm
Here's how to add DVD playback support into RaspBMC
(requires MPEG2 key installed on SD card - buy one here:
http://www.raspberrypi.com/mpeg-2-license-key/)

i.e. Playback commercial DVDs direct from attached USB DVD drive

While it works, it only plays the film, no dvd menus.

SSH into the running RaspBMC

Download and compile libdvdcss:

Code: Select all

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

cd libdvdcss-1.2.12
./configure
make
sudo make install
sudo cp /usr/local/lib/libdvdcss* /lib


Install mplayer

Code: Select all
sudo apt-get install -y mplayer


Make a directory to store the virtual file (named pipe)

Code: Select all
sudo mkdir /dvd


Make the background script:

Code: Select all
sudo nano /sbin/playdvd.sh

Code: Select all
mkfifo /dvd/dvd.mpg
while :
do
        mplayer dvd://1 -dumpstream -dumpfile /dvd/dvd.mpg 1>null 2>null
        sleep 5
done

ctrl+X to save the file

Make it executable
Code: Select all
sudo chmod a+x /sbin/playdvd.sh


Add it to startup:

Code: Select all
sudo nano /etc/rc.local


add the line
Code: Select all
playdvd.sh

before exit 0.

(ctrl+x to save and close)


In the XBMC GUI:

Add /dvd as a video folder in XBMC

When you want to play a dvd, play the dvd.mpg file (which is really a named pipe)


The script running in the background will take care of dvd changes.
Pi count: 4 - File & print server / Wifi Webcam server, XBMC and tinkerPi !
User avatar
Posts: 466
Joined: Thu Jan 12, 2012 12:46 pm
Location: NorthWest, UK
by mikerr » Fri Sep 21, 2012 9:13 pm
I've packed all the above steps into a single script, so all you need to do now is type the following at the SSH prompt:

Code: Select all
wget https://dl.dropbox.com/u/2434217/pi/xbmcdvd.sh
sh xbmcdvd.sh


(takes about 10 mins to run)

Then add the DVD folder in the XBMC GUI.
Pi count: 4 - File & print server / Wifi Webcam server, XBMC and tinkerPi !
User avatar
Posts: 466
Joined: Thu Jan 12, 2012 12:46 pm
Location: NorthWest, UK
by mikerr » Sat Sep 22, 2012 10:19 am
Also tested to work fine with Xbian too.
viewtopic.php?f=35&t=12893
Pi count: 4 - File & print server / Wifi Webcam server, XBMC and tinkerPi !
User avatar
Posts: 466
Joined: Thu Jan 12, 2012 12:46 pm
Location: NorthWest, UK
by rogerdodger » Sun Sep 23, 2012 10:21 pm
Before I try this, I have 2 questions to understand it all since I'm not a linux expert:
- I dont understand the connection between the /dvd/dvd.mpeg and the files on the USB drive? ie. how can you select the dvd on the usb drive that you selected to watch?
- does this also work for audio_ts and video_ts structures?
Posts: 1
Joined: Sun Sep 23, 2012 9:57 pm
by mikerr » Mon Sep 24, 2012 9:01 am
This isn't for DVD ISO images, its for DVD disks in a physical DVD drive.

How it works "behind the scenes":

XBMC isn't compiled with DVD support, just mpeg playback.
XBMC also can't read commercial DVDs due to encryption.

So what this does is:
a) decode the DVD encryption
b) stream the mpeg files from DVD into a "virtual file" (dvd.mpg)
Note since this is a virtual file, it doesn't use up any space, and is only filled up/emptied from the DVD on demand as its played.

XBMC thinks it is playing a standard mpeg file, so is happy.

Its always pointed at the DVD drive, if you have a USB drive full of many ripped DVD images you'd have to create a GUI,
or type a command into the shell each time - I do do this occasionally:
(see development thread here: viewtopic.php?f=35&t=17598)

This will all be natively in XBMC at some point.
Pi count: 4 - File & print server / Wifi Webcam server, XBMC and tinkerPi !
User avatar
Posts: 466
Joined: Thu Jan 12, 2012 12:46 pm
Location: NorthWest, UK
by s7mx1 » Mon Sep 24, 2012 9:28 am
Native playback of CD/DVD will be in RC5. We will not include libdvdcss for obvious reasons and this means you can not playback encrypted disks. However you can always compile xbmc yourself with libdvdcss enabled following the wiki.
Posts: 79
Joined: Fri Sep 30, 2011 9:28 am
by Allen » Wed Sep 26, 2012 3:11 pm
s7mx1 wrote:Native playback of CD/DVD will be in RC5. We will not include libdvdcss for obvious reasons and this means you can not playback encrypted disks. However you can always compile xbmc yourself with libdvdcss enabled following the wiki.



Frankly DVD support without css is about as much use as a chocolate fireguard....
Posts: 3
Joined: Fri Jul 20, 2012 11:44 am
by pedroserano » Mon Nov 19, 2012 11:38 pm
RC5 latest nightly build has dvd support. Awesome! So you only need to do the first step on this tutorial, plus obviously buy an mpeg license from the RPi foundation and plug in a dvd player.

[edited for grammar]
Posts: 2
Joined: Sun Nov 18, 2012 3:01 pm
by juup » Sat Dec 22, 2012 3:14 pm
Hi,
tried this howto with a fresh installation of raspbmc on a 512-Raspberry-Pi with MPEG-licence.

Before installing libdvdcss nothing happens when "play DVD" in XBMC GUI.
After install it plays ~10 seconds of a DVD and then the screen stops and nothing work anymore. Even a "shutdown" via ssh change nothing. Do I have to change anything else?

Thanks
juup
Posts: 1
Joined: Sat Dec 22, 2012 3:05 pm
by setsanto » Tue Dec 25, 2012 11:24 pm
Same issue here.

The player freezes after each scene leading up to the menu. You can skip forward once it freezes, but clicking play at a dvd menu causes a complete system freeze. Skipping to a point inside the movie causes the movie to begin playing from that point onwards. It's all a little bizzare.
Posts: 2
Joined: Tue Dec 25, 2012 11:20 pm
by Stu42 » Wed Dec 26, 2012 12:42 am
I followed the first steps of the tutorial and have an MPEG2 license.

When I plug in my USB DVD drive, it mounts, and raspbmc correctly reports the title of the DVD, but when I try to play the disk, it just displays the Rpi's directory structure. I would expect it to at least show the DVD's directory structure.

What step am I missing?

I have the RC5 build from Dec 23rd installed.
Posts: 3
Joined: Sun Dec 23, 2012 5:25 am