Difference between revisions of "MythTV Walkthrough"

From ArchWiki
Jump to: navigation, search
Line 1: Line 1:
[[Category:Audio/Video (English)]]
[[Category:HOWTOs (English)]]
=About this document=
=About this document=
==What is MythTV ?==
==What is MythTV ?==

Revision as of 18:56, 1 April 2007

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.

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.

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 http://www.wolfbane.com. 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 tranmitters 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

What does XMLTV actually *do* ?

Any good PVR system needs to know when to record. Systems like VideoPlus in the UK, where numbers encode start and stop times, have made programming easier, but it's much easier to just look at an EPG and click on the programme you want to record.

However, there is no central system for acquiring TV programme data, at present, so that's where XMLTV comes in. XMLTV's job is to take program data off the internet and convert it to a standard format for PVRs like MythTV and FreeVO.

Why XMLTV is so problematical

The problem with XMLTV is it is grabbing data from places that weren't really designed to supply it. It kind of "screen scrapes" - it looks at a web page containing TV information like this, http://www.bbc.co.uk/cgi-perl/whatson/search/grid.cgi?MEDIUM=tv and tries to rip the text off it and convert it into an easy to use format. Things can go wrong with this ; if the website decides it's going to reformat its text, then it will cease to work properly or indeed at all.

What about the DVB-T EPG ?

DVB-T, aka Freeview here, has programme guide information embedded in it ; any UK Freeview set top box has an EPG. It seems to be problematic getting this to work in MythTV, as it is currently "in development". When it does work, this will make it much easier as XMLTV can be abandoned, for DVB-T anyway (still needed for analogue, which is sound and video only)

One downside of the DVB-T EPG is that it only goes 7 days into the future, whereas XMLTV does 14 days. This is useful if you want to record when you are on holiday.

What about the AUR

XMLTV is in the AUR, both in 'normal' form, and in CVS form. I personally haven't had much luck with this, so I'm going to compile it from scratch. This isn't difficult, the "hard" part is the "perl dependencies" (XMLTV is a Perl application) and getting them right.

Download and first compile

You first need to obtain the current version of XMLTV ; this can be downloaded from Sourceforge http://sourceforge.net/projects/xmltv ; the current version as I write is 0.5.45

After having downloaded it, create a working directory somewhere and untar the source into it.

cd /aux/arch/mythtv
tar xjvf tar xjvf /home/paulr/Desktop/xmltv-0.5.45.tar.bz2 
cd xmltv-0.5.45

this will create a directory xmltv-0.5.45 in the saved directory with the source code in it, then change to it. Now, we're going to install some basic dependencies. In spite of the long list, there's not actually very much code downloaded here.

pacman -S perl-archive-zip perl-date-manip perl-html-tableextract perl-http-cache-transparent perl-io-gzip perl-io-stringy perl-term-progressbar perl-unicode-string perl-www-mechanize perl-xml-twig perl-xml-writer

and next, we will attempt to compile the program

perl Makefile.PL

This should produce a listing that looks like this.

XMLTV.pm library and the filter programs such as tv_grep and tv_sort
are installed by default; here you choose grabbers for different
countries and front-ends for managing listings.
Grabber for Brazil (tv_grab_br)                                    [yes]
Grabber for Brazil NET Cable (tv_grab_br_net)                      [yes]
Grabber for Switzerland (tv_grab_ch_bluewin)                       [yes]
Alternative grabber for Britain (tv_grab_uk_rt)                    [yes]
Fast alternative grabber for the UK (tv_grab_uk_bleb)              [yes]

.... and so on. Find your country in the list and hopefully it will be marked "yes". If not, try installing perl-tk-tablematrix using Pacman, break with Ctrl+C and run the perl command above again. If it still doesn't work, try installing perl-soap-lite from AUR.

Fortunately for me, it has found the tv_grab_uk_rt grabber for the UK that I am going to use. Make a note of its name, because I will refer to mine (tv_grab_uk_rt) throughout ; whereas you may need, for example, tv_grab_br

It now asks "Do you want to continue with this configuration ?" ; you actually don't need all those grabbers, but what the heck, just press RETURN for yes.

Now compile and install the program with

su (then enter your password)
make install
(Press Ctrl+D to get back to non superuser mode)

Configuring XMLTV

Next we need to configure XMLTV. To do this run

tv_grab_uk_rt --configure

Now, for this grabber, you can individually select whether or not you want each channel. We aren't going to do this yet, and we aren't going to do it this way anyway - it's mindless. So type


And it will configure itself to download every single channel it can.

Checking XMLTV actually works

To check it, simply run it.


If all is well, it should churn out reams and reams of channel programme data. It should look like this

<programme start="20070330035500 +0100" stop="20070330042000 +0100" channel="abc1.disney.com">
   <title>8 Simple Rules for Dating My Teenage Daughter</title>
   <sub-title>Rory's Got a Girlfriend</sub-title>
   <desc lang="en">Sitcom in which a father has his hands full when his wife returns to work and he is left to supervise their teenage daughters. Paul has to face the fact that his son wants to start dating girls, and Kerry envies her sister.</desc>
     <actor>John Ritter</actor>
     <actor>Katey Sagal</actor>

except there'll be pages of it.

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

Installing MythTV

Creating the Database

Setting up MythTV

the various setups

Rats ! It doesn't seem to be working.

Linking XMLTV and MythTV

The shotgun wedding

What you are trying to do, technically

Using MythTV

Using XMLTVDruid

Doing it by MySQL Script or similar

Checking that it's worked

Running MythTV