MythTV/Installing

From Wikibooks, open books for an open world
< MythTV
Jump to: navigation, search
MythTV
Introduction | Getting Started | Installing | Extras | Troubleshooting | Conclusion


The easiest way to install MythTV is to follow a how-to. The following how-to is geared towards Mandrake 10.1 Official (download), but most of the steps will be similar for other linux distributions. The locations of some files may be slightly different, and instead of using urpmi to install updates, you will need a different tool depending on your distribution. So, you should first figure out what packaging tool is used on your linux distribution, and whenever commands involving urpmi arrive, use your tool instead. Examples of tools used on other command-line tools are apt-get, and emerge (used on Gentoo). There are also graphical tools, such as grpmi (graphical version of urpmi), rpmdrake (for Mandrake), Synaptic, etc.

If you're using another distribution and need to find a particular file, you can always use the find command. For instance:

# find / -name "file*"

will find everything that starts with "file." (Note that searching starting at the root level, "/", will take a long time, so you should limit your search if you can.) This can be a great way to figure out where a file has been placed in your distribution. You can also use

$ which command_name

To find out where a given command or script is located. (The "whereis" comand is also useful.) If the command does not exist on any defined path, this will let you know (so that you can either install the required software, or add it to the path appropriately). This is useful when a how-to asks you to run a command that you seemingly don't have. Also, before running any commands you should probably do

$ man command_name

to get some information on what the command does and how to use it. Many times the answer to your question is hidden inside a manual page.

Example installation: MythTV 0.17 on Mandrake 10.1 with a Hauppauge PVR-350[edit]

Download and install Mandrake[edit]

You can download the latest Mandrake ISO images from the official download page, or from any number of mirrors. You then burn these ISO images to CD, and perform the installation by booting off the CD. There are many other ways to install linux of course. What you install of course depends on what you want. You should install all the multimedia options, and development tools (so that you'll be able to compile things later). It's probably a good idea to install network client functions, and if you want to access your MythTV remotely, you should install some server packages (web server and ssh server especially). Having your MythTV running an SSH server can be handy if you have another computer at your disposal, because then you can have your MythTV hooked up to your television, but configure it via command line of another computer (this is good because your MythTV, when hooked up to a television, doesn't have very good resolution, and it can be aggravating to use it as a computer). You need to install some sort of window manager. KDE is a good choice if you have no other preference.

In terms of partitioning your disk, it makes good sense to have your linux OS on one partition, and keep another partition for storing your MythTV data. That way you can reinstall linux without deleting your videos. Linux doesn't need very much space (5 or 10 Gb is sufficient). Be sure to make your swap partition (512 Mb is pretty typical, but you can make it bigger if you like). And of course the bulk of your space (100+ Gb hopefully) is allocated for mythTV. You can set the mount point of this partition as "/data/" or "/home/mythtv/data/" or "/home/" or whatever you like.

During installation, you may aswell create an account called 'mythtv'. Once the installation is complete, create the directory where you will store your MythTV data (make sure it is inside your big partition!). So, for example, if you wanted to create /data you would type 'su' to become root, and:

# cd /
# mkdir /data
# chown mythtv:mythtv /data
# mkdir /data/mythtv

You'll also want to have your kernel source installed (for compiling drivers, later). To install software on Mandrake, we use a convenient tool called "urpmi" that downloads, installs, and configures automatically. Often, you can just type:

# urpmi kernel-source

and your source will be installed. However, this won't always install the correct kernel source. You must make sure that your kernel source version matches the version of the kernel you're using. To determine your current kernel version, type:

$ uname -r
2.6.8.1-12mdk

In this example, a 2.6 kernel is running. To install the right 2.6 source:

# urpmi kernel-source-2.6-2.6.8.1-12mdk

Of course modify this command depending on what source you're looking for. You can also use "urpmq" to query your urpmi sources, and find out what different kernel sources are available, and what the package names are called (be warned: packages like "kernel-source-2.6" might not be the exact kernel version you have, so look for something that matches exactly). If you can't find the right source, you can try configuring some urpmi sources (refer to the next section), and then use "urpmq" again to find a source that matches your kernel.

Once you have your kernel source installed, it's a good idea to double check that it's the right one:

$ cd /usr/src
$ ls -lF
lrwxrwxrwx   1 root root   19 May 28 20:50 linux -> linux-2.6.8.1-12mdk/
drwxr-xr-x  21 root root 4096 May 28 20:50 linux-2.6.8.1-12mdk/
drwxr-xr-x   3 root root 4096 May 21 13:09 RPM/

Thus, make sure that the "linux-*" directory matches what uname returned. If not, you should uninstall the current kernel source (by typing something like "# urpme kernel-source") and then install the correct source. Also, make sure that you have the above symbolic link. If you don't have one, then make it:

# ln -s /usr/src/linux-2.6.8.1-12mdk /usr/src/linux

There is another symbolic link that is often missing, which you should create if it isn't there. Check:

$ cd /lib/modules/2.6.8.1-12mdk
$ ls -lF
lrwxrwxrwx   1 root root     15 May 28 20:07 build -> /usr/src/linux/
...

And make it if it is missing:

# ln -s /usr/src/linux /lib/modules/2.6.8.1-12mdk/build

Get urpmi sources[edit]

Mandrake uses urpmi to download and install all sorts of software. After installing Mandrake from CD, you probably have three CDs listed as sources inside urpmi. When you tell urpmi to install something, it checks all of its sources, finds the package you want, and installs it. For our purposes, it's best to add some online repositories of Mandrake packages to urpmi. That way, all the dependencies will be automatically downloaded and installed as needed. So that we always get the newest packages, we can remove the current sources (which are the installation CDs):

# urpmi.removemedia -a

Now we need to find some good, trustworthy, and fast online package sources. There is a great online tool called Easy Urpmi. You pick your distribution, pick a trustworthy local package source, and it prints out the command you must enter to add the designated source properly. Nothing could be easier! There are numerous mirrors of Easy Urpmi:

Be sure to pick the right Mandrake version and architecture. If you're not sure what you're using, try this:

$ cat /etc/mandrake-release
Mandrakelinux release 10.1 (Official) for i586

An example of what Easy Urpmi outputs, which you then type in a console as root:

# urpmi.addmedia main ftp://ftp.rutgers.edu/pub/Mandrakelinux/official/10.1/i586/media/main with media_info/hdlist.cz
# urpmi.addmedia contrib ftp://ftp.rutgers.edu/pub/Mandrakelinux/official/10.1/i586/media/contrib with media_info/hdlist.cz
# urpmi.addmedia jpackage ftp://ftp.rutgers.edu/pub/Mandrakelinux/official/10.1/i586/media/jpackage with media_info/hdlist.cz
# urpmi.addmedia plf-free ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/free/10.1 with hdlist.cz
# urpmi.addmedia plf-nonfree ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/non-free/10.1 with hdlist.cz
# urpmi.addmedia --update updates ftp://ftp.rutgers.edu/pub/Mandrakelinux/official/updates/10.1/main_updates/ with media_info/hdlist.cz

Downloading all the package information will take a little while (depending on your internet connection speed). Finally, we must add a source for the Mandrake MythTV RPM. Luckily, Thac's RPMs have what we need:

# urpmi.addmedia thacs.rpms http://rpm.nyvalls.se/10.1/RPMS with hdlist.cz

Download MythTV[edit]

With our sources defined, a single command will download, install, and configure MythTV, including all missing dependencies (MySQL, QT, etc.):

# urpmi mythtv-suite

The installer will prompt you for which package to select. You may notice three options, one with "nvidia" in the name, one with "via" and one that is generic. If you specifically have nvidia or via hardware, you can go that route, but the generic packages should work in most cases. When presented with the (long) list of packages to install, say "yes" and wait for it to finish (may take 30 minutes to several hours).

Install ivtv[edit]

Now we need to install the ivtv driver, which is an open-source driver written to enable linux compatibility with Hauppauge WinTV PVR capture cards. The example below should work for the PVR-150, 250, 350, and 500. With a little imagination, you can also adapt these instructions to your own capture card. First off, let's avoid any hardware conflicts by getting rid of the default ivtv driver provided in most Mandrake installs:

# find /lib -name "*ivtv*"
/lib/modules/2.6.8.1-12mdk/kernel/3rdparty/ivtv
/lib/modules/2.6.8.1-12mdk/kernel/3rdparty/ivtv/ivtv-fb.ko.gz
/lib/modules/2.6.8.1-12mdk/kernel/3rdparty/ivtv/ivtv.ko.gz
# rm -rf /lib/modules/2.6.8.1-12mdk/kernel/3rdparty/ivtv

The msp3400 module will be replaced too:

# find /lib -name "msp3400*"
/lib/modules/2.6.8.1-12mdk/kernel/drivers/media/video/msp3400.ko.gz
# rm /lib/modules/2.6.8.1-12mdk/kernel/drivers/media/video/msp3400.ko.gz

If you're nervous about all this, then you can move the implicated files somewhere else for safe keeping. Just make sure you put them out of the modules directory, so that they are not loaded (use the "mv" command and put them in /home/mythtv/tmp for example). Now download the source code for ivtv. Go to the ivtv project page and select download. You'll then have the option to download various versions. As of the writing of this document, the 0.2 drivers are stable, whereas the 0.3 are beta and unstable. A safe bet is to pick the latest 0.2 release (ivtv-0.2.0-rc3j as of this writing). If you have problems with the driver, you can try different versions (or even try a 0.1.9 or a 0.3 driver).

$ cd /home/mythtv
$ lynx http://www.ivtv.tv/releases/ivtv-0.2/ivtv-0.2.0-rc3j.tgz
$ tar -zxvf ivtv-0.2.0-rc3a.tgz
$ cd ivtv-0.2.0-rc3j/driver
$ make
# make install

Those last two commands will compile the driver and put all the required files in the right places. Many users experience errors during the make operations. If you have permission errors, try switching to root and make again. Sometimes the problem is fixed by trying a different driver version. Often the problem is simply that your kernel source version does not match your running kernel (see elsewhere in this document). In extreme cases you may have to change to a different kernel. Try searching the internet (and elsewhere in this document) for the error messages you're seeing. Someone else may already have figured out the solution to your problem.

The next step is to extract the firmware for the capture card. This is binary driver information that we need to communicate with the capture card properly. For this next step to work, g++ must be installed, so let's check:

$ which g++
/usr/bin/g++

If it's not on your system, install it with urpmi:

# urpmi gcc-g++

Now let's compile the firmware-extraction utility:

$ pwd
/home/mythtv/ivtv-0.2.0-rc3j/driver
$ cd ../utils
$ make
# make install

So far so good. Now we need to get the capture card driver binary and extract out the part we need. Depending on whether you have a new or old Hauppauge card, these files will be located in slightly different places on the installation CD-ROM that came with your card. The ivtv wiki has lots of helpful information. For older cards, expect a file called "pvr48wdm_1.8.22035.exe" (or something similar) but for newer cards it will be "pvr_1.18.21.22301_inf.zip" or "hcwPVRP2.sys." You can also simply download the appropriate file from the ivtv firmware page. For example:

$ cd /home/mythtv
$ lynx ftp://ftp.shspvr.com/download/wintv-pvr_250-350/inf/pvr_1.18.21.22301_inf.zip

Then extract the firmware:

# cd /home/mythtv/ivtv-0.2.0-rc3j/utils
# ./ivtvfwextract.pl /home/mythtv/pvr_1.18.21.22301_inf.zip

This should have placed two new files in the "/lib/modules" directory, 'ivtv-fw-dec.bin' and 'ivtv-fw-enc.bin'. You can go check:

$ cd /lib/modules
$ ls -lF
drwxr-xr-x  4 root root   4096 May 29 12:14 2.6.8.1-12mdk/
drwxr-xr-x  3 root root   4096 May 28 21:14 2.6.8.1-12mdkcustom/
-rw-r--r--  1 root root 262144 May 28 20:09 ivtv-fw-dec.bin
-rw-r--r--  1 root root 262144 May 28 20:09 ivtv-fw-enc.bin

The installer has also placed our new modules into the "/lib/modules/2.6.8.1-12mdkcustom/extra", but our kernel won't see these. Instead, let's put them in the right place:

# cp /lib/modules/2.6.8.1-12mdkcustom/extra/*.ko /lib/modules/2.6.8.1-12mdk/misc

Now let's reload the module list. You can reboot too, just to make sure everything gets loaded:

# /sbin/depmod -a
# /sbin/reboot

After rebooting, we can try loading our new ivtv module and see if it actually works. A few modules have to be loaded in the proper order:

# /sbin/modprobe i2c-core
# /sbin/modprobe i2c-algo-bit
# /sbin/modprobe tuner type=2
# /sbin/modprobe msp3400
# /sbin/modprobe videodev
# /sbin/modprobe saa7115
# /sbin/modprobe ivtv

Note that the "tuner type=2" varies depending on your capture card's tuner type. You can find a list of the tuner types in the "tuner.h" file in your ivtv driver directory:

$ cd /home/mythtv/ivtv-0.2.0-rc3j/driver
$ emacs tuner.h

(Note: to exit emacs use "Ctrl-x Ctrl-c".) For North American users, "tuner type=2" (Philips NTSC) will probably work. If the module loaded properly, we can run a quick test. Hook up a video input to your card, and type:

# /bin/cat /dev/video > test.mpg

Let this run for awhile (10 seconds maybe) then hit Ctrl-C to stop it. This should have captured a bit of video and saved it to the file "test.mpg". Try playing the file:

# /usr/bin/mplayer test.mpg

If everything is working, you should see some video. If you see snow or even black, that's actually a good sign. It means the driver is probably working, but you'll need to play with settings to get it to capture on the right channel. If you instead get an error message and no video is captured, then you should start looking for solutions. Maybe your tuner type is wrong. Maybe you forgot to remove conflicting ivtv modules. Maybe a different driver version would work. Play around, search for answers.

If everything is working, then you can create a script to load these modules. Let's call it "/usr/local/bin/start-ivtv". Open a text editor (emacs, vi, kwrite, etc.) and put this in:

 #!/bin/bash
 # a script to load modules for MythTV
 /sbin/modprobe i2c-core
 /sbin/modprobe i2c-algo-bit
 /sbin/modprobe tuner type=2
 /sbin/modprobe msp3400
 /sbin/modprobe videodev
 /sbin/modprobe saa7115
 /sbin/modprobe ivtv

Save and exit (in emacs "Ctrl-x Ctrl-s" does this, in vi use "ESC, :x"). Remember to make the script executable:

# chmod u+x /usr/local/bin/start-ivtv

Now if you type "start-ivtv" (as root) everything will be loaded. Later you can modify this script to start MythTV automatically when the computer boots.

Configure MySQL[edit]

First set the MySQL service to automatically load during boot, and start it manually for now:

# /sbin/chkconfig mysql on
# /etc/init.d/mysql start

And now change the database permissions so that MySQL can do what it needs to. Note that you should replace "root_password" with your root password.

# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('root_password') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

Now update the database:

$ mysql -u root -p < /usr/share/doc/mythtv-0.16/database/mc.sql

MySQL should be ready to go.

Configure MythTV[edit]

Before configuring MythTV, set up an account with a service that will give you XMLTV listings. In North America, this means setting up an account with zap2it DataDirect. Now we can setup our MythTV using a graphical configuration tool:

$ mythtvsetup

The options in this program are fairly self-explanatory. Set everything up consistent with your hardware and preferences.

1. General:
For "IP address for localhost" and "Master Server IP address", you can enter your IP address, or leave it with the defaults if you're running the frontend and backend on the same computer
For the "recordings" and "Live-TV buffers" directories, enter the directories you've chosen. For example, "/home/mythtv/data" or "/data/mythtv" or whatever.
For the "TV format" selected "NTSC" (or whatever your local setting is).
For "VBI format" you probably want "NTSC Closed Caption". Depending on your driver, closed captioning might not be supported.
For "Channel frequency table" most North Americans should select "us-cable".
2. Capture cards:
Create a new capture card, set the "Card type" to "MPEG-2 Encoder card", and set "Default input" to whatever you're using (tuner, S-video, etc.).
3. Video sources:
Create a new video source.
Set "XMLTV listings grabber" to "North America (DataDirect)".
Enter your User ID and password for zap2it
Select "retrieve lineups".
Check that the "Data Direct Lineup" is consistent with your zap2it subscription.
4. Input connections:
Set the "S-video0" (or whatever you're using) "Video source" to the name of your defined video source.

Now you can fill the MythTV database with your listing of TV channels:

$ mythfilldatabase

This operation will take awhile, as MythTV downloads all the program data (for the next few weeks). Once it's done, start MythTV:

# /etc/init.d/mythbackend start
$ mythfrontend

Use the keyboard to move around and see if things are working. If everything is good, then you can update your "start-ivtv" script to include "/etc/init.d/mythbackend start":

 #!/bin/bash
 # a script to start MythTV
 /sbin/modprobe i2c-core
 /sbin/modprobe i2c-algo-bit
 /sbin/modprobe tuner type=2
 /sbin/modprobe msp3400
 /sbin/modprobe videodev
 /sbin/modprobe saa7115
 /sbin/modprobe ivtv
 /etc/init.d/mythbackend start

If everything is working, then you may aswell set your "start-ivtv" script to start automatically at boot time. To do this, edit your "/etc/rc.d/rc.local" file, by adding "/usr/local/bin/start-ivtv" to the end:

# echo "/usr/local/bin/start-ivtv" >> /etc/rc.d/rc.local

Configure remote control[edit]

We'll be using LIRC to read the signals from the Hauppauge remote. Refer to the mailing list archive when searching for answers to problems. First get rid of any other version of LIRC that MythTV may have installed:

# rpm -e --nodeps liblirc0
# rpm -e --nodeps liblirc0-devel

Go to the LIRC page and download the latest release, then untar it and start the configure script:

$ cd /home/mythtv
$ lynx http://prdownloads.sourceforge.net/lirc/lirc-0.7.1.tar.gz
$ tar -zxvf lirc-0.7.1.tar.gz
$ cd lirc-0.7.1
$ ./setup.sh

What to do is pretty obvious. Select item 1, then item 5 "TV Card", then select "Hauppauge TV card". Then select "Save configuration & run configure". Now make and install everything, and link it up:

$ make
# make install
# ln -s /usr/local/lib/liblirc_client.so.0 /usr/lib/liblirc_client.so.0

Open up the file "/etc/ld.so.conf" and add "/usr/local/lib" to the end. Or just type:

# echo "/usr/local/lib" >> /etc/ld.so.conf

Then run ldconfig (which updates the run-time link libraries):

# ldconfig

Copy the configuration file from MythTV documents to your lircrc directory, and add a symbolic link:

$ cd /usr/share/doc/mythtv-0.17/configfiles
$ cp hauppauge-lircrc-nativelirc /home/mythtv/.mythtv/lircrc
$ ln -s /home/mythtv/.mythtv/lircrc /home/mythtv/.lircrc

Copy the appropriate remote config file:

$ cd /home/mythtv/lirc-0.7.0/remotes/hauppauge
# cp ./lircd.conf.hauppauge /etc/lircd.conf

You could now update your "start-ivtv" script to load the remote (lirc_i2c) modules:

 #!/bin/bash
 # a script to start MythTV
 /sbin/modprobe i2c-core
 /sbin/modprobe i2c-algo-bit
 /sbin/modprobe tuner type=2
 /sbin/modprobe msp3400
 /sbin/modprobe videodev
 /sbin/modprobe saa7115
 /sbin/modprobe ivtv
 /sbin/modprobe lirc_i2c
 /usr/local/sbin/lircd -d /dev/lirc0 --permission=666
 /etc/init.d/mythbackend start

Now you should restart everything:

# /etc/init.d/mythbackend stop
# /usr/local/bin/start-ivtv
$ mythtvfrontend

See if the remote works. It might be a good time to reboot, and see if everything starts up:

# /sbin/reboot

Once its booted, you should be able to run "mythfrontend" and use your MythTV. You can open the "/home/mythtv/.lircrc" file and edit it to map your remote properly (more on this later). For the moment, if you're using a Hauppauge silver remote, then you should change "Rew" to "Rewind" and "FFW" to "Forward".

Configure TV-out[edit]

The configuration of your TV-out depends on your hardware. If you're using a video card with a TV-out, then it may simply be a matter of having a TV connected to that output during boot, and the card may output everything (the console, the GUI, and MythTV) to the TV. This is an easy solution. For other cards, you may have to edit your X server configuration file. On older versions of linux, this file would be "/etc/X11/XFree86Config" (there are many similar locations where it may be found). In a modern Mandrake distribution, the file that is used is "/etc/X11/xorg.conf" (which may just be a symlink to another config file mind you). Before going any further, make a copy of your old xorg.conf, and then you can try editing it and see if that helps. After making a change to xorg.conf, you can use Ctrl+Alt+Backspace to exit and restart the X server (and thus your window manager, KDE). If your new settings worked, then you may see output to your TV. If not, you can get back to a console by using Ctrl+Alt+Backspace, and switch back to your old xorg.conf or try something else. Some extra help can be found here and here.

To use the TV-out on the Hauppauge 350 in particular is a good idea, since the 350 has hardware MPEG decoding, which means that it will do the work of decoding the video stream, thereby taking the strain off of your processor. To enable it, there is an option in MythTV that says "use hardware MPEG decoder", which will just use the 350 to output TV. Although this will output recorded playback to the 350's TV-out, you won't have your MythTV menus on that same graphics output. To get everything to work together smoothly, we need our entire X environment (including the desktop and MythTV frontend) to output using the 350's TV-out. Here's what you do:

First, modify your "/usr/local/bin/start-ivtv" script to load "ivtv-fb" also, by adding a line "/sbin/modprobe ivtv-fb":

 #!/bin/bash
 # a script to start MythTV
 /sbin/modprobe i2c-core
 /sbin/modprobe i2c-algo-bit
 /sbin/modprobe tuner type=2
 /sbin/modprobe msp3400
 /sbin/modprobe videodev
 /sbin/modprobe saa7115
 /sbin/modprobe ivtv
 /sbin/modprobe ivtv-fb
 /sbin/modprobe lirc_i2c
 /usr/local/sbin/lircd -d /dev/lirc0 --permission=666
 /etc/init.d/mythbackend start

Now let's get the ivtv driver right. Essentially, X needs a driver to use the 350's TV output. What you want is for the "ivtvdev_drv.o" driver to end up in "/usr/X11R6/lib/modules/drivers". As usual, there are a couple of options. You can build the appropriate driver from the ivtv source you have. The source is here:

$ find /home/mythtv -name "ivtvdev*"
/home/mythtv/ivtv-0.2.0-rc3j/utils/ivtvdev_drv_o
cd /home/mythtv/ivtv-0.2.0-rc3j/utils

The instructions to install are in "/home/mythtv/ivtv-0.2.0-rc3j/utils/README.X11". So essentially you should be able to run install, which will make everything. The second way (which might be easier) is to download a binary version from somewhere, and then just copy it:

$ cd /home/mythtv
$ lynx http://membres.lycos.fr/badzzzz/ivtvdev_drv.o.gz
$ tar -xvzf ivtvdev_drv.o.gz
$ cp ivtvdev_drv.o /usr/X11R6/lib/modules/drivers

Now we need to determine the PCI settings of your card. There are three different ways of getting this info:

# /usr/X11R6/bin/Xorg -scanpci

or

# lspci

or

# scanpci

What you will get will be information about the PCI address of devices. Find the one corresponding to your desired TV-out (the Hauppauge 350 card in our running example). The address is usually given in the order "bus", "card number", "function". Pay attention to whether the numbers are decimal or hexadecimal (preceeded by 0x). The lspci and scanpci tools report in hexadecimal, whereas Xorg outputs decimal. Keep in mind that the xorg.conf file expects things to be in decimal, although you can explicitly denote hexadecimal by preceeding a value with "0x" (or just convert them to decimal).

The output of lspci will look something like:

 00:00.0 Host bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 03)
 00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 03)
 00:04.0 ISA bridge: Intel Corp. 82371AB/EB/MB PIIX4 ISA (rev 02)
 00:04.1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4 IDE (rev 01)
 00:04.2 USB Controller: Intel Corp. 82371AB/EB/MB PIIX4 USB (rev 01)
 00:04.3 Bridge: Intel Corp. 82371AB/EB/MB PIIX4 ACPI (rev 02)
 00:09.0 Ethernet controller: Lite-On Communications Inc LNE100TX [Linksys EtherFast 10/100] (rev 25)
 00:0b.0 Multimedia video controller: Internext Compression Inc iTVC15 MPEG-2 Encoder (rev 01)
 00:0e.0 Multimedia audio controller: C-Media Electronics Inc CM8738 (rev 10)
 01:00.0 VGA compatible controller: STMicroelectronics STG4000 [3D Prophet Kyro Series] (rev 07)

The "iTVC15 MPEG-2 Encoder" is the capture card, which we'll use for TV-out. This card would thus be given the bus designation:

BusID "PCI:0:11:0"

(Remember that 0x0b is 11 in decimal.) Now we need to know what linux device this maps to. The 350 is essentially a special kind of framebuffer device. There are many ways to do this. Let's check "/var/log/messages" and see what "ivtv-fb.o" is mapped to:

grep fb /var/log/messages
...
Jun  6 20:42:30 localhost kernel: ivtv-osd: fb1: iTVC15 TV out frame buffer device
...

You could also use "fbset" and go device by device ("fbset -fb /dev/fb0" then "fbset -fb /dev/fb1" etc.) and see which one corresponds to your required card. In our current example, the output we want is "/dev/fb1" (for video-card TV-out, it may end up being a /dev/fb or a /dev/video).

Now we need to reconfigure xorg.conf, armed with our new information (namely that our card is /dev/fb1 at BusID "PCI:0:11:0" using ivtvdev_drv.o). As usual, be warned: improperly configuring your video settings could damage your video card and/or monitor. These instructions are provided as examples. Use them at your own risk and be sure to double-check that they make sense for your hardware. Now to start, let's add a monitor:

Section "Monitor"
    Identifier "NTSC Television on Hauppauge card"
    # D: 34.563 MHz, H: 37.244 kHz, V: 73.897 Hz
    HorizSync   30-68
    VertRefresh 50-120
    Mode "720x480"
         DotClock 34.564
         HTimings 720 752 840 928
         VTimings 480 484 488 504
         Flags "-Hsync" "-Vsync"
    EndMode
EndSection

That should work for NTSC. For PAL, it would be something like:

Section "Monitor"
    Identifier  "PAL Television"
    HorizSync  30-68
    VertRefresh 50-120
    Mode "720x576"
    # D: 41.475 MHz, H: 44.693 kHz, V: 74.488 Hz
         DotClock 41.476
         HTimings 720 752 840 928
         VTimings 576 580 584 600
         Flags    "-HSync" "-VSync"
    EndMode
EndSection

Note that the Identifier in all xorg.conf sections is arbitrary. You can set it to whatever you like. However, once you decide on a name, remember to stick to it. Elsewhere in your file you must refer to the sections by name exactly. Any little typo will break your configuration. Now add a device:

Section "Device"
    Identifier "Hauppauge WinTV PVR 350"
#    Driver "fbdev"
    Driver "ivtvdev"
#    Option "ivtv" "/dev/fb1"
    Option "fbdev" "/dev/fb1"
    BusID "PCI:0:11:0"
EndSection

Again the identifier is arbitrary, but remember what you pick. Above we are using the "ivtvdev" driver and the "fbdev" option. The commented-out lines are alternate options that you could try using: they may be better for your particular setup (in that case, be sure to comment-out the other line to avoid conflict). Remember to update the "/dev/fb1" as needed by your device, and change the BusID to whatever you determined before. This is critical! Now we define a screen (this again would be slightly different for PAL):

Section "Screen"
        Identifier "Hauppauge Screen"
        Device "Hauppauge WinTV PVR 350"
        Monitor "NTSC Television on Hauppauge card"
        DefaultDepth 24
        DefaultFbbpp 32
        Subsection "Display"
                   Depth 24
                   FbBpp 32
                   Modes "720x480"
        EndSubsection
EndSection

Lastly we switch the ServerLayout to use our new output. Just by changing this one section, you can control what input and output devices (defined above) are going to be used. This will let you switch between different configurations easily. You can have multiple ServerLayouts defined if you like. For your new ServerLayout, it's best to copy the existing one and just modify it as needed. It will end up being something like:

Section "ServerLayout"
    Identifier "TVLayout"
    Screen "Hauppauge Screen"
    InputDevice "Keyboard1" "CoreKeyboard"
    InputDevice "Mouse1" "CorePointer"
EndSection

Save the file, restart X (Ctrl+Alt+Backspace if you are inside the GUI), and hopefully it will begin to output to the TV-out you wanted. Note that for some cards this won't work unless there is a device hooked to that output when X starts up. So make sure the TV is hooked up and turned on before trying to switch to/boot into your new X setting. If it didn't work, you can go back to your older settings or try something else.

Test everything[edit]

So now everything should be working. Upon booting, the drivers should load, and "mythbackend" should have started. If you use "pgrep" you should get a process ID number (PID) for that process:

$ pgrep mythbackend
5166

MythTV should start when you invoke:

$ mythfrontend

Once MythTV is running, you should be able to select "Live TV" and watch TV. Using the keyboard, you can pause ('p' key), rewind and fast-forward (arrow keys) and so forth. You should be able to go into the program guide and select a particular show, and then select "Record" and then wait for it to record that show. There are many options that you can adjust to suit your preferences. You may want to increase the font size or even select an entirely different theme. If the basics of MythTV are working, you can start using it, and over the next while you can continue customizing it, and getting other functions and plugins working properly.