Building a low power mythtv dvr

I recently decided that I needed a better DVR, (Digital Video Recorder) with the purpose of getting better features, use less electricity to do it and provide a platform that can launch all sorts of other projects (home security, home automation, and home AI (Alexa or google assistant style system).
Sounds great right?  Well let's get started:
The first step in all this is to look at what's already out there that does the work of a DVR to get a minimum viable solution.  MythTV ( is a stable wonderful system with all sorts of great features.  I've used it in the past with setting up similar projects that involved a desktop tower sized computer box.  However, that's years ago, let's see if we can't use our embedded knowledge to make this more compact, less noisy, and use much less power, without sacrificing features.
Other projects have successfully used a raspberry pi (rpi), however, as even the official blog notes, this backend practice has limited capabilities.  Nevertheless, I love this idea, an rpi style solution, would fit our desires to have little power requirements, and no need for a noisy fan.  However, as followers of my blog will note, I love pointing out that the Qualcomm 410c Dragonboard is a bit more powerful than the rpi and that we might be able to alleviate those limited capability concerns.
So let's get on with what we need:  
1.) sdcard with plenty of space on it for our building of large projects (mythtv is not a small project and having plenty of space onboard is very much desired).  Here I used a 16g sdcard.
2.) external hd to store recorded movies, music, or act as a network storage device for the whole house.  I opted to get plenty of space, 3tb external drive.
3.) video capture usb or video tuner usb  in order to either get the in signal from the cable provided set top box or directly off the RF cable with your own tuner.  (here I have a set top box so am using a V4L compatible usb HDMI  video capture device).
4.) IR Blaster (optional and required if you don't use the tuner option).  Here I grabbed a USB IR blaster.

Right, so now that we have the hardware sorted, let's look at the software.  I decided to give ubuntu on my dragonboard a try.  So once I got the latest setup for ubuntu flashed over to the dragonboard, I connected a keyboard/mouse and hdmi screen to get it on the network and setup.  Once everything was set, I noticed that going completely headless is a challenge, as there's a bug that debian has fixed on the Dragonboard but ubuntu still suffers from. 
But hey, Qualcomm has excellent support and this bug is already known about and works in Debian.  Here I simply opted to grab one of the scripts from that link and ensure that ubuntu pings every device on my local net until the bug gets fixed upstream for Ubuntu.
Now we come to the install of dependency phase:
As root user (sudo apt-get install) install these packages:
build-essential ccache yasm help2man qtdeclarative5-dev libqt5webkit5-dev libqt5opengl5-dev qtscript5-dev qt5-qmake po-debconf linux-kernel-headers libdvdnav-dev libfreetype6-dev libavc1394-dev libiec61883-dev liblircclient-dev libxinerama-dev libxxf86vm-dev libxvmc-dev libxext-dev libimlib2-dev libasound2-dev libmp3lame-dev libvorbis-dev libdts-dev lsb-release libpulse-dev libxrandr-dev libfftw3-dev libva-dev libvdpau-dev libudev-dev libclass-dbi-perl libnet-upnp-perl libio-socket-inet6-perl libdbd-mysql-perl libjson-perl libwww-perl python python-oauth python-lxml python-mysqldb python-pycurl python-urlgrabber libgl1-mesa-dev libdvdread-dev fftw-dev libvorbis-dev libflac-dev libmad0-dev libcdaudio-dev libcdio-dev libcdparanoia-dev libsdl1.2-dev libfaad-dev libexif-dev libtiff5-dev libxv-dev libtag1-dev libvisual-0.4-dev libmysqlclient-dev libdate-manip-perl libxml-simple-perl libimage-size-perl libdatetime-format-iso8601-perl libsoap-lite-perl libx264-dev libvpx-dev libavahi-compat-libdnssd-dev libssl-dev libcdio-cdda-dev libcdio-paranoia-dev libxml2-dev libass-dev libcec-dev libexiv2-dev uuid-dev libxml-xpath-perl git hello libtool-bin
debhelper quilt dh-python dh-systemd
mysql-server-5.6 ntp libicu55 libqt5sql5-mysql mysql-client-5.6
apache2 php5 php5-mysql libhttp-date-perl

The above packages are required in order to first build mythtv from source, and create packages for it along with what's required to use mythweb.  Unfortunately, no current prebuilt packages exist for our distribution, so let's go through building the binaries ourselves (it's fun):
Most of this will follow the instructions found here:

I found that installing the above dependencies and trying to build mythtv runs out of internal disk space, so let's first do some house keeping by installing the external hd and the sdcard.  We'll do our building on the sdcard.  Let's connect both and start formatting and setting our partitions up:
I used gparted for a graphical way of doing things:  apt-get install gparted then run gparted.  Here I made all the external drives (sdcard and external hd, leave the internal disk alone or your on your own little adventure).
While in gparted, make note of the UUID (Universal Unique ID) of both the sdcard and the external hd.  Then pop into the shell and let's do some linux fu to make the system auto recognize both devices and mount them to the right directory with rwx permissions.  To do this, edit /etc/fstab.  Make your file look like mine: (put the UUID gparted detected where I put UUIDHERE below):
UUID=UUIDHERE /media/sdcard ext4 rw,suid,dev,auto,user,async,exec 0 2
UUID=UUIDHERE /media/externHD ext4 rw,suid,dev,auto,user,async,exec 0 2

I suggest now creating the folders identified above and give them permissions for all users to make life easier, we can harden it later if you decide to allow outside network connections to your Dragonboard.  To do this, do the following:
sudo mkdir -P /media/sdcard
sudo mkdir -P /media/externHD
sudo chmod 777 /media/sdcard
sudo chmod 777 /media/externHD

Now let's check that everything worked:
mount /media/sdcard
touch /media/sdcard/test
rm /media/sdcard/test
mount /media/externHD
touch /media/externHD/test
rm /media/externHD/test

You should see no errors from any of the above.   Also running the mount command with no arguments passed in will list all mounted devices, ensure that exec is set for both mount points.

Now that this is done, let's grab the source and move onto the fun of building:
cd /media/sdcard
git clone
cd mythtv

Now let's switch to the stable branch (unless you like to live on the edge):
git checkout fixes/0.28
-- note that as of the writing of this blog, 0.28 was the latest stable build.  To see what the latest is, use git branch -a and substitute the most recent, if you run into problems, use 0.28 as I can confirm that works.

Let's start building:  First we need to set the source code configuration parameters to know what our system uses.  To do that, run ./configure from the mythtv/mythtv directory.
Once that completes successfully, it will build a happy little Makefile.  This is what we'll use to build the next step.  Run: make -j 5
I'd suggest taking a break here as this build will take a while.  Took about an hour or so here.
Now that it's done building, let's use that Makefile to install our new software: sudo make install

Okay, now we have a very basic Mythtv system all installed.  But why stay with the basics, let's install some plugins!  Follow me to the next post.


Popular posts from this blog

Drone VR Software Architecture

Build Snapdragon Flight Drone

Soldering new connectors for the drone