Using a Raspberry Pi 3 as a MythTV Frontend

For over seven years, MythTV was my DVR and front end display for live TV as a Charter subscriber, with six cable card tuners provided by a pair of Silicon Dust HD Homerun Prime units, and a pair of off-air tuners via a single HD Homerun.

It was, for the most part, fairly stable with a whopping 6 TB of storage and a lot of home brewed capabilities such as exporting programs to podcast format so shows could be downloaded on phones and iPads. But users of MythTV will attest, it is eccentric and always a fast moving development target with low spouse-factor acceptance. So when DirecTV came along with a very compelling offer, MythTV was retired after years of service

Well, sorta. That compelling offer was set to expire to an onerous retail pricing structure, and lets face it, streaming on-demand is the future of video anyway. Plus, I was missing a lot of the off-air content that I enjoyed. So MythTV was brought back into service. But I had sold a lot of the hardware for my front end units. It seems the Silverstone HTPC cases were never seen before at the local swap, and they went quickly. I had one remaining, and two TVs to cover for MythTV front ends.

Enter the Raspberry Pi 3

I am not all about adding more load to my electricity bill. Electricity is expensive where I live due to surcharges for nuclear plant decommissioning and other fees, and it will only increase in price as utilities navigate ways to cleanly generate electricity. So building new energy efficient HTPCs seemed like a fun project until I saw the price. I’m willing to take up to 30 watts on the primary front end that drives the marquee monitor in the living room, but these older 720p TVs in bedrooms don’t need that power. And even though some Intel hardware and NUC style computers are really compelling, spending several hundred dollars wasn’t going to happen.

There is a lot of information about running a Pi 3 as a front end. In short, it does work and you essentially need to follow the Raspberry Pi MythTV Wiki. I will offer the following deviations, however.

Try It Without the MPEG-2 License First

Driving a 720p monitor, the Raspberry Pi 3 was perfectly capable of doing MPEG-2 software rendering without a lot of effort. I did notice color shifts on some programs, and lower screen crawls were jumpy. But with the hardware decoding, the crawl jumps were still there and while the color gradient nonsense is reduced, there is edge noise. And the MPEG-2 decoding makes live action sports quite distracting. I find software decoding to do better with sports. The Pi is a compromise, no doubt about it. Don’t consider it if you want pristine video rendering.

Crank Up the Video Memory

Regardless if you run with or without hardware MPEG-2 decode, you will want to devote the maximum amount of memory to the graphics processor. The wiki tells you how to do that, but what they do not tell you is that you can reduce the footprint of X if you get rid of LXDM. You don’t need a display manager to run the frontend. Here are the steps to do that.

Use raspi-config to tell your Pi to auto-login to a console, then reboot. You should see a bash prompt. Next, add the following packages.

sudo apt-get install xinit mythtv-light

Now, as pi and logged into the console with your TV attached, get mythfrontend working properly. Once happy with the operation of the frontend, continue on making it auto start upon boot.

Next, create an .xinitrc file

echo "exec /usr/bin/mythstart" > ~/.xinitrc 

And append this to .bashrc

echo "startx >> ~/.bashrc

What you have instructed your Pi to do is, after disabling a graphical login with raspi-config, is telling the user pi to run startx, which starts X11, and then X11 will execute xinit which will then fire off mythfrontend.

Your Pi does not have the ability to sleep and be awoken whenever you push a button remote. So, the thing will run all the time.