So you’ve got a Raspberry Pi (or it’s on your wish list) and want to turn it into a truly great media center? You’ve probably already heard the best media center software around, XBMC, runs pretty well on the Pi. This post will show you how to get the most out of XBMC on your Raspberry Pi.
It’s a great time to give XBMC on the Raspberry Pi a try (or tweak your current setup). The final version of XBMC version 12 was released at the start of this year and RaspBMC and OpenELEC followed shortly. These final versions resolved the last issues and bugs ensuring you get the best possible media experience.
[Update 03-03-2013] Added Video playback/screen frequency and HDMI Hotplug settings instructions.
[Update 04-04-2013] Updated text for final version of RaspBMC and OpenELEC and change link to my latest XBMC Shootout.
The ideal setup
To fully enjoy your movies, music, photos and other media I recommend a setup with the following components (next to your Raspberry Pi obviously):
- Flat screen TV (preferably a recent model that supports CEC)
- 5.1 or 7.1 AV receiver with HDMI inputs (and support for HDMI audio decoding)
- NAS for central storage of your movies, music and photos
- Wired network (at least 100 MBit/s)
A setup like this will give you the best audio and video quality but also has an additional advantage. Because your AV receiver does the decoding of surround audio, like DTS, your Raspberry Pi doesn’t have to. Relieving your Pi from this CPU intensive task allows it to focus entirely on video playback.
This guide assumes your setup looks like this. But if your setup isn’t exactly like this don’t stop reading quite yet. Most of tips and tricks will still help to make your XBMC installation better.
Which XBMC flavor?
The first thing you need to do is pick the best XBMC distribution for the Raspberry Pi. In my latest XBMC on the Raspberry Pi Shootout RaspBMC took over the crown from OpenELEC because of its easy installation and configuration. However looking at performance, start-up speed and time to get up-and-running from scratch, OpenELEC is still the champion. So for this guide we’ll continue with OpenELEC.
If you feel RaspBMC or XBian is better suited for you that’s no problem. Most of the topics covered here will be the same for all three distributions. Some options might be missing and the menus will be different from time to time but you should still be able to follow this guide.
Since OpenELEC doesn’t come with an installer you have to write a disk image to the SD card yourself. Don’t worry. It’s still really straightforward. All you need is a free program called Win 32 Disk Imager which can be downloaded here and an SD card reader.
With Disk Imager installed you can now write a pre-build OpenELEC image (download the file at the bottom of the list) to your SD card. After writing the image the installation is finished and the SD card is ready for use.
If you’re on a Linux or Mac OS X computer you can use the installation instruction on the OpenELEC wiki.
After booting XBMC on your Pi you will be welcomed by the blue colors of Confluence, the default skin. Now it’s time to start configuring your system. If your TV supports CEC you can control your Raspberry Pi with your TVs remote straight out of the box (almost like magic).
Since you need to do some typing and maybe even configure your remote it is nice to have a keyboard plugged in the first few days. Any USB keyboard will do but make sure you plug it in before your power up your Pi (otherwise the keyboard will not always be detected).
First thing to do is to get XBMC in line with your hardware configuration. Head over to System => Settings => System => Video output and change the video resolution to 1920x1080p and pick 60 Hz as refresh rate (or pick the maximum your TV can handle).
Also you need to adjust the audio settings. The Raspberry Pi has no optical or RCA digital audio outputs but luckily it can play almost all surround formats over HDMI (Unfortunately DTS-MA and Dolby TrueHD are not supported on the Raspberry Pi). Just below Video Output you’ll find Audio Ouptut where you need to check if Audio output is set to HDMI. Also set the Speaker Configuration to 5.1 or 7.1 depending on your setup.
To ensure your Raspberry Pi can keep up in fast moving complex scenes you need to set the refresh rate of your monitor to match that of the video. To achieve this head over to System => Settings => Videos => Playback and set Adjust display refresh rate to match video to Always.
Now fast moving scenes will play without glitches or stuttering because XBMC no longer has to pull up the refresh rate to 50 or 60 Hz.The only downside is the slightly increased chance of interference patterns. But these are still far less annoying than shocking movement in scenes.
XBMC connects to your network just fine out of the box but it uses a dynamic IP address. For several reasons (which I will discus later) it is easier to give your Raspberry a fix IP address.
Under System => OpenELEC => Settings => Network => IP Settings enter an easy to remember IP address which is valid for you network and doesn’t clash with your local IP range. Also enter the addresses of your gateway and DNS servers. (You can find the values for gateway and DNS servers by opening a Command prompt on your computer and type ipconfig /all ).
If this is all abracadabra to you it’s also possible to skip all of this and use the dynamic IP address given to your Raspberry. This address is unlikely to change either but there are no guaranties. You can find your IP address under System => System information.
OpenELEC has a few built-in services that make your life a lot easier and more fun. Let’s explore the most interesting ones.
One of those services is Samba which lets you connect to your XBMC machine like any other Windows network share. I suggest you go to System => OpenELEC => Services and enable this.
With Samba enabled you can manually update to the latest and greatest version of XBMC without loosing your settings. Nice for the daring and impatient. Samba also lets you upload movies and other media to your Raspberry Pi’s storage (SD card or external USB drive). Finally you can also edit your configuration files directly over Samba, a feature we’ll use later on.
When you own an iPad, iPhone or iPod another service definitely worth enabling is AirPlay. AirPlay lets you stream videos, music and photos to your Raspberry Pi directly from your Apple devices. Just like on the Apple TV but for less than half of the price. You can enable AirPlay under System => Settings => Services.
The last service you should enable is the webserver. With this service turned on you can control XBMC with your tablet or phone (discussed later on) or even from a web browser. After enabling the webserver in the Services menu open your favorite browser and navigate to http://openelec.
If CEC is supported by your television you’re probably already controlling XBMC with your TVs remote. Great! This works very well out of the box but there are a few issues we need to resolve.
Pushing the right buttons
Your TV only sends CEC signals to your Raspberry Pi it doesn’t use itself. So pressing the Menu button will open the menu of your TV instead of the XBMC menu. This is probably not what you want.
To fix this XBMC has a feature called Custom Mappings. You can use custom mappings to map one of the buttons on your remote you don’t use to become the Menu button for XBMC. I don’t use the color buttons on my remote for XBMC so let’s map Yellow to the XBMC Menu.
To do this you need to create a file called keymap.xml and edit it to have the following content:
<keymap> <global> <remote> <yellow>ContextMenu</yellow> <green>PreviousMenu</green> <blue>Info</blue> </remote> </global> <FullscreenVideo> <remote> <yellow>OSD</yellow> <green>NextSubtitle</green> <blue>Info</blue> </remote> </FullscreenVideo> </keymap>
As you can see this also maps two other buttons that I find rather useful.
Once your file is ready you need to copy it to the Raspberry Pi using Samba. Open the Windows File Explorer, go to \\openelec\Userdata\keymaps and copy the keymap.xml there (replace openelec with your Pi’s IP address if it doesn’t open). After rebooting your Pi the yellow, green and blue buttons should work.
Like said before CEC works out of the box. Unfortunately it tries to be a bit too smart resulting in some unwanted behavior.
Because I use a Logitech Harmony remote I want to control all devices myself and don’t have the CEC adapter turn on or off my TV. Since we’ve connected the Pi to the TV over an AV receiver letting CEC control my devices probably wouldn’t work perfectly anyway.
Also I sometimes leave my Pi powered on while switching off the TV and AV receiver so I can continue to watch that movie straight away. Since the Raspberry Pi only consumes a few watts I don’t think Al Gore will get too upset reading this. But it is pretty upsetting to find out your remote isn’t working anymore when you come back.
Fortunately you can remedy these issues by changing the CEC adapter settings. The menu you’re looking for is hidden under System => Setting => System => Input devices => Peripherals => Raspberry Pi CEC Adapter.
If you want to control all devices yourself just like me set options 3 and 4 to none and disable options 6 and 8 (see screenshot bellow). Changing the “When the TV is switched off” option to Ignore fixes the problem of the remote not working when you come back.
Controlling XBMC with a tablet or phone
XBMC can also be controlled with your tablet or smartphone. This eliminates the need for a CEC compatible TV. But even when you do have a working CEC configuration using your phone or tablet to control XBMC is still worth setting up.
All you need to do is to enable the XBMC webserver (see instructions above) and install an XBMC remote app on your phone or tablet. For iOS the official XBMC Remote will do just fine. On Android the official remote seems to be broken but Yatse is a great alternative. Both apps can automatically find your XBMC instance (and only need to do this one time if you gave XBMC a fixed IP address).
Once connected you can use your phone like a regular remote control. But you can also use the library mode to browse through your media collection on your phone and start movies and music directly. This means you don’t need to turn on your TV when you just want to listen to an album. On top of that you can configure XBMC to automatically pause playback when you receive a phone call. How cool is that?
Media Center Remote
When all the ways to control XBMC described above are not an option you’re not condemned to the keyboard quite yet. Microsofts Media Center remotes work well with XBMC too and can be picked up from shops or eBay for little money. Again maybe some custom button mappings need to be created but apart from that it should be plug-and-play.
The Need For Speed
The user interface of XBMC on the Raspberry Pi is known to be a bit laggy. Although things have improved a lot since the first test releases the Pi still isn’t the king of speed. Time to do something about it.
First thing that has to go is the RSS feed at the bottom of the screen. I use my tablet and phone to read my RSS feeds. So why should my Pi burn its precious CPU cycles on showing me stuff I already know? Disabling the RSS feed seriously helps and you can do this under System => Settings => Appearance.
Another way to speed up your Pi a bit further is to overclock it. Normally the Pi runs at 700 MHz but you can make it run up to 1000 MHz with loosing your warranty. Not all Raspberries will run stable at 1000 MHz and you’ll have to figure out the maximum frequency yours can handle. But 800 or 900 MHz should be just fine.
The easiest way to overclock your Pi is to mount the SD card on your PC and edit the config.txt file in the root of the SD card (using WordPad of Notepad++). Find the Overclocking section and edit the frequencies and voltage to match one of the suggested presets. After your finished save the file and boot your Raspberry Pi to enjoy a (slightly) faster XBMC. I run at Medium (900 MHz) without any problems.
Both steps described above will only make the user interface smoother. Video playback is mainly handled by the graphics processor which already does a good job at playing (full HD) videos. So if you’re happy with the standard performance of the user interface you can just leave things the way they are.
One of the last things you probably want to do is tell your Raspberry Pi to always use HDMI as output. If you power up your Raspberry before your TV or AV Receiver is switched on your Raspberry Pi doesn’t detect an HDMI output device. As a result it falls back to composite output and you’ll just see a black screen once you turn on your TV.
It’s very easy to solve little glitch. In the same config.txt file as the step above look for the line that says: # hdmi_force_hotplug=1 and remove the # and the first space. After that you need to make sure your Pi also boots in the right resolution otherwise you’ll end up with something like 720P at most. To do so add the next two lines:
and save your changes. This will start your Raspberry Pi in 1080P at 60Hz (and CEA mode). If your TV doesn’t support this resolution or mode pick a supported resolution from this webpage.
From now on your Rasperry Pi will always boot into XBMC using HDMI and your preferred resolution.
Adding and configuring Media
Of course the main purpose of running XBMC is to watch movies and listen to music. In order to do so you need to tell XBMC where to find your media files. You also need to tell XBMC what types of media you’ve got so it can index them properly.
Like said before I assume you’ve got a central place on the network, like a NAS, were all media files are stored. This means you’ll be streaming movies and music over the network to your Pi. This works fine if you setup things properly.
XBMC lets you choose between a few different network protocols to connect to your remote file storage. NFS is the protocol with the smallest overhead and best performance and this makes it the best choice for streaming videos and music to your Pi.
How to set up a NFS file server is beyond the scope of this guide but most NAS systems support NFS out of the box. If you’re using a Synology NAS like I do, you should read this article. While configuring NFS I’d suggest creating 4 different shares: Movies, TV Shows, Music and Photos. This makes it easier to set the content type for indexing later on.
Once your NFS shares are in place you can add them to your XBMC media library. To add your music and photo shares simply go to Music and Photo and select Add source. In the menu that opens click on Scan, select Network Filesystem (NFS) and hit OK. XBMC should now find your NFS server. Click it to show all its shares. Pick the appropriate share, give it a useful name and you’re done.
Adding your video shares works slightly different. Head over to Video => Files => Add Videos… and perform a scan just like you did for Music and Photos. Now pick your Movies share and again give it a good name. Next you get to set the media type for this share. Select Movies and click OK. Also click on Yes in the next menu to immediately index your library. Repeat these steps for your TV Shows as well.
If the previous steps went well you should see two new menu items on your home screen: Videos and TV Shows.
Add-ons are a great way to expand XBMCs functionality even further. They are divide into 4 categories: Video, Music, Photo and Program add-ons. The last category contains add-ons that add features to XBMC itself.
Installing add-ons can be done in two ways. The first way is to go to Photo/Video/Music/Program => Add-ons => Get more… . In this menu you can browse and install plugins from the official XBMC add-on repository.
To install third-party Add-ons or add new add-on repositories you must head over to System => Settings => Add-ons. With the Install from zip file option you can install downloaded Add-ons and even third-party repositories. The Add-ons menu is also the place where you can enable, disable and remove installed Add-ons.
Which Add-ons are interesting for you depends on your personal interests. Many people will probably install the YouTube, Flickr and Picasa add-ons. Another interesting add-on is XBMC Backup. You can use this add-on to backup your entire XBMC configuration to any location XBMC has write access to or even straight to Dropbox. You don’t want to lose your precious configuration. Right?
Another powerful feature of XBMC is Profiles. Profiles let you create different configurations for different purposes. I’ve got a profile called ‘Children’ that only contains videos and music for my kids. On top of that it automatically selects the Dutch audio track if a movie has multiple tracks and never loads subtitles because they’re too young to read anyway.
On the Raspberry profiles have another advantage. Indexing your libraries can slow down your system noticeably especially on devices with limited resources like the Raspberry Pi. Splitting up your media library with different profiles means you’ll only have to scan parts of your entire media collection. Also not having to browse through all albums and movies you’re not interested in helps you to find what you’re looking for a lot faster.
Making new profiles is really easy. Use System => Profiles => Add profile… to create a new profile. Give it a sensible name and just go with the default directory. You can use “Copy from default” if you want to use the same settings as the master profile. You can also reuse the media locations but often it makes more sense to start of fresh.
To switch between profiles you can use the power menu to log off the current user. This takes you to the login screen you also see when you start up XBMC (if enabled under System => Profiles). Unfortunately logging off and on again can be quite slow on the Raspberry Pi. There is a shortcut though. Go to System => Profiles, select the profile you want to switch to and press Menu => Load.
Is that all?
By now your XBMC configuration is pretty much complete. You can finally start to do what you installed XBMC for in the first place: sit back, relax and watch that awesome movie.
“What about Netflix or Hulu?” I hear you say. And the new PVR feature? Or all those other great plugins out there. I know. There is so much you can do with XBMC that I could write an entire book about it (maybe I should…. someday). This guide just covers the most common XBMC pitfalls and Raspberry Pi specific issues.
The best way to discover XBMC is to just play with it. So grab your remote (or phone) and start exploring the menus, libraries and add-ons. You’ll see XBMC is really user-friendly and you will discover lots of great features not discussed in this blog post. And if you get stuck you can always hop over to the XBMC Wiki for further information. Also this great article on Lifehacker contains some of very useful information.
I hope this guide will help you to set up and fine tune XBMC on your Raspberry Pi so you can enjoy it as much as I do. If you think I’ve missed something truly important or have any other suggestions or comments feel free to contact me or leave a reply bellow.