Raspbmc – Control XBMC with your TV remote using HDMI-CEC

Edit: Raspbmc RC4 now has CEC enabled out of the box – No need to enable the XBMC web server. It uses the newer libCEC which has significantly better support for different manufacturer CEC-based implementations, so chances are it will work just fine with your CEC-enabled TV.

CEC is a specification that allows control of CEC-enabled devices that are attached through HDMI.

Raspbmc has included a basic implementation of CEC in version RC3, meaning you can now control your Raspberry Pi installation from your CEC-enabled TV remote (well in theory, anyway).

You’ll need a CEC-enabled TV or amplifier that is connectioned to your Raspberry Pi via the HDMI connector.  Not all CEC-enabled devices are created equally, though, and might support a different subset of the specification. This means that CEC on your device might not interface with XBMC at all, or some of the remote buttons won’t be mapped correctly. On the Samsung Anynet+ (Samsung’s version of CEC) TV I tested on, the arrow keys and enter was working, but pause, play, stop etc. wasn’t. Your mileage may vary.

Support for CEC was only included in Raspbmc from version RC3, but it is not present in the normal XBMC build. It is enabled by default, but in order for it to work, you need to activate XBMC’s web server:

  • Go to Settings -> Network -> Services
  • Set “Allow control of XBMC via HTTP” to on.
  • Set the username to “xbmc” and leave the password blank
  • Make sure the port is set to 8080

Enabling CEC control of XBMC on your TV should be simple – select the source input and select the XBMC CEC device input (The TV should automatically pick up XBMC as a CEC device).

Reducing lag while watching HD videos on Raspbmc / Raspberry Pi

I’ve noticed some lag while playing HD movies on my Raspberry Pi with Raspbmc from my SMB shares. I’ve found an easy way to fix this by reducing video refresh rate during video playback (forum topic here).

In XBMC, go to Settings -> System Settings -> Video output -> Refresh rate. (this seems to be a Raspbmc-specific setting, so you won’t find it in XBMC)

Set this number to a lower setting. The ideal setting would be the highest refresh rate that still allows all or most of your videos to play without lag, so that you have the highest quality video output possible.  So you’ll need to do a bit of experimentation with your setup to find the best refresh rate setting.

Sync multiple XBMC media libraries, including Raspbmc

If you have more than one XBMC installation on your network, centralising your media library has many benefits:

  • Your watched / unwatched statuses are shared between media centres
  • You can watch a video in one room and continue watching it in another – without needing to find your place (in theory :))
  • You only have one library that needs to be updated

The basic steps towards setting this up:

  • Make sure all your media is shared so that it is available to all PC’s on your network
  • Change all the paths in your media library to point to the shares instead of a local file system
  • Set up a MySQL server that contains your library data that all your XBMC installations can connect to
  • Configure all your XBMC installations to use the MySQL server for it’s library data

The process is very well documented on the XBMC wiki, but there is one very important point to note – and this is especially relevant if you are using Raspbmc on a Rasperry Pi – Your XBMC versions must all be the same!

The problem is that XMBC uses a numbering scheme in the database name used for it’s video and music libraries, I suspect to manage schema changes from one version to the next. So, if you have XBMC Eden (v11) installed, your video library database might be called “myvideos60”. If you use a nightly build, the version number appended to the end will be different. The result? If your versions differ between XBMC installations, your library will simply not be picked up by one or more of your media centres. If you are using Raspbmc, you are using a nightly build. This means that the only way to share your media library on MySQL is to make sure your other XBMC installations are also using a recent nightly build.

So, with that important caveat noted, follow the instructions on the XBMC wiki. For your Raspbmc instance, be aware that there is already a advancedsettings.xml file created, unlike normal XBMC installations where this file is not present by default. Just append your library database settings to the existing settings in the file.