One of the great things about the Raspberry Pi is that it not only has plenty of power to play back high definition video, but it also has the HDMI output to allow you to do so. This would naturally lead the media enthusiasts among you to think of the possibilities for using the RasPi as a media centre, but the list of advantages don’t stop there. It has network support to stream video, has a ridiculously small form factor so you can tuck it out the way, and of course the low price doesn’t hurt.
The potential for the Raspberry Pi’s use as a media centre hasn’t gone unnoticed by the community, and thanks to its open-source nature, there are two great options to get XBMC working on your RasPi. RaspBMC is a Debian Remix that’s simple to install, and OpenELEC is a bit more challenging, however it works just that little bit better. Both of these solutions run as well as any other Home Theatre PC, with high definition video playback, and generally smooth menu navigation. In this guide we’ll show you how to make the most out of a RasPi HTPC.
Step 1 Download RaspBMC
RaspBMC comes with its own installer, which you can download by using wget in the terminal:
$ wget http://svn.stmlabs.com/svn/raspbmc/testing/installers/python/install.py
This downloads the install.py file that will install RaspBMC to an SD card
Step 2 Prepare RaspBMC
To install RaspBMC, you’ll need to first change the persmissions on the install file like so:
$ chmod +x install.py
Then make sure you have the right SD card in your system, and that any important files on it are backed up
Step 3 Install RaspBMC
Now you can install with:
$ sudo python install.py
And follow the instructions to install on your SD card. It will usually be listed as something like sdb, and have a 4 GB/4000 MB capacity
Step 4 Set-up RaspBMC
You’ll now need to plug the SD card into your RasPi, then plug it into a display and turn it on. Make sure it’s also connected to the internet, as it will then download and update all the necessary files to get it working
Step 5 Video Out
The Raspberry Pi has an extra video out port, the yellow composite port. You plug that in and it will automatically recognise it. You can also change the resolution and refresh rate in Settings, System Settings, Video Output
Step 6 Headphone Out
If you’re using the video out port and not HDMI, then you’ll need to use the headphone jack to output the audio. You can get a cable to hook this up to a TV, but you’ll also need to go to Settings,System Settings, Audio Output, and change it to Analogue
Step 7 USB Storage
There are two main ways to watch your media – either stream it over the network, or by attaching USB storage with it on. Be aware though, there are limited USB ports on the RasPi, and if you connect a USB hub it will need to be powered!
Step 8 Video Source
Connected and Networked storage can be added as sources to XBMC. Go to Videos on the main menu, then Add Videos. For connected devices and some network shares, you can go to Browse, and select it. You’ll be then asked where to get metadata from to finish.
Step 9 Add Network Source
Sometimes XBMC might not see your network share, but you can still add it. Your shares are more than likely down via samba, especially if you have Windows computers in the house. The file path you need to add before you hit browse will look something like this:
Step 10 Get OpenELEC
Alternatively you can use OpenELEC on your RasPi to get XBMC on there. We need to grab the source for OpenELEC like so:
$ git clone git://github.com/OpenELEC/OpenELEC.tv.git
We can use the source files to build any version of OpenELEC, obviously we want it for RasPi
Step 11 Prepare your system
When building, it should grab all the required packages. It cannot do this on all distros all the time though, and may print a list of packages you require. In Ubuntu, you’ll need:
$ sudo apt-get install g++ nasm flex bison gawk gperf autoconf automake m4 cvs libtool byacc texinfo gettext zlib1g-dev libncurses5-dev git-core build-essential xsltproc libexpat1-dev autopoint
Step 12 Configure Perl
You may need to configure Perl on your system. All you need to do is open the terminal and run the following commands:
$ sudo perl -e shell -MCPAN
Run through the automatic setup by typing yes, then pressing return at each step, then:
Now we can move on to the actual build
Step 13 Build OpenELEC
Move into the OpenELEC TV directory by using CD:
$ cd OpenElec.tv/
This is what you’ve just downloaded. Now you can start building it by running this:
$ PROJECT=RPi ARCH=arm make
It’s case sensitive, so be exact.
Step 14 Partition the SD Card
To partition, install GParted with:
sudo apt-get install gparted
Then use it to create two partitions on the target SD card. Create a 128 MB FAT32 partition at the beginning, and fill up the empty space remaining with an EXT2 partition. Apply changes, and then right click on the 128 MB partition, and add a boot flag to it.
Step 15 Install OpenELEC
Mount your SD card, which can normally be done by unplugging and pluggin it back in. We’ve named our 128 MB partition System, so it’s mounted as /media/SYSTEM. Make sure you’re in the OpenELEC.tv folder like before and do the following:
$ sudo cp build.OpenELEC-RPi.arm-devel/bcm2835-bootloader-*/arm128_start.elf /media/SYSTEM/start.elf
$ sudo cp build.OpenELEC-RPi.arm-devel/bcm2835-bootloader-*/bootcode.bin /media/SYSTEM/
$ sudo cp build.OpenELEC-RPi.arm-devel/bcm2835-bootloader-*/loader.bin /media/SYSTEM/
$ sudo cp target/OpenELEC-RPi.arm-devel-*.system /media/SYSTEM/SYSTEM
$ sudo cp target/OpenELEC-RPi.arm-devel-*.kernel /media/SYSTEM/kernel.img
$ echo “boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 ssh quiet” | sudo tee /media/SYSTEM/cmdline.txt
This will get the necessary files moved to the boot partition we created. Once this is done, plug in your RasPi, networking and all, and it will boot straight into XBMC after a few seconds ready to go
Step 16 Nightly Build
It’s not recommended, but in RaspBMC you can switch to a nightly build of XBMC. This means you can play Hi10 video files, common in more recent high definition encodes. It is unstable though, so use with caution!
Step 17 Command Line
If you fancy doing a bit more advanced customisation of your setup, you can always enter the command line by plugging in a keyboard at boot time and using Ctrl+Alt+F2 to enter the command line. You can then use Ctrl+Alt+F7 to return to XBMC
Step 18 Remote Control
There are some specific remotes that will work with XBMC out of the box, these include:
XBOX DVD playback remote
You’ll need to have the receivers plugged into the USB port before you turn the RasPi on for it to be automatically recognised.
Step 19 Input Settings
There are various Input Settings you can play about with under System in the Settings menu. If you’re having problems with your remote, you can always set it to register as keyboard presses, and you can optimise the UI for mouse or touch screen use
Step 20 Remote App
If you’ve got an Android device, you don’t need to buy a separate remote for your new HTPC – there’s plenty of XBMC control apps on the Google Play store, even an official one. These will automatically connect to an XBMC HTPC on the same network
Step 21 Manual Remote App
You may need to add your RasPi manually to the remote. To find the IP you’ll need, go to System, System Info, Network. Here you’ll find the IP address, for example 192.168.1.10. In add new host on the mobile app, add this. The Username and Password is by default xbmc
Step 22 Remote Web
Under Settings, Services, you can turn on a web server to control XBMC from any web browser on the same network. Enable “Allow control of XBMC via HTTP”, and note the port number, e.g. 80. Finding the IP address like above, go to 192.168.1.10:80 in your browser to access it
Step 23 Power Concerns
As the Raspberry Pi is USB powered, you might consider plugging it into your TV if it has a USB port. This will provide enough power for it to run, and as you need to disconnect the power to fully turn off the RasPi, turning off the TV does that for you.
Step 24 RasPi HTPC
There’s plenty of other little tweaks you can do in the settings to have it set up to your taste, and you may also want to look into cases to house the RasPi in your living room. For the price and size though, you won’t find a better HTPC.