Building a Media Center with a Raspberry Pi

Raspberry Pi

At £29 the Raspberry Pi is a great device for tinkering around and learning about Linux and programming. But the Pi also makes a great Media Center device thanks to its cheap price, lower power consumption, small size and the ability to run XBMC.

XBMC is an open source Media Center project original designed for the first Xbox (hence the name Xbox Media Center) and runs on a variety of platforms including Android, Windows and Linux. As XBMC is an open source project you could make your own build for the Pi but the fantastic Raspberry Pi community have put together various pre-made packages of XBMC specifically for the Pi.

So the first thing you need to do is get a Raspberry Pi, head to raspberrypi.org, select a distributor. In my case I ordered one from RS Components and one from element14 and both were pretty good.

Once you have your Pi you will need to install a distribution. The Raspberry Pi uses an SD card for storing the operating system and programs so you will need a SDi. I use a 16GB card but you could get away with a 4GB card, the nice thing about using SD cards is that you can have different distributions on each card so its really easy to try out new configurations.

Raspberry Pi SD card

Connecting up a Raspberry Pi to your TV is best done with the HDMI cable, the Pi outputs audio via HDMI so it’s the easiest way to get the audio and video output all in one cable. You can also route audio out through the headphone port on the Pi but there is no optical output on it. Video can also be connected up using the Composite Video port but this is standard definition and not HD so its ok for playing around with but not great. The audio settings are in the Settings/System/Audio Output. Here you can choose between HDMI audio or Analog output. You can also select AC3 and DTS options.

Raspberry Pi audio settings

When it comes to installing an operating system on the Pi there are plenty of options to choose from. For the Media Center project you will want to use XBMC and there are a few different builds to choose from: Raspmbc, OpenELEC, XBian and DarkELEC are some of the most popular. All of them are based on XBMC and designed for the Raspberry Pi, they all have subtitle differences and very strong communities around them. For this guide I am going to use Raspbmc as it’s the distribution that I have spent the most time with.

Right so you have you Pi and SD card next you need to download the XBMC image, so head to Raspbmc http://www.raspbmc.com/download/ and get the download. There are installers for Windows and Mac OSX or you can download an image and copy it to the SD, all the details are on the download page and it’s all pretty simple to get working.

Once you have XBMC up and running you can use it to watch videos in encoded in mp4 format either attached via a USB drive, a network drive or via a DLNA server. If you want more information on XBMC I would head to XBMC.org, there are tons of tutorials and guides to getting started with XBMC.

If you want to watch DVD rips or Windows Media Center Recorded TV files on the Raspberry Pi you will need a MPEG2 decoder and the Raspberry Pi foundation sell the license key for £2.40.  Installing the license is very simple, you purchase a license from the Raspberry Pi store and they email a code to you. The codes that the Raspberry Pi foundation email should then be added to a file called config.txt which is located on the boot partition of the Pi’s SD card. You must do this for each image you have built for the Raspberry Pi and the code is linked to the serial number of your Pi so you will need to purchase a code for each Pi you own. You can read more about what the codecs get you in this blog post.

Most builds of XBMC have a simple way of adding the code. In Raspmbc you can go to the Programs section and load Raspbmc settings and then in the system configuration tab go to advanced settings and click on the MPEG2 codec license and enter the key you got in your email. The Raspberry Pi foundation also have VC1 codec licence that you can install on the Pi if you need that format.

With the codecs you can now you can play h.264 and mpeg2 encoded files so that means you can record TV shows in Windows Media Center and play them on the Raspberry Pi (Unfortunately not copy protected shows). You can copy media content to a USB stick and plug it into the Pi and play content straight from it. So you could record a show on your Media Center system and copy it to a USB drive and then play it on the Pi. I used a powered USB hub so I can plug a 1TB external hard drive in to it.

Recorded TV on the Raspberry Pi

You can find the USB content in XBMCs videos section, click Add Files and then click on the drive name and you will see all the content on the drive and be able to play them in XBMC.

XBMC selecting a USB drive

You can also use UPNP and browse content stored on NAS devices, Windows boxes and other servers. To do this you click on Add Video sources and then click on Browse. You can then pick from pick from a variety of sources. All my UPNP machines on the network where listed as a source, I added my PC as a source and then I could browse the content and playback the videos on the Raspberry Pi. I can play mkv, WMV, WTV files and MOV files stored on my Media Center box on the Pi.

Most NAS boxes have DLNA servers built into them and Windows Media Player is DLNA server. You could also setup another Raspberry Pi as a media server, plug in external storage into it and stream the content to a Raspberry Pi client, see this post for more details. You could even stream content from an iPad or Android device using an app like Twonky Beam or Samsung Allshare, I was able to send videos from my phone to the Pi using Twonky Beam. Network shares can be added a a source, so you could share out folders on a PC or server and connect to them from the Pi.

There are other options for consuming content on the Pi, if you have Media Center system setup you can use DVBLink from DVBLogic. DVBLink network enables Media Center TV tuners so you can watch TV on other devices in the home. As well as having clients for Android, Windows Phone and iOS there is an addin for XBMC. So you can install the addin on your Pi XBMC setup and then watch live TV.

To get this working you need to download DVBLink for Windows PC and walk through the setup wizard to network enable your tuners, the best place for help on DVBLink is to go to DVBLogic’s forums. Once you have DVBLink up and running you can download the DVBLink XBMC addin and then watch live TV on the Pi browse the EPG and setup recordings.

DVBLink with XBMC on a Raspberry Pi

There are other options like using a networked TV tuner. I have a HDHomerun which is a TV Tuner with a network port so you can access it from any device on your network. Getting this working is pretty simple and I have written a step by step guide here and it’s another way of getting live TV on the Pi.

HDHomeRun with XBMC on a Raspberry Pi

There are also streaming options as XBMC supports many addins, there are many addins for video services like YouTube, Vimeo and others, for live TV there is TVCatchUp which has most of the UK terrestrial channels and works very well on Pi.

As well as using a mouse and keyboard to control XBMC you use a remote control. I got my old Windows Media Center remote with USB IR device and plugged it in to the Pi. You will need to configure the remote and map the buttons, you can find out how to do that from this guide.

Media Center remote with a Raspberry Pi

You could also use a smartphone or tablet app to control XBMC. I use the official XBMC remote app for Android which works very well. As well as working as a remote it also can give you things like now playing info and you can browse content stored in XBMC. You can find the app in Google Play.

XBMC Remote on Android with a Raspberry Pi

There are many other things you can do with XBMC including using CEC over HDMI to control the Pi with your normal TV remote control. CEC enables passing remote control commands from one device to another so your TV remote can control XBMC. You can also use XBMC built in PVR features which are still in development and use back end servers like TVHeadend, DVBLink, MediaPortal and MythTV. You can read more about XBMC’s PVR here.

I haven’t talked about music or pictures in this post but with XBMC sharing music and pictures is just about the same as with video. So the same features apply, you can access content stored on a USB drive, network share or UPNP.

You may also want to get a case for your Raspberry Pi, there are lots available and I got a laser cut Acrylic case for £9.99 (more details here)

Raspberry Pi in a case

So for £29 the Raspberry Pi makes a great little Media Center and at the same time will help you learn a lot about XBMC and Linux. The way I got it to work in my home is by having a Windows Media Center PC with all my content on and have it serving TV via DVBLink, I then use the Raspberry Pi as a Media Center Extender and plug it into which ever TV I want to watch the content on.

I have only covered some of the basics here, there is a lot more you can do with XBMC but hopefully this will get you started and it would be great if we can keep updating this post with tips on using the Raspberry Pi.

 

About the author Ian Dixon:
Ian Dixon is a Microsoft MVP (Most Valuable Professional), founder of TheDigitalLifestyle.com tech site and producer of the weekly The Digital Lifestyle Show podcast. Ian has been writing and talking about Windows for over 10 years and has over 20 years in IT as an IT Manager. Ian has thousands of followers on Twitter and Facebook and over 4 million views on his YouTube channel.

8 thoughts on “Building a Media Center with a Raspberry Pi”

  1. matthew moore says:

    great write up. I will be tackling this project here in a couple days. Thank you.

  2. Stuart says:

    Great post was very interesting read it. Need to buy my first Raspberry PI soon I think! Thanks

  3. Aurelien says:

    Thnaks for this post, it makes me movitvated enough to buy a raspberry pi to use id as a media center ! I chose OpenElec for the system.

    What surprised is how simple it is to get a full usable media center with a raspberry pi. No advanced knowledge is needed, which is pleasing.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses cookies.
Subscribe to our YouTube channel for review, guides and how-to videosView channel
+ +