Play DVD disks on RaspBMC - HOWTO


22 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.
Got a Pi Camera? View it in my android app - Raspicam Remote ! No software required on the pi
User avatar
Posts: 1190
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.
Got a Pi Camera? View it in my android app - Raspicam Remote ! No software required on the pi
User avatar
Posts: 1190
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
Got a Pi Camera? View it in my android app - Raspicam Remote ! No software required on the pi
User avatar
Posts: 1190
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.
Got a Pi Camera? View it in my android app - Raspicam Remote ! No software required on the pi
User avatar
Posts: 1190
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
by sambra22 » Fri Jun 28, 2013 11:04 pm
hi sir
i need help i wanted to add a code that will decrypt a video before playing it by the XBMC media center
so the idea is i will have my own video encrypted by switching some of its bytes to protect it from use and i want to put that video into a SD Card or a USB Drive and play it on RPi so the RPi will decrypte the selected video and then play it to tv
is ther any way i can do this please sir
i really need help with this sir
thank you a lot
Posts: 2
Joined: Wed Jun 26, 2013 8:58 pm
by dafe » Tue Sep 24, 2013 7:29 pm
There is a way how to play DVD disks and DVD ISOs in natural way without using external player and addon.

I'm using raspmbc.

Recompile raspbmc with --enable-dvdcss deploy on your PI and enjoy.
For this you need to follow http://www.raspbmc.com/wiki/technical/building-xbmc/.
Before the step:
make -C /path/to/xbmc/source/tools/rbp/depends/xbmc
you should modify
/path/to/xbmc/source/tools/rbp/depends/xbmc/Makefile
and change
--disable-dvdcss to --enable-dvdcss
then you can continue with rest of the building procedure.

I guess that libdvdcss is disabled in raspbmc on purpose.
Because of licensing issues.
I would like to have some option to choose libdvdcss by myself.
Some kind of setting.
Posts: 1
Joined: Tue Sep 24, 2013 7:26 pm
by franzheinz » Sun Oct 06, 2013 11:47 am
mikerr wrote: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.


To make it work, I had to start wget with the option "no-check-certificate". So you may have to use this:

Code: Select all
wget https://dl.dropbox.com/u/2434217/pi/xbmcdvd.sh --no-check-certificate
sh xbmcdvd.sh
Posts: 1
Joined: Sun Oct 06, 2013 11:42 am
by wardbones » Fri Jan 24, 2014 3:26 pm
Hi, everybody :)

I used the script and happily, it's working wonderfully. My only problem is that the player is playing subtitles automatically. When I go to the subtitle menu, it shows "None" and asks if I want to download subtitles. Anyone know how I turn that off?

Much appreciate your time
Posts: 2
Joined: Fri Jan 24, 2014 3:20 pm
by wardbones » Fri Jan 24, 2014 4:26 pm
http://forum.xbmc.org/showthread.php?tid=120938

While watching a movie, bring up the on screen display (M on keyboard) select audio and turn off subtitles. Now select set this as default for all movies.


Should have done a google search first, sorry...
Posts: 2
Joined: Fri Jan 24, 2014 3:20 pm
by ronaldolsthoorn » Tue Feb 18, 2014 4:43 pm
@dafe

I tried to run your tutorial exactly, but it's not working. There is some library missing:

Code: Select all
checking for LIBBLURAY... yes
checking for libbluray soname... libbluray.so.1
checking for bd_register_argb_overlay_proc in -lbluray... no
checking for library containing iconv_open... no
checking for library containing libiconv_open... no
configure: error: Could not find a required library. Please see the README for your platform.
make: *** [configure] Error 1


Any ideas?
Posts: 5
Joined: Mon Jan 06, 2014 9:02 pm
by ninapat » Mon Feb 24, 2014 9:28 am
hi
i can play a dvd well : 15% cpu, just a few wait in top command
for audio cd , works for 20 sec and it's freezing for 10 sec and so on : 100% wait cpu
i play it with mplayer that way :
mplayer -vo null -vc dummy -ao pcm:waveheader:file=fifo.wav [INPUT]
omxplayer fifo.wav

do you have an idea ?
Posts: 18
Joined: Wed Aug 01, 2012 4:15 pm
by dominik007007 » Fri Mar 07, 2014 10:46 am
Can you please update the script? It is not by me (to do an update)
Posts: 1
Joined: Fri Mar 07, 2014 10:43 am
by dlamet » Sun Mar 23, 2014 9:25 pm
I've successfully run the script. However, /dvd only contains a zero-byte mpg. I've tried several different DVDs. All show the same 0-byte mpg file. Did I do something wrong? Could some kind soul run who has the script working run an ls and post it here to show me what should show in the /dvd directory? Thanks.
Posts: 1
Joined: Sun Mar 23, 2014 9:21 pm
by basicmark » Mon Mar 24, 2014 12:39 pm
ninapat wrote:hi
i can play a dvd well : 15% cpu, just a few wait in top command
for audio cd , works for 20 sec and it's freezing for 10 sec and so on : 100% wait cpu
i play it with mplayer that way :
mplayer -vo null -vc dummy -ao pcm:waveheader:file=fifo.wav [INPUT]
omxplayer fifo.wav

do you have an idea ?


mplayer doesn't work very well with USB CD/DVD drives when to comes to playing audio CDs, I found that mplayer2 (apt-get install mplayer2) works fine however. The underlying issue seems to be which library is used during CD play back (http://unix.stackexchange.com/questions ... th-mplayer).
Posts: 20
Joined: Thu Feb 27, 2014 11:54 pm
by ninapat » Tue Mar 25, 2014 1:08 pm
basicmark wrote:mplayer doesn't work very well with USB CD/DVD drives when to comes to playing audio CDs, I found that mplayer2 (apt-get install mplayer2) works fine however. The underlying issue seems to be which library is used during CD play back (http://unix.stackexchange.com/questions ... th-mplayer).


thx

it's also ok with vlc. i'll have a look to mplayer2
Posts: 18
Joined: Wed Aug 01, 2012 4:15 pm