Raspberry Pi as a XBMC MythTV front end

I know I’m probably late to the game, but I just got myself a Raspberry Pi. Currently I have a Myth TV front end in the living room run by an old laptop, my goal is to replace it. Here I share some of my experiences with the pi.

Raspberry Pi

Getting the RPi

I got my Pi for $50AUD shipped from element14. That includes the board and case. This is also the new 512MB RAM Model B. Previously it was only 256MB. To get started, you also need a 5V 0.7A micro-USB power supply (comes with most smart phones) and a spare SD card. Both of these I have spares lying around so I didn’t need to buy them.

Installing OpenELEC/XBMC

The biggest drawing point of the Pi is that it has hardware accelerated h.264 1080p video and XBMC support. There are three main XBMC distros to choose from: OpenELEC, Xbian and Raspbmc. I chose OpenELEC after reading a few reviews, but generally each of them have a good following. Installation was pretty simple, just follow the guide to flash an the image onto an SD card.

As an aside, I also researched installing MythFrontend, but there seems to be no effort to port MythFrontend to the RPi. MythFrontend requires X server and is possibly a resource hog. XBMC on the Pi draws directly onto the frame buffer so there’s no overhead of a windowing system. MythTV also doesn’t support the OpenMAX video acceleration API used by the Pi to show hardware accelerated video.

There was a bit of drama with flashing the SD card. After flashing my 8 GB microSD with full-SD adapter and powering on the pi, there was just a red led and nothing appearing on screen. After googling for answers, it seems that it happens when the pi doesn’t like you SD card. I got an alternate 1 GB full size SD card and that worked.

Playing Movies

The initial boot up process takes around 2 mins while subsequent boot up takes less that 1 minute. This is actually faster than my old setup with laptop, but that was booting full linux mythbuntu PXE over 100 Mbps network.

Initial impressions were that the menus were slightly laggy but completely usable. I tried adding a network folder and it took forever. The video files I tried also didn’t play and was returning unknown error. Looking at the logs, turns out I had some zip/rar files which XBMC was trying to extract every time I played a file. It’s probably looking for subtitles but stopping a file from playing due to that seems disingenuous to me. OpenELEC exposes various important directories over windows shares (SMB) so grabbing the logs was just a matter of going to \\openelec – Couldn’t be any simpler.

h.264 mkvs played well, but I noticed a 1080p movie I was trying out was stuttering every few seconds. Googling reveals various shortcomings like DTS causes stuttering as it was not accelerated. The decoding is built into hardware, and the only thing stopping it from being used is licensing which Raspberry Pi guys are negotiating with DTS Inc. about. You can also apparently get by this issue using pass-through, if your HDMI TV supports DTS decoding. Back to this movie, the audio was however encoded in Dolby Digital Plus, which shouldn’t suffer from this issue. After some trial and error, I found that the culprit was the soft-subtitles. Turning it off stops the stutters. The movie is still watchable but not the silky smoothness you would expect. Hopefully, this is just a efficiency issue with XBMC and could be overcome in later version. SD videos play completely fine even without hardware help. I tried some RMVB videos but it seems XBMC on the Pi doesn’t have the correct codecs compiled for it and hence it did not work.

As Myth TV Frontend

All digital broadcasts in Australia uses MPEG-2. Initially there was no support for hardware-accelerated MPEG-2 on the Pi, but on popular demand, the RPi devs allowed you to purchase a license to activate the hardware decoding. The license is a reasonable 2 GBP which equates to around $3 AUD. You submit your RPi Serial (found under System info in XBMC) on the RPi store and they will send you a license key. Unfortunately, this is a manual process as indicated by the nice PDF they link you after purchasing the product. A few hours later, I received the real email containing the key.

Installing the key means simply modifying config.txt on the root of your FAT formatted SD card. You can edit it (or create it) by popping the SD card back on to your computer. config.txt seems to be the RPi equivalent of the BIOS. You can control the screen resolution, CPU overclocking, and in this case, entering the MPEG-2 licence key.

The old monitor I was testing with had a weird resolution of 1600×1050, and it wasn’t one of selectable values in XBMC. What I needed to do was add these lines into config.txt. I first tried 1600×1050@75Hz, but then it didn’t work (still stayed on 640×480). Changing to use the 60Hz it seems to accept:

hdmi_group=2
hdmi_mode=58

Full list of resolutions here.

After installing MPEG-2, we need to enable Live TV. XBMC 12.0 Frodo has full PVR/Live-TV support for multiple backends including MythTV. To enable it just follow the guide on the XBMC wiki.

After configuration, the MythTV PVR addon should automatically load. If the addon has trouble connecting to MythTV, you will get incessant error notifications. Indexing and fetching recordings happen every time XBMC starts up and seems to take 2 to 3 minutes to complete (I have over 500 recordings). You can’t watch TV while it processes, which is quite annoying. The PVR addon is still in active development, so hopefully this will improve.

Watching Live TV seems alright, although changing channels seems to be slower than MythFrontend. There also seems to be buffering on 1080p streams from time to time and random crashes. Teletext crashes XBMC on the Pi so avoid using that.

One major caveat of the Pi for me was the quality of analogue audio which I’m using to hook up speakers. Apparently is only 11 bit max and definitely sounds noticeably worse than my old laptop. Anybody using HDMI though won’t suffer from this issue. You can apparently use a USB sound card which I’m investigating.

Remote Control

I’m using a HP MCE infrared remote with USB receiver and it works straight out of the box on OpenELEC. Eventually I want to investigate using GPIO ports to have integrated infrared. The reciever units only cost $1. This will be more power-efficient and removes the USB receiver component that’s nearly as big as the RPi. If you have a new TV with HDMI CEC, you can use your TV remote to control the RPi.

Freezing Issue

For the first few days I found the RPi would randomly freeze/hang in the XBMC menus. It doesn’t respond to the remote, pings or SSH. The lights were still on, but nothing but a hard reset would bring it back to life. The USB charging unit I’m using was old so it probably only supplied 0.5 A, while the recommended minimum was 0.7 A. After changing the power supply to a 0.85 A one, it hasn’t frozen yet.

Live TV show transition issue

I was running MythTV 0.24 and Live TV would stop and the image freeze when it transitions from one show to another. Upgrading Mythbackend to 0.26 fixed this issue.

Audio faster than video issue

When the LiveTV reception gets bad, the video can slow down and go out of sync to the audio. This seems to be isolated to XBMC on the RPi as it doesn’t appear to be happening on the PC XBMC. I haven’t found a solution to this issue. It’s probably hardware acceleration related.

Struggles with some 1080p MPEG2

As mentioned, the RPi seems to struggle with some MPEG2 streams, while it’ll happily play others. Haven’t found any kind of pattern yet.

Bottom Line

I’m happy with my RPi purchase despite the caveats. As a MythTV front end, it works, to a certain degree. Even if it won’t last long as a dedicated HTPC, the versatility and good array of inputs will mean it’ll be useful in many other functions.

XBMC on Raspberry Pi

11 thoughts on “Raspberry Pi as a XBMC MythTV front end

  1. aleem

    really clear, consise, accurate information. I like your pictures too. This is exactly what I am looking to do with my current set up. I am trying to get away from sagetv (since they don’t exist anymore). I had tried xbmc as a myth frontend about a year ago (had to compile it from source because it didn’t have mythtv support yet), and I seem to only remember having problems with one of the channels (abc) that seemeed to stutter a lot. I haven’t tried the new xbmc on raspberry pi yet, but based on this article it sounds promising. The wife will be happy.

    Do you mind if I post any questions here?

  2. Loune Post author

    @aleem feel free to post any questions. Although I’ve been using the RPi for a few months now, it’s probably going to be replaced soon with a OUYA. The main issue is the build up in video lag, such that audio is now faster than video whenever there’s a interruption in the TV antenna signal. A one second lag can be quite jarring. I might post a follow up article.

  3. hitch

    How are you going with this? Have you replaced it with the Ouya yet? I’d love to get one up and running as a myth frontend (using either xbmc or mythfrontend), but it requires a pretty high WAF… Is this realistic, or is it clunky (as well as having the AV sync issues)?

  4. aleem

    Hi @loune. Well, I have started by setting up mythtv backend 0.25 on my mac mini and I am able to connect to it with an xbmc frontend on another mac and on my ubuntu laptop with the cmyth add on enabled. I haven’t yet fired up openelec. I wanted to make sure the xbmc front end was actually useful. Here’s my first question:
    1. Timers: Is it possible to record a show “recurrently”? i.e. instead of just setting a timer for one show at one particular time, I want to be able to record the series. Sagetv did this quite nicely using its “favourites” feature? How do you do it?
    2. I’m finding the remote control interface pretty tricky. I want to find the easiest way to navigate the ui with a remote, and right now its all over the place and not compeltely intuitive for me. Are you having the same problem?

    Let me know. Thanks in advance.

  5. aleem

    Hello again!
    Well, I have set up my rpi, and as you said: the audio does run faster than the video when the incoming signal is bad. I realise my last question was more of an “xbmc” functionality issue and was veering off the “mythtv front-end on raspberry pi” topic.
    I have still to install a remote-control and use it to see how I feel about it.
    Other small things:
    1. power (does it stay powered on all the time?)
    2. Is there a way to power it on over IR?

  6. Loune Post author

    @hitch yes xbmc on ouya is now driving my living room. I’m writing an article on this, but in summary, it’s working well.

    @aleem
    1) actually don’t use the XBMC interface to schedule recordings. I use mythweb addon for mythTV to do it via the browser on other devices. It lets me look at the TV schedule and search shows

    2) I too found the control mappings a little wonky, but I customised my remote key bindings so that the back button stops the video (goes back to the channel list), up down keys bring up the pop up channel list. That way, back quits TV and up down allows you to change channel, which is 90% of the functionality needed.

    And to your other post:

    1) Yeah I keep power on all the time, the maximum power draw is only a few watts (3.5W?) so I’m not too concerned.

    2) If you’re sleeping the device (if sleeping is even possible on RPi) you might be able to make it so it wakes the device up when there’s USB activity, assuming you’re using the USB remote receiver.

  7. brian

    thanks for the great review! any update on this or a new review? would love to know if this actually works well or not so much for the WAF…

  8. Aleem

    Hi again;

    I’m reading elsewhere that the ouya doesn’t hardware-decode mpeg2. Has this caused you any grief?

  9. Loune Post author

    @Aleem – According to this mpeg2 should be supported (in the hardware?). Regardless, the ouya plays MPEG2 1080p HD channels fine. The only really small thing I’ve noticed is pixelation in really fast moving action scenes, which could also be from the broadcast signal or xbmc (only seen it once or twice over a few months). There’s no stutter or delays at all unlike the RPi.

    The only thing with Ouya is if you’re playing mpeg2 HD, I would suggest connecting the ethernet cable as the WIFI is not the best.

  10. themooer

    @loune. What you describe as “pixelation” may just be the absence of a deinterlacer. When MPEG-2 was created, the TV’s required a 60Hz refresh rate, when the content being sent only ran at 30FPS. To resolve this they slit the screen into to interlaced sets of even and odd lines which updated every half second. Thus when things move rapidly across the screen one set of lines updates before the other causing stuttering. In the latest release of OpenELEC running Gotham 13.2 if you select the film reel at the bottom of a live tv stream and turn deinterlacing on, it will resolve this issue (or at least it did for me).

Leave a Reply

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