In the last week in August (2012), the Raspberry Pi Foundation started selling MPEG2 codec licenses for the Pi. Basically without this you can’t do anything worthwhile with MPEG2 – the DVD file format. Although it’s an old codec, a lot of people have media libraries with MPEG2 files in, and some TV is still broadcast in MPEG2.
You can use this license code to unlock the hardware decode functionality (for MPEG2) of the Pi’s GPU (Graphics Processing Unit). The Pi’s GPU is 95% of the main chip. It’s a real powerhouse for its size. So it’s great to be able to unlock some of its capabilities.
(640×400 video available at end of this post)
In order to use MPEG2, you need to buy an MPEG2 codec from THE Raspberry Pi shop FOR £2.40
You will receive a code and instructions by email. Install the codec unlock code by adding it to your /boot/config.txt file
You also need to have fairly recent firmware (from around 3rd week in August, or later). You can get this with…
sudo apt-get update
sudo apt-get upgrade
Once that’s done, you need to reboot (sudo reboot) and attach your external USB DVD drive. It needs to be externally powered. The Pi won’t be able to provide enough power to run a DVD drive through the USB ports.
Once connected, type…
This will show you all the drives connected. One of them should be your DVD drive.
if your drive is mounted at /media/DVD VIDEO RECORDING, change “/pathto/yourdrive” to “/media/DVD VIDEO RECORDING” (if it has spaces in, like mine, you’ll need to enclose it in quotes).
then you want to see what’s on the DVD, so
should show you a couple of folders. We want the one called VIDEO_TS, but it may be different for different types of DVD format.
Then list the files.
There should be a list of files ending with .VOB. Choose the one you want (VTS_01_1.VOB in my case) and type
omxplayer -o hdmi -r VTS_01_1.VOB (change VTS_01_1.VOB for your chosen filename).
Then sit back and relax. When you’re done watching, press Q to quit. If it crashes on quitting (mine does sometimes), you’ll have to ssh into your pi to reboot it (sudo reboot).
You can find some other omxplayer keyboard commands here https://github.com/huceke/omxplayer#using-omxplayer
Don’t Expect 100% Reliability
It won’t work every time. Mine works better when I call it up via ssh rather than the main console. I have no idea why, but when on main console, omxplayer regularly locks up on quitting. Running it through ssh, this doesn’t happen.
It may not work well with YOUR drive. I won’t be able to help with that – sorry.
It won’t work with encrypted DVDs – like the commercial, copy-protected ones you buy. This will only work with your own recordings. 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. I’m also planning to do a blog post about watching a DVD with OpenELEC some time soon, so watch this space. :)