For many years I have been seeking solutions to reducing my ever increasing cable TV bill, and to that end I built a Windows Media Center with a Ceton infinity PCI card and an HDHomeRun as video sources. I used the Xbox as a Media Center Extender, and for the most part it was great as long as I had a wired connection. But the Xbox was expensive and at the time remote controls were not great, and people complained that we could not use Video on Demand. I succumbed to the pressure and went back to the expensive Cable STB/DVR and non-DVR STB – which cost me $17.95 plus $9.95 respectively, altogether $27.90 extra per month. Enter the Raspberry Pi.
I stumbled upon posts from people using XBMC on the RP and now I have a renewed mission to get rid of the non-DVR devices in my home, which is the HD-STB and two Digital Terminal Adapter (DTA). I figured that I can reduce the bill by 1.99 each per DTA, 1.99 each for the DTA extra outlet and 9.95 for the STB (called an additional outlet) totaling $13.91 per month. They jacked up my cable card rental from $1.50 to $9.95 now. Jeez. I wish I could save more, so I am looking into the satellite services now – but I digress…
I admit I have been having fun with my Pi’s (I have many now) and the idea of using Pi’s as a Media Center Extender seemed not much harder than other Pi projects I embarked upon. However, this little excursion was far more challenging than I expected because I naively expected the project to be painless and simple. I had googled “XBMC raspberry pi” and other similar keyword combinations and found many web pages, forums and stories of people that said they are doing it, and many felt it was simple. Others were fraught with roadblocks that were eventually overcome. I read many of these posts in earnest multiple times – and I decided to tackle the challenge.
Before you get the impression this is too hard to do, it is really not that hard. In fact, much of the “heavy lifting” of installing XBMC and configuring options has been done for us. There are a few projects that have done a great job of simplifying the XBMC installation on the Pi, (like RaspBMC and OPENELEC) as a media center, and there are many front-end Add-On’s to XBMC for PVR functionality.
But there are a few gotchas along the way that many forget to mention or they are buried deep in the FAQ’s. I am as guilty as anyone assuming the reader has a particular skill / experience level with Windows Media Center, firewalls, video codecs, licensing, linux, networking, wireless, or whatever. This is my attempt to describe the forest that lies ahead – the forest that many well meaning people trodding the path before you have already navigated. For them and I, the clearing has been reached, and the trees surrounding us don’t seem all that large now. Still they block the view you now see from the outside. My journey is nearly complete and its fresh in my mind so let me give you an idea of what lies ahead.
My requirements were specific:
- Build a device that acts like a media center extender
- Use a Raspberry Pi (B+)
- Use XBMC as the “front end”
- Use a hand held remote, or mobile app for EPG
- Use a TV monitor for the viewing experience
- Use my existing Windows Media Center as the “backend”
- HDHomeRun is the source for Over The Air (2 tuners)
- Ceton / Cable Card for cable networks (4 tuners)
- Spend as little time as possible
- Make it as bullet proof as possible
The Raspberry Pi
I wanted to use the latest hardware available, so I purchased the following:
- Raspberry Pi B+ through Amazon, ($48.00 w/shipping)
- Zebra Black Ice case from Engrained Products, ($22.10 w/ shipping)
- Micro USB Wall Charger Adapter, 5V 2A, $12.99
- Samsung 32GB microSD card from my local Walmart – ($24.99)
I could have saved a little money in shipping had I actually bought all the stuff in one order – oh well. I bought a 2A power supply in case I needed more power for USB peripherals someday. I have an infrared adapter on the way, but in the mean time I connected a USB keyboard and USB mouse to the RP to do the installation and test the apps. I had an HDMI cable already, and I am using a wired connection for the network. Wireless is not reliable, unless you have no neighbors within the RF range of your Wi-Fi access point (another sore subject requiring a separate post). Many people try to use the RP with as little hardware as possible. I plan to use a Wireless keyboard with a track pad built in so I can type stuff when those infrequent opportunities arise. But that’s it on the hardware side.
The Backend (server) Software
I already had spent the cash and considerable time to build a Home Theatre PC (HTPC) that was at least as simple to use as a Set Top Box appliance. Everyone in my household including me has little patience for tweaking technology, especially when you are in a hurry to turn on the TV to see your favorite program. It needs to just work, period. The good news is that my Windows 7 Ultimate Media Center works without problems consistently. I use a Ceton Infinty PCI card and a Cable Card from Comcast ($1.50 per month rental) to provide four (4) tuners for PVR and Live TV Viewing. I also have a HDHomeRun two (2) tuner for decoding the Over The Air (OTA) signals. Its nice to have options when Comcast is down, not to mention the video quality is better than Comcast HD anyway.
In order for an XBMC device to use this HTPC, I had to install a companion software application on the HTPC to provide the connection to the XBMC device (RP) and to make the EPG data available to XBMC. There are many PVR Add-On’s for XBMC, and each has its own particular WMC application. I had chosen Raspbmc for the XBMC implementation, and it came pre-configured with PVR.WMC as the client, which required “ServerWMC” as the backend interface application. The application has some specific configuration change you will need to make – more on that later.
You will need to change your Windows Firewall policy to allow this application to pass. Or, you can turn off your Windows Firewall completely – not a great idea in the long run. I chose to do this while I was getting things to work, and then went back to lock the HTPC down later.
You will also need to tell the HTPC that WMC is allowed to “stream” to the the XBMC device. It will not by default, nor will it allow the EPG information and channels to be retrieved by the XBMC device, even if the ServerWMC software is configured properly. This frustrated me for hours. I never found a single reference to making this change on WMC, and the XBMC PVR application does not tell you that it is not able to retrieve the data. Selecting the EPG option in the GUI simply does nothing at all if this is not enabled, and I will cover these steps later too.
While Microsoft has provided the proper licensing for MPEG-2 codecs in thier products on WMC and the Xbox, XBMC does not include this, nor the VC1 codec. You must purchase this license and install a license key in the XBMC configuration file (/boot/config.txt) or you will only hear the audio when you try to play a video that was stored on the WMC. This was a 3 hour rat hole (at least) that I went down and only after re-reading the online manual did I find this little tidbit way, way down the page. OMG.
Cliff Notes on this section:
- Install ServerWMC on your WMC system
- Buy the MPEG-2 license and install the key string in config.txt
- Edit the Windows Firewall to allow access
- Find the XBMC device in the Network Devices on the WMC device and allow WMC to stream to this device
The Front End Software
The client software list is fairly slim because RaspBMC has done all that heavy lifting I talked about earlier. The build combines XBMC for the ARM processor in the Pi, as well as many Add-On applications that many people may like. For example there is a You Tube front end that makes browsing You Tube with a TV remote slightly less painful than using a browser.
- Obviously XBMC is required, and I chose to install my Raspbian O/S and XBMC application using the RaspBMC installer (I used the Windows version installer).
- You need an MPEG2 License for WMC recorded content, purchasable from the Raspberry Pi Store – necessary for MPEG-2 encoded content on the WMC.
- PVR.WMC for the PVR front end – an Add On already included in the RaspBMC installation.
I wanted to use my iPhone as a remote control for the XBMC. I actually purchased a real WMC remote control and an IR module, but it hasn’t showed up yet. I’ll add that part to this post later.
What I am about to describe is the tested reiteration of an installation that should take the least amount of time. It is definitely not the actual steps I took the first, second or even third time around. There were the things that I did not do at the appropriate time during those attempts that sent me down the proverbial rat hole for literally hours. I hope that if you are reading this to foster your own attempt, you will get to your goal as quickly as possible. Step-by-step instructions will follow shortly, but I think its helpful for you to know whats coming, in case you need to phone a friend.
- You must install an MPEG-2 license key in the /boot/config.txt file on you’re RP in order to view Windows Media Center content. Codecs are not free, and there is a consortium of corporate entities that invested in MPEG-2 over the years that want royalties to recover their man hours. Its an excellent codec that has served us well, so the $3-$4 USD it costs is well worth it. If you encode your own files, this may not be required.
- You must install the ServerWMC backend with Firewall privileges, or just turn off Windows Firewall. If you are not running Windows Firewall you won’t run into the brick wall after installing the ServerWMC app, where Windows prevents the connection from XBMC.
- You must enable/allow streaming of content to the XBMC device. Even with the Firewall operating properly WMC will not allow the XBMC to make a request of the content using the Live TV (PVR app) method. You may be able to configure the Video function of XBMC to use files located on the WMC resource – if it is set up as a Windows Share, but the Live TV interface will not work.
- Make sure that the disk folders where your PVR content is stored are configured as shared resources. This means navigating in Windows Explorer to the drive and directory where the files are stored and changing the properties of that folder to make it shared! Don’t assume that just because you set up WMC to use a disk/folder that it will be accessible by the XBMC client.
Installing RaspBMC (Raspbian Linux & XBMC) on the SD Card
If you are truly new to the Raspberry Pi, then you need to visit a tutorial on the absolute basics – http://www.raspberrypi.org/help/. The cliff notes version is the RP uses an SD card for a hard drive, by design.
NOTE: You can purchase an SD card called a NOOBS SD card (New Out Of Box Software – NOOBS), with a few versions of Linux preinstalled. Or, you can buy your own SD card (8GB Class 10 minimum, my choice is a 32GB card), then download and install an image of NOOBS yourself. You should try this just because most everyone else has, and its good to understand the history of the RP (not to mention save a few bucks). You will need a simple tool to format the SD media which prepares the SD chip for files. To copy the NOOBS files to the SD card, unpack the ZIP file, navigate to the folder and drag the files to the SD card.Voila – you have a bootable SD card.
There are specific Linux distributions, two with XBMC pre-installed offered on the same NOOBS download page. I opted to install the RaspBMC version for my project, so I downloaded the RaspBMC installer file. You can go to the RaspBMC image installer directly from the author webpage here. Regardless of where you get the RaspBMC installer, read the RaspBMC website installer instructions. It is amazingly brief, and it just works. It uses the Internet to perform the installation so it can pull down the latest updates. Be sure you have the RP plugged into a network with an Internet connection before you apply power to the RP.
Install the SD card, connect your keyboard and mouse, connect the HDMI to a monitor, plug in the network cable then (lastly) plug in the power to boot up. Follow the instructions to install the Raspbian (Raspberry optimized Debian Linux image with an XBMC installation). Once the installation finishes, you will be ready to make a few configuration changes.
Preparing WMC for serverWMC and XBMC access
XBMC does not require the server side component unless you want to use PVR capabilities, which is one of my main requirements. I wanted to use my WMC to record content and offer live TV playout to my XBMC. There are a few things you need to do before trying to use the PVR.WMC application with the backend.
ServerWMC will require a user with administrative privileges on your WMC. I created a new user and password just for XBMC to use so I did not expose the administrative account. This is done by navigating to the Control Panel | Users and clicking create user (on the left-side panel), and following the instructions. Be sure to give the user a password.
You will need to adjust the firewall rules to allow ServerWMC to access network resources. The ServerWMC installation process will do part of this (asking you for permission to change the firewall rules – which you must allow). In my case, I also needed to purposely adjust the firewall to allow access to the home network for WMC. I started by just turning off the firewall altogether. Later I turned it back on and identified applications that were allowed to access the home (private) network.
You will want to make sure the folders that you are using for recordings are being shared by Windows on the WMC. WMC only allows you to configure one disk resource as the location for all recording activity, so this should be easy. I had another challenge because I had a 500GB disk that became full of recordings, and I added a new 3TB disk. WMC only knows about the new 3TB disk for new recordings, but I wanted my old stuff to be accesible too. I had to navigate to that drive in Windows Explorer and enable the drive to be shared. When I did that, the folder showed up in the folder list of ServerWMC in step 4.3 of the ServerWMC installation guide (referenced below).
You will also need to allow your RP devices to access your media shares. This is done by opening clicking the Start icon and selecting Network. You should see all of the devices that are visible to the WMC system, including the name of your RP (I called mine XBMC). Right click on the XBMC device and select the line for allowing “streaming” to this device.
The ServerWMC component that needs to be installed on the WMC can be found here. ServerWMC includes an installer package so simply download, unzip and run Installer_ServerWMC.msi as administrator. It is not necessary to uninstall the previous version before installing an updated version. ServerWMC must be installed on the same PC that was configured for Windows Media Center.
Go here and follow the installation instructions.
When you configure the username and password, be sure to use the correct case as it will make a difference.
Once you have prepared your WMC, installed and configured ServerWMC, you can configure the PVR.WMC Add-On in XBMC. The official instructions are located here. Since PVR.WMC is already part of the RaspBMC installation, you can skip to section 4, “Configuring XBMC PVR Addon to connect to ServerWMC”. The remaining steps on this webpage speak to using the Add-On itself.
Go to the next step for configuring XBMC to configure the Live TV settings – http://wiki.xbmc.org/index.php?title=PVR/XBMC. This is a very short step, as you just need to go into Settings -> Live TV -> General and “Enable Live TV”. The rest of the page talks about the other possible settings. I looked through them to match my settings to the webpage..
In the EPG area, there is one thing to give careful consideration – “Days to display in the EPG“. The default is 3 days. If you are using a mobile app to control your WMC, or you don’t want to set up recordings using the PVR.WMC add-on, then reduce this to one (1) day. This will reduce the amount of EPG data to be fetched and speed up the operation of the EPG on the RP. I made the mistake of increasing this to 10 days, and I was not happy with how log it took to display the EPG. I also enabled the “Prevent EPG updates during playback” option to improve the video playback performance.
Speeding things up
While you can consider over-clocking the RP (increasing the CPU clock rate of the processor beyond the factory specifications) I am not referring to this. The RP is not a fast machine, and over-clocking is not going to change that enough to overcome other configuration decisions. Channel change and acquisition time is going to be much slower than the 1-2 seconds you may be used to from a cable Set Top Box or satellite receiver that has a much faster CPU and optimized software. The RaspBMC installation actually sets the clock rate of the CPU to 850Mhz (the usual setting is 700Mhz).
In my case, the Ceton and HDHomeRun devices reveal over 600 channels in the EPG and channel list because of the services offered by Comcast and what is seen from the Over The Air EPG services. If you have a lot of channels like me, you will want to trim down the channels offered in the EPG to those you really want. I removed all of the Standard Definition programs that had an HD equivalent. I also removed the duplicate HD programs that Comcast has due to their seemingly constant reshuffling of their network for video and DOCSIS cable modem channels. This significantly reduced the amount of time it took to load the EPG and the channel data, and slimmed down the menus as well.
I think I would consider the project a success so far. I can view the EPG, I can see the notes for programs set to record, I can watch PVR content, and I have yet to experience something not work as prescribed. I don’t have a formal test plan either, so “your mileage may vary”.
I have only run into one problem so far where the Pi reboots when I try to select the Live TV option for Channels, after I have selected the EPG option. I’m still trying to decide if I am just impatient waiting for the EPG to load, or if its a technical problem.
Best of luck!