MythTV Backend

DVR (Digital Video Recorder) aka PVR
The modern VHS, the ability to record TV to watch it later, fast forward, rewind, pause, and even skip commercials! These devices are affordable to buy off the shelf but here at operationlinux we’ll show you how we made our own from open source and a desktop computer.

TV tuner
First thing you’ll need is a TV tuner. What that does is take the TV signal out of the air or cable and then converts it to a format your computer understands. We ended up buying the Silicon Dust HDHR3-US; it is a really nice product because it connects to your network whereas most tuners connect internally through PCI. But you could probably get away with almost any tuner as long as it supports Linux.

Software
We took a quick look at XBMCBuntu and really liked the Live DVD but ended up choosing the elder DVR software MythTV to install. We installed mythtv version 0.26.0 and ran into many problems! But eventually we conquered all the pitfalls operationlinux-style! Hopefully our misadventures will help the next person who has trouble…

MYTHBACKEND
We have a headless server running Slackware. Our goal is to run this server all the time so it can record TV, and then have client boxes connect to it to watch live TV and recordings. Slackware is hardcore linux, you install most software from source code. We came across a really nice website called slackbuilds.org to help you along that path.

First make sure mysql is running, in Slackware this is really easy.

Opening the startup script for mysql (R3) and it’s great, followed its directions.
# mysql_install_db –user=mysql
WORKED
root@blade:/etc/rc.d# chmod u+x rc.mysqld
root@blade:/etc/rc.d# ./rc.mysqld start
root@blade:/etc/rc.d# 121025 19:51:15 mysqld_safe Logging to ‘/var/lib/mysql/blade.err’.
121025 19:51:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

Go download the tar ball (R1) in our example mythtv-0.26.0.tar.bz2.

root@blade:~/downloads# bzip2 -d mythtv-0.26.0.tar.bz2
39m to 148m way2go bzip
(R4) has lots of slack commands
root@blade:~/downloads/mythtv-0.26.0# ./configure
yasm not found, use –disable-yasm for a crippled buildIf you think configure made a mistake, make sure that you are using the latest
version of MythTV from git. If the latest version fails, report the problem to the
mythtv-dev@mythtv.org mailing list or IRC #mythtv on irc.freenode.net
Include the log file “config.ep” produced by configure as this will help
solving the problem.

Our first problem, we have to install yasm. We will use slackbuilds.org, you download two files a normal tar.gz and the source code tar.gz. Then you place the source into the normal tars extracted directory, then run its config which will make an install package.

# wget http://www.tortall.net/projects/yasm/releases/yasm-1.1.0.tar.gz
# wget http://slackbuilds.org/slackbuilds/13.1/development/yasm.tar.gz
root@blade:~/downloads# tar -xvf yasm.tar.gz
root@blade:~/downloads# mv yasm-1.1.0.tar.gz yasm/
root@blade:~/downloads# cd yasm
root@blade:~/downloads/yasm# ./yasm.SlackBuild

Slackware package /tmp/yasm-1.1.0-i486-1_SBo.tgz created.
# installpkg /tmp/yasm-1.1.0-i486-1_SBo.tgz

Package yasm-1.1.0-i486-1_SBo.tgz installed.
#
root@blade:~/downloads/mythtv-0.26.0# ./configure
ERROR! You must have the Lame MP3 encoding library installed to compile MythTV.

Our second ERROR, not too hard though, we will do the slackbuilds method (in full detail above) to install lame.

# wget http://downloads.sourceforge.net/lame/lame-3.98.4.tar.gz

# installpkg /tmp/lame-3.98.4-i486-1_SBo.tgz

FINALLY got the config in mythtv-0.26.0 to work here’s the full output:
root@blade:~/downloads/mythtv-0.26.0# ./configure
WARNING: disabling Python bindings; missing MySQLdb
WARNING: disabling Python bindings; missing lxml
WARNING: disabling Python bindings; missing urlgrabber
WARNING: disabling Perl bindings; missing HTTP::Request
WARNING: disabling Perl bindings; missing LWP::UserAgent
WARNING: disabling Perl bindings; missing Net::UPnP::QueryResponse
WARNING: disabling Perl bindings; missing Net::UPnP::ControlPoint
WARNING: disabling Perl bindings; missing IO::Socket::INET6
# Basic Settings
Compile type profile
Compiler cache yes
DistCC yes
qmake /usr/bin/qmake
install prefix /usr/local
runtime prefix /usr/local
CPU x86 x86_32 (AMD Athlon(tm) XP 3200+)
yasm yes
MMX enabled yes
MMX2 enabled yes
3DNow! enabled yes
3DNow! extended enabled yes
SSE enabled yes
SSSE3 enabled yes
AVX enabled yes
CMOV enabled no# Input Support
Joystick menu yes
lirc support yes
libCEC device support no [/usr/include]
Video4Linux sup. yes (v1 yes)
ivtv support yes
HD-PVR support yes
FireWire support no
DVB support yes [/usr/include]
DVB-S2 support yes
HDHomeRun support yes
Ceton support yes
IPTV support yes
ASI support no

# Sound Output Support
PulseAudio support no
OSS support yes
ALSA support yes
JACK support no
libfftw3 support no

# Video Output Support
x11 support yes
xrandr support yes
xv support yes
VDPAU support no
VAAPI support no
CrystalHD support no
OpenGL video yes
MHEG support yes
libass subtitle support no

# Misc Features
multi threaded libavcodec yes
libxml2 support yes [/usr/include/libxml2]
libdns_sd (Bonjour) no
libcrypto yes
Frontend yes
Backend yes
OpenGL ES 2.0 no

# Bindings
bindings_perl no
bindings_python no
bindings_php yes

# External Codec Options
mp3lame no
faac no
xvid no
x264 no
vpx no
SDL no

Creating libs/libmythbase/mythconfig.h and libs/libmythbase/mythconfig.mak

root@blade:~/downloads/mythtv-0.26.0#
tried to run qmake but mythtv.pro didn’t exist so just ran “make”, getting a billion warnings about not able to distribute work, in the output it looks like make called qmake so maybe this is more up to date then my doc (R4).
RAN for a whole hour with many warnings, killing and trying this:
# ./configure –disable-distcc
took about 45 minutes and appeared to work
# make
# make install

Now setup the database, there is a script “mc.sql” within the database subfolder.

$ mysql -u root < mc.sql

Next you need to run /usr/local/bin/mythtv-setup but we cannot on this headless server so we’ll need to do a remote X-Windows session. That could be a tutorial by itself so we won’t go into that here, just know we used the ssh method seen below. 192.168.1.103 is the IP Address of our Slackware server and the ssh command is being run on a Linux client with a full GUI (X-Windows, KDE).

operationlinux@greeny:~$ ssh -X operationlinux@192.168.1.103 /usr/local/bin/mythtv-setup
operationlinux@192.168.1.103′s password:
/usr/bin/xauth: creating new authority file /home/operationlinux/.Xauthority

2012-10-27 11:17:46.771165 E Error preparing query: SELECT DISTINCT dirname FROM storagegroup WHERE groupname = :GROUP AND hostname = :HOSTNAME
2012-10-27 11:17:46.771254 E Driver error was [2/1146]:
QMYSQL3: Unable to prepare statement
Database error was:
Table ‘mythconverg.storagegroup’ doesn’t exist2012-10-27 11:17:46.772136 E DB Error (StorageGroup::StorageGroup()):
Query was:
SELECT DISTINCT dirname FROM storagegroup WHERE groupname = :GROUP AND hostname = :HOSTNAME
Bindings were:
:GROUP=”Themes”, :HOSTNAME=”blade”
Driver error was [2/1064]:
QMYSQL: Unable to execute query
Database error was:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘:GROUP AND hostname = :HOSTNAME’ at line 1

2012-10-27 11:17:48.690654 E MySQL time zone support is missing. Please install it and try again. See ‘mysql_tzinfo_to_sql’ for assistance.

So those are pretty serious errors. We ran the same command a second time and the only error generated is the timezone one then the X-window closes immediately. The ERROR tells us to see mysql_tzinfo_to_sql, that happens to be an executable (R6). Here’s how we fixed our database:

operationlinux@blade:~/mythtv-0.26.0/database$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

It generated some silly Warnings but it appeared to work. Now you can run the GUI setup to completion.

operationlinux@greeny:~$ ssh -X operationlinux@192.168.1.103 /usr/local/bin/mythtv-setup

Now to a confusing part, the tutorial we read (R2) told us to initially setup a zap2it.com account but within the myth setup GUI (mythtv-setup) our only options are schedulesdirect.org or over the air (EIT scan). And even later within their own tutorial they mention and have a screenshot of schedulesdirect instead of zap2it. For now we left it over the air.

operationlinux@blade:~$ mythfilldatabase
had a lot of ERRORs don’t think it downloaded the channel data.
“2012-10-27 13:29:09.697318 E DataDirect: Failed to get data: Download error”
then it complained the master server isn’t running…

We probably didn’t do this part correct but we still got the backend to run.

$ mythbackend

Runs!

Now to prove it is working we connect the mythfrontend…coming up next we’ll show you how we did that.

References

R1: http://slackbuilds.org/repository/14.0/multimedia/mythtv/
R2: https://help.ubuntu.com/community/MythTV/Install/Server/Backend
R3: vi /etc/rc.d/rc.mysqld
R4: www.byopvr.com/articles-how-tos/howto-slackware-linux-9-1-mythtv-install-guide/
R5: http://ubuntuforums.org/showthread.php?t=1682462
R6: http://dev.mysql.com/doc/refman/4.1/en/mysql-tzinfo-to-sql.html
R7: http://www.thegeekstuff.com/2010/08/allow-mysql-client-connection/
R8: http://www.ubuntuupdates.org/ppa/mythtv_0.26?dist=precise
R9: https://help.ubuntu.com/community/CompilingSoftware
R10: http://judsonsnotes.com/notes/index.php?option=com_content&view=article&id=407:installing-mythtv-from-svn&catid=37:tech-notes&Itemid=59

This entry was posted in Linux. Bookmark the permalink.

4 Responses to MythTV Backend

  1. Steve Hardy says:

    Hi,
    I started using Slackware more than a decade ago. Shortly after LinuxPackages.net went down I discovered SlackBuilds. They’re great!!!

    But then… I discovered SBOpkg. It automates the whole slackbuilds process so that all you have to do is search for a package from the SlackBuilds repository using sbopkg. From that point you can easily instruct the program to automagically:

    Download
    Build and
    Install

    that pacakage in your system.

    Dependency checking is still your responsibility but you can easily look up the .info
    field (within sbopkg) of a slackbuild to find out the list.

    SBOpkg brings installing packages from source within Slackware to almost a point and click operation.

    -Steve Hardy

  2. Paul D Mallett says:

    Hi, I don’t quite have the balls for Slackware yet but I am also crashing about with MythTV on a headless Ubuntu server and using “remote X-Windows session” has answered my next question and will allow me to proceed.
    Like you I have added obscure undocumented dependencies on the fly to complete the “make install”
    Also have some sort of problem with the mythweb directory being in the wrong place however I shall be back when I have mastered remote X-Windows which I have only read about upto now, thanks for the heads up.

  3. Hello would you mind stating which blog platform you’re using?
    I’m planning to start my own blog in the near future but I’m having a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.

    The reason I ask is because your layout seems different then most blogs
    and I’m looking for something completely unique.
    P.S Apologies for being off-topic but I had to ask!

    My weblog; tabletki poronne

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>