MythTV Walkthrough

From ArchWiki
Revision as of 15:23, 12 April 2007 by Paulr (talk | contribs)
Jump to: navigation, search

About this document

What is MythTV ?

MythTV is a Linux based Personal Video Recorder. It acts as an intelligent combined television and video recorder. There are many plugins for it which expand its basic functionality.

MythTV is unusual in that it is split into two. The "back end" and the "front end". The back end receives and records the video, the front end shows it and controls the back end. This allows you to separate the two.

Why two entries in the Wiki ?

There already exists a wiki entry for installing mythtv. However, it does lack detail for the less experienced user. I wanted to write a "from beginning to end" installation guide for mythtv ; to do that would require editing the original MythTV HOWTO pretty drastically, and would lose it's advantage of brevity and simplicity. I would recommend reading both guides.

The downside to my approach is that the instructions are 'specific' for my hardware and my location. What I do will only work if you live near me, and have my hardware. But I hope to give enough pointers to make the document helpful for anyone who wishes to install MythTV anywhere.

The document is deliberately quite systematic ; do something, check that's worked, then go on to the next step. If you can't figure it out from the instructions it should help you understand where to look for the right answers, and what part of the set up is being problematic.

Localisation and Hardware variations

MythTV can cope with a wide variety of hardware. There are two main things that change from system to system which require significant setting up.

Firstly, the video capture card. There are many of these and they are often subtly different. MythTV does a pretty good job of detecting and configuring hardware.

Secondly, the location. MythTV has an Electronic Program Guide (EPG) built in, so that programmes can be recorder and viewed easily. There is a common way of setting this up using a program called XMLTV, which extracts data from web sites or other data providers. Some devices (for example DVB-T cards) also require transmitter information.

Some digital systems can use the EPG which is part of the signal. This is currently in development.

My personal information

This guide is written 'as I do it'. However, this is for my hardware in my location, and you are almost certainly different. I will offer suggestions for alternatives where appropriate. It is always worth reading installation guides for other machines ; the process of installation does not vary significantly. If you have a common video capture card, you can find help in most cases ..... somewhere. The MythTV website is a good place to start.

My Hardware

I'm running Arch Linux 0.8 (Voodoo) with an Nvidia card. The "important" piece of hardware though is my DVB-T capture card. DVB-T is known in the UK as "Freeview" ; it is digital television transmitted down the 'standard' aerial.

Other alternatives are the old analogue system, DVB-S (satellite) and DVB-C (cable),

The capture card I am using is a Hauppauge WinTV "NOVA" model, which fits internally in one of the PCI expansion slots. It is highly recommended for DVB-T reception and it is pretty cheap.

My Location

I live in Norfolk in England, and my nearest transmitter is in Tacolneston. Fortunately this is about 5 miles away which means I can "get away with" an indoor aerial, normally DVB=T requires an outdoor aerial. It is rather like FM radio ; you either get a good signal or none at all.

Setting up the hardware

Fortunately my hardware is autodetected by the Arch 0.8 Kernel, or almost completely. It does not install the cx88_dvb module which is required for my system.

Checking it exists

if you do either




it will list all the devices connected to the PCI bus or the USB bus respectively. You should see something which roughly describes your hardware. In my case, lspci produces

02:01.0 Multimedia video controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
02:01.2 Multimedia controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder [MPEG Port] (rev 05)
02:01.4 Multimedia controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder [IR Port] (rev 05)

you can also look at the boot log by typing

dmesg | less

this shows what the system is doing as it 'boots up' ; somewhere you will hopefully see text which describes your card. In my case, a part of the log is

Linux video capture interface: v2.00
cx2388x cx88-mpeg Driver Manager version 0.0.6 loaded
CORE cx88[0]: subsystem: 0070:9002, board: Hauppauge Nova-T DVB-T [card=18,autodetected]
TV tuner 4 at 0x1fe, Radio tuner -1 at 0x1fe

there is a great deal more descriptive information, but this is very hardware specific.

Putting in the module

To force the Kernel to load the cx88_dvb module I changed my rc.conf file so the "MODULES" line reads as follows

MODULES=(r8169 cx88_dvb)

This will force the kernel to load the module at start up. The r8169 module is my network card and is likely to be different on your system.

You can reboot it ; if you don't want to, load it yourself, just this once, with

modprobe cx88_dvb

Checking it works

The simplest way to check it works initially, and that the system has recognised it is to check for the existence of the video device(s) in linux.

ls /dev/v4l

checks for analogue devices and

ls /dev/dvb

checks for digital devices. In both cases you should see a list of device links (like a directory listing). If these are present then linux has probably recognised the card, and it might work.

The next stage is to try and see if it is picking up any signal.

Getting the first digital signal

This part is very specific to DVB-T. For a standard analogue card, you have to do very little ; for DVB-C and DVB-S I do not know.

The first thing to do is to install linux-dvb-apps.

pacman -S linuxtv-dvb-apps

What transmitter do I use ?

Each transmitter transmits DVB-T signals on a different frequency. You need to find a file which describes your local transmitter frequencies.

The simplest way in the UK is to use the WolfBane website at If you click on "UK digital TV reception predictor" you can enter your postal code (what we call the "zip code") and it will tell you what transmitters are available.

The next stage is to find the "ukxxxx" file.

What is the ukXXXX file ?

The ukxxxx file is the file that describes how your transmitter transmits DVB-T data. For my transmitter, Tacolneston, it looks like this :-

# UK Tacolneston
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 730166670 8MHz 3/4 NONE QAM16 2k 1/32 NONE

I have no idea what it means either, if it's any consolation. Not that it matters much, as long as it works.

How do I find it ?

Unfortunately there is no central repository of these - as far as I know anyway (!). If you have installed linuxtv-dvb-apps (i.e. you're following the instructions) you should find a listing of these in the /usr/share/dvb-utils/scan/dvb-t directory.

There's about 30 listed here from various countries (including Australia, the UK and the Netherlands). If your transmitter is not listed here, as uk-Tacolneston wasn't, then you have to hunt on the web ; I googled for things like "DVB-T Transmitter MythTV Tacolneston" and the like, and found a gentleman called Adam Bower had already done the work for me ; thanks, Adam.

What is channels.conf ?

Having acquired your transmitter information (in my case, in the file uk-Tacolneston, you now query your local transmitter to see what channels it has to offer. These contain things like channel details and the tuning frequencies, go in a file commonly called "channels.conf". Once you have this, it should be easy to get your system watching television using mplayer.

Generating the channels.conf

You may be able to find a channels.conf for your transmitter already. If you can't, to create our channels.conf we use a program called 'scan' (part of the linux-dvb-apps we installed earlier)

scan uk-Tacolneston >channels.conf

This should print out reams of gobbledegook, hopefully without error messages. If there are error messages, check your signal strength (do you need a better aerial ?) and your frequencies, which may be wrong.

If you open channels.conf in an editor it should look something like this (lines truncated slightly here !)

Five:730166670:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2 (etc)
Five Life:730166670:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC (etc)
Five US:730166670:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1 (etc)

except there will be more of it (one line for each channel). The first things on each line should be recognisable as the channels available on your local service. The names are often truncated.

Getting the first picture

This part is again only applicable to DVB-T transmissions. The next part is to check the card is working by - watching some television.

Install and run Mplayer

My preferred viewer is mplayer (though you can do this with xine as well - the process is identical, where I say mplayer you put xine !). To view the television in mplayer, firstly install it once and run it.

pacman -S mplayer

It is run once to create the .mplayer subdirectory in your home directory, which will contain your channels.conf file.

Making Mplayer work with DVB-T

To make mplayer work with DVB you have to tell it about the channels it can read. The simplest way of doing this is to copy the channels.conf file into your .mplayer directory

cp /aux/arch/channels.conf /home/paulr/.mplayer

(Your command may vary depending on your login name and the directory you put the channels.conf file)

You should now be able to watch TV. Look at one of the channels in your channels.conf. I shall choose the TV channel BBC1. The line from channels.conf looks like this.


to watch BBC1, you use the name of the channel - the line as far as the first colon. In this case

mplayer dvb://"BBC ONE"

Replace BBC ONE with the channel you wish to watch. With a bit of luck, if everything has worked, that should open a window and start playing the channel in glorious LinuxColour ; in this case , BBC1.

If not ... search the internet checking error messages :) If the previous stage worked (getting the uk-xxxxx and channels.conf) it's a bit puzzling that it doesn't work.

If you've got this far you can be pretty sure you will get MythTV to work properly - eventually. There's a bit more setting up to be done yet. It is not that difficult to get MythTV working, recording, display video, and so on. The hard bit - in my experience anyway - is getting the EPG working.

But it *is* worth it. MythTV watching is a whole new way of looking at television ; it's a whole new way of thinking about television. Without DRM.

"I think this is getting needlessly messianic." (Fook, Hitch Hikers Guide to the Galaxy)

Installing XMLTV

Installing XMLTV

Read the XMLTV HOWTO for instructions on how to Install XMLTV. This used to be part of this document, I put it in it's own Wiki page.

You can have it all, but you don't want to

If you let it run through to the very very end it will take a long time. Normally you don't want to do this ; you want just the channels that there are on your system. On the tv_grab_uk_rt listings there are 271 channels, but DVB-T Freeview only has about 50 odd.

We will cut this down later and make the tv grabber run faster.

Installing MythTV

Installing MySQL

To start with, we install MySQL, the open source database. This is used to store information for mythtv. These three lines install it, start it running, and set the password to 'root' (change as you wish). You will need to use 'su' to get into superuser mode first.

pacman -S mysql
/etc/rc.d/mysql start
mysqladmin -u root password root

You should also edit your /etc/rc.conf file to start it up automatically, by adding mysqld to the list of daemons. The daemons line should now look something like (exact contents may vary)

DAEMONS=(syslog-ng network netfs crond gdm cups hal alsa openntpd mysqld)

To check it works okay, enter

mysql -u root -p

and when it asks you for the password, type in whatever you set the password to above (in this case, root). It should start up the command line interface to MySQL. To exit, type Ctrl+D.

Installing MythTV

Installing MythTV is easy. This command will install the MythTv program and the themes that go with it.

pacman -S mythtv myththemes

Creating the Database

Finally, we need to initialise the SQL Database that MythTV uses. There is a script to do this.

mysql -u root -p </usr/share/mythtv/mc.sql

Again, you will need to enter the root password.

Setting up MythTV

Press Ctrl+D to leave superuser mode. Type the following command to set up mythtv.


Select your preferred language

Select the preferred language (in my case, English(British)) and press Return to go to the next screen.

Section 1. General

  • "host specific backend setup" : allows you to use a specified directory to store your recordings.
  • "Global Backend setup" : I had to set the TV format to "PAL" and the Channel Frequency Table to "Europe-West" ; these may vary depending upon which country you are in.

For all the other pages, you can simply leave the defaults as they are. You can always change them later.

Section 2. Capture Cards

This is where you specify your capture card. Select "New Capture Card" and change the type to whatever your card type is. For my WinTV NOVA, it is "DVB DTV Capture Card (v3.x)".

Mythtv should hopefully identify what your capture card is. Select Finish to store the new capture card, and then press ESC to return to the setup menu.

Section 3. Video Sources

Select "New Video Source" and enter a name (like DVB Card, for example). Then change the entry "XMLTV Listings Grabber" until it matches the name of the grabber you set up in the XMLTV section.

It will now configure this in the background. Again, we can skip this configuration for the time being. When you click on finish, the bar goes to 50% and stops. You will need to Alt-TAB to find the terminal window again. As before, you can select "all", because we will fix it all properly later.

Then press ESC to return to the main menu.

Section 4. Input Connections

Select the Video Source you just created, and bring up the 'Connect Source to Input' Dialog.

Give it an appropriate name ; in the UK it is known as "Freeview". For the Video Source, select the Capture Card

For DVB-T cards like mine, Tab down to and select "Scan for Channels", then TAB to "Scan Type" and switch this to "channels.conf". We are going to use the channels.conf we created earlier to configure mythtv. When you click on "finish" for this, it will display "Adding ....." for all the channels you found before.

If you don't have a DVB card but use something like an analogue card, you may need to scan for channels and label them yourself.

Click on Finish twice, then ESC to return to the main setup menu.

Section 5. Channel Editor

You can look at this, but we are going to configure it in a minute.

First run of MythTV

Start up the Myth BackEnd (this is the bit that does all the recording and so on) as follows.

/etc/rc.d/mythbackend start
(Press Ctrl+D)

When it's working you can put mythbackend in your DAEMONS line as we did for MySQL above. You may get an authentication error, which I think is something to do with QT, which I believe can be ignored. Now run the front end by typing


If you go to "Watch TV" you can (errmmm....) Watch TV, you can change channel with your up and down keys, and it all works quite nicely.

You can also simply run


This is just a "TV Watching" application with no other facilities.

Rats ! It doesn't seem to be working.

Yes, it's only about half there. The TV playing now works fine. What doesn't exist is the EPG - it doesn't tell you what is on the channel, and if you look at the EPG in the Recording section there's no data.

What we have to do now is to make the XMLTV Data work with MythTV.

Linking XMLTV and MythTV

The shotgun wedding

There is a problem to fix. We have to get the XMLTV data and the MythTV working together.

If you look at the channels.conf file, which says what channels are on MythTV, it looks like this :

Five:730166670:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2 (etc)
Five Life:730166670:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC (etc)
Five US:730166670:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1 (etc)

If you look at the XMLTV file DVB Card.xmltv it looks like this :


The problem is getting the two to work together. We have to tell MythTV that the matches up to the channel called "Five", the matches up to the channel called "Five Life" and so on.

This is one of those quite difficult computing problem. To a human brain, it is pretty obvious. To a computer, that sort of pattern matching is really quite difficult.

What you are trying to do, technically

run the following

mysql -u root -p 
(then enter the password)
(then enter these commands into the MySQL client)
use mythconverg;
select name,xmltvid from channel;

this will query the MythTV database and show the names of the channels, and the name of the associate xmltv channel. It will now look like :

| name           | xmltvid |
| Five           |         | 
| Five Life      |         | 
| Five US        |         | 

but with many more channels. We need to get the channel data from the above table in there, so that for the name row the xmltvid value is That way MythTV knows where to look. There are also columns which allow you to set the icons, which at present I am not doing.

Using MythTV

You can do this using the Channel Editor section of MythTV. This is not difficult, but very slow and boring.

Using XMLTVDruid

In AUR there is a program called XMLTV Druid which provides a better GUI for doing this. I haven't tried it. I'm not even sure if it does this 'marriage' of XMLTV and MythTV.

Doing it by MySQL Script or similar

My method of doing it involves using a text file containing the channel name and the xmltv channels together, which when run creates two files ; an SQL file which sets up the data in the MythTV database, thus doing the "shotgun marriage", and also creates a replacement "DVB Card.xmltv" which doesn't require *all* the channels to be checked, only the ones we are actually using.

That's why I suggested not bothering with selecting the channels in use earlier ; we are going to replace them now.

This is my control file, the name of the file should be mythtv.config. On the left hand side is the name of the channel from channels.conf ; on the right hand side is the channel source from XMLTV.

# XMLTV Matchup Source File
Sky Spts

The only changes a UK user will need to make are to BBC1, BBC2 and ITV1 ; in this file they are set up for the eastern region (BBC East and Anglia Television) ; in different parts of the country different sources are required.

This is the perl script that takes that file and generates an SQL file match.sql and also outputs a replacement DVB Card.xmltv file.

open(my $src,"<mythtv.config") or die($!);
open(my $sql,">match.sql") or die($!);
print $sql "USE mythconverg;\n";
while (readline($src))
if (/(.*):(.*)/)
  my $mch  = trim($1);
  my $mxm = trim($2);
  print "channel $mxm\n";
  print $sql "UPDATE channel SET xmltvid='$mxm' WHERE name='$mch';\n";

# Perl trim function to remove whitespace from the start and end of the string
sub trim($)
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;

Save this file as, then run the command :

perl >DVB.xmltv

Then you have to copy the new DVB file into the correct place. The name of the file you copy it to will depend on what you names you used in mythtv-setup, but it will be in /home/(user)/.mythtv and end in ".xmltv".

cp DVB.xmltv /home/paulr/.mythtv/DVB\ Card.xmltv

Then you have to run the SQL script to insert the data into the SQL Database.

mysql -u root -p <match.sql

Checking that it's worked

The simplest check is to repeat the query on the MythTV database ; if it has worked then many, but probably not all, of your IDs should be matched up.

mysql -u root -p 
(then enter the password)
(then enter these commands into the MySQL client)
use mythconverg;
select name,xmltvid from channel;

should now look like :

mysql> select name,xmltvid from channel;
| name           | xmltvid                          |
| Five           |                   | 
| Five Life      |              | 
| Five US        |                | 
| QVC            |                        | 
| abc1           |                  | 

there will be some gaps, as a guide is not available for every channel.

Running mythfilldatabase

All you now have to do is to get mythtv to fill the database. It will run the xmltv command, read in the data, and use it to populate the EPG. Fortunately there is a command to do this for you.

This can take some time. Some channels may fail because of the 'screenscraping' of the


Now go and play

Now, when you run mythfrontend, it should display the program information, and the EPG should be completed in the recording section for those channels you put in your mythtv.config files.

For me, it's about a third of the 90 or so, but this is most of the main channels. There are channels which are Teletext, channels which are Radio, and channels which are Pr0n, so they're no great lost


The Font sizes and the Theme

On my MythTV, on a 1280x1024 display, the Fonts are large and make the EPG look terrible. By going in through Utilities/Setup then Setup then Appearance you can change the look to something better, and also change the theme.

I quite like

  • Fonts = small
  • Theme = mythcenter

but this is purely a matter of personal taste.

Setting up the Icons

I have seen some installations that require you to manually install the icons into the database for each channel. However, the tv_grab_uk_rt grabber seems to download and install them automagically.

Segmentation Fault

For some as yet unknown reason, mythtvfrontend throws a Segfault when you exit it. This doesn't appear to affect its operation at all at any other time.

Setting up a CRON job (todo)


Getting the DVB EPG to work with MythTV (todo)