MythTV - eMyTextBooks

Search:  

Free online books - just read it!

See live article   •   MythTV
 

MythTV

Table of contents

Introduction

MythTV is a "do it yourself" (homebrew) personal video recorder (PVR), which is a device that lets you record and watch television shows. In fact, it is more than just a PVR, it is a home entertainment personal computer (HTPC), also called a Media PC. Yet MythTV is more than a mere HTPC, it is a powerful and functional server computer that can provide users with a wide range of entertainment services. With a functional MythTV, you can:

  • Pause and rewind live TV
  • Schedule programs to be recorded, and watch them at your leisure
  • When viewing recorded programs, you can quickly fast-forward, rewind, automatically skip commercials, and much more
  • Play DVDs, VCDs, music CDs, and downloaded audio/video
  • Use your TV as a computer (to browse the web, or anything else)
  • Play video games on your TV
  • Use your TV to play music
  • Get automatic regionalized weather reports
  • and much more!

MythTV is, essentially, a piece of open-source (and free) software that, once running properly, captures your television signal, records it on your hard drive, and allows you to watch those recordings off of the hard drive at a later time. The functionality of MythTV can be accessed with an on-screen menu system, with a web interface (via the MythWeb plug-in), or via a remote terminal (telnet or SSH). It is open source and highly configurable and customizable.

MythTV, and its related open-source components, are being developed by enthusiastic programmers. Everything is provided in a free and open format so as to encourage others to use the software, and hopefully expand upon it. The good news is that MythTV is free, powerful, customizable, fun to tinker with, and fun to use. It can run on any standard PC, so it doesn’t take much to get started with it!

What's the downside?

  • MythTV is still developmental, and as such is not a finished or ‘polished’ product (yet!). Getting it to run properly can be difficult.
  • The fact that MythTV runs on Linux is what makes it so powerful, but to those who don’t have any experience with linux, this can be a major issue.
  • Once MythTV is running, it is very much like a commercial PVR, in that it has an on-screen menu-interface to control all its features. However, MythTV will occasionally require some tweaking and re-working, meaning bypassing the interface and getting to the 'guts' of the system (i.e.: the linux you have running behind the scenes).
  • You need a spare PC of some sort (although this same PC can be used as a file server, web server, etc.).
  • You need a capture card (which can cost $30 to $300, depending what you’re interested in).

Should I build a MythTV?

First, you should only consider building a MythTV if you look upon it as a hobby, and you enjoy tinkering with computers. Don’t build a MythTV simply because you don’t want to spend money on a commercial equivalent (you will just end up being frustrated). If, however, you are interested in a fun do-it-yourself project (that culminates in a highly useful product that your whole family will enjoy), then MythTV may be for you.

Another good point to consider is how much spare computer hardware you have lying around. If you have a lot of spare computer components at your disposal (in your home or through friends), then you can build the hardware for MythTV with very little money. Starting from scratch is also possible, but will end up costing more than a commercial equivalent (of course, your final product may be quite a bit more powerful and feature-rich). Many people who build a MythTV find that they only need to buy a few components (the capture card and maybe a bigger hard drive). If you’re only missing a few components, they can also be purchased second hand (eBay for instance) at a reasonable price. Since the hardware requirements for linux and even MythTV are fairly modest, it doesn’t cost much to get up and running.

Ultimately, the decision to build a MythTV is up to you. If you’re excited about the idea, then no one will be able to stop you.

Alternatives to MythTV

Instead of building a MythTV, you may want to consider alternatives. You can purchase commercial PVRs from a number of companies. Your local cable provider may offer a PVR. The advantage here is that they will likely guarantee compatibility with their listing services, making the transition seamless. The disadvantages are the price tag, and the inability to truly control and customize your system. Other companies build more independent PVRs. The most well known are TiVo (http://www.tivo.com/) and ReplayTV (http://www.digitalnetworksna.com/replaytv/default.asp). TiVo is, by all accounts, a well-designed product and service. However, it is expensive (one has to buy the TiVo PVR, and then pay approximately $15/month for continued service), and many question the long-term viability of the company.

If you’re interested in transforming a computer into a HTPC, you can purchase Windows XP Media Center Edition (http://www.microsoft.com/windowsxp/mediacenter/default.mspx), SageTV (http://www.sage.tv/), Snap Stream’s Beyond TV (http://www.snapstream.com/), or ShowShifter (http://www.showshifter.com/). These software programs will enable you to use a PC to record television, while still having numerous other PC functionalities available. They are probably easier to setup than MythTV, but are not nearly as powerful.

Freevo (http://freevo.sourceforge.net/about.html) is another open source software suite that runs on linux and enables HTPC functionality.

Lastly, you may be interested to know that MagicITX (http://www.magicitx.com/) is offering pre-built MythTV boxes (no international shipping).

Getting started

Linux

Installing and configuring MythTV requires basic knowledge of Linux, a powerful, free, open-source operating system suitable for running servers and multi-user desktops. If you’ve never used linux, the instructions here will seem very mysterious. You should certainly get acquainted with linux before attempting this how-to. That having been said, getting MythTV up and running can be a fun way to learn linux. The first thing you should do, in such a case, is to play with linux for awhile, read some tutorials on the subject, and obtain a basic familiarity with the linux command-line interface (CLI), also known as the shell, terminal or console.

In this document, linux shell commands entered as a normal user (implicitly the user ‘mythtv’) will be denoted by a $ prompt, whereas commands meant to be entered by the superuser (‘root’) will be preceeded by a #.

Its also worth looking at knoppmyth, a distribution of linux that autoinstalls and configures everything.

Other sources of help

If you’re interested in getting a MythTV setup working, this "how-to" guide will hopefully help you. Every installation is different, especially depending on what version of linux you are using. Thus, there are many different how-to documents you may want to refer to for suggestions when getting things working. You will undoubtedly encounter many unique (and annoying) errors throughout your installation, but usually a search on the internet will provide you with an answer.

Some how-to guides worth reading:

(It's also worth noting that the instructions presented here are heavily inspired by Maiku's excellent guide.) The unofficial MythTV wiki (http://www.mythtv.info/) has a list of how-to guides (http://www.mythtv.info/moin.cgi/LinuxDistros) for different linux distributions (Debian, FreeBSD, Gentoo, Slackware, Suse, etc.).

Getting your hardware together

MythTV can run on any modern PC that can run linux. A 'minimum' configuration might be a Pentium-III 500 MHz machine. If attempting to use such a configuration, however, you should consider investing in a capture card that does MPEG-1/2 encoding and decoding on-board, so that the CPU is not overloaded with those tasks. If you have a more powerful computer, you can purchase a less expensive capture card, and let the CPU do the work of MPEG decoding and rendering video.

You will want a healthy amount of RAM/memory (around 1 Gbyte), and will certainly want a big hard drive, so that you can store lots of video (most users get 130 Gbyte drives or bigger). MythTV compresses video using the same compression scheme as a DVD: MPEG-2. This means that one hour of video will use up about 2 Gbytes of space, so you should plan your hard drive needs accordingly.

You will also probably want to get a CD/DVD drive, and may also want to get a DVD writer, so that you can make backups of data, shows, and movies you own. Your computer must also have a sound card (obviously), although it needn't be anything fancy. Having RCA output jacks on the card is helpful, but not required (you can easily purchase an adapter to connect a normal sound card to a TV). Your video card will need to have a TV-out capability (unless you're using a capture card that also has TV-out).

It is also worth thinking about where you will put your MythTV. If your intention is to have it sitting in your living room, directly connected to your TV, then you may want to think about getting quiet hardware. This means finding a hard drive and a power supply fan that don't make too much noise, as well as thinking about what kind of processor (and associated cooling solution) would work best.

Most importantly, you need a capture card. The most widely used capture cards for MythTV are the Hauppauge cards (150, 250, 350, 500). These cards are quite high-performance, many come with a remote control, and most importantly, open-source linux drivers have been written for these cards.

If you have a set-top box (digital cable box, satellite receiver, etc.) then you will probably want to pick up an "IR blaster." This is a device that can be used to send arbitrary IR pulses. This can be used to allow MythTV to control your set-top box. Essentially, when MythTV wants to change a channel, it will send the appropriate IR signal, through the blaster, which emulates the normal remote control for that set-top box. The My Blaster (http://www.mytvstore.com/product_id_005.html) produced by My.TV is compatible with MythTV and linux, or you may consider USB-UIRT (http://www.usbuirt.com/) or buying this (http://www.irblaster.info/), or you can even build your own quite easily (you can find wiring diagrams on the LIRC (http://www.lirc.org/) homepage, or elsewhere (http://losdos.dyndns.org:8080/public/mythtv-info/MythTV_DISH_IR_LED_TX_via_Modified_LIRC.html)).

The most important thing with all the hardware is to make sure that it is linux compatible (that there is a linux driver available somewhere). Most modern linux distributions have compatibility for mainstream hardware built-in, but you should certainly check before buying anything.

Lastly, for those who want a real challenge, in principle you could run MythTV on a PowerPC (PPC) architecture. That is, you could install MythTV on a "Apple/Macintosh" computer that has been converted to run a PPC version of linux. This will require some extra work, such as downloading the MythTV source code and compiling it yourself for your PPC processor, and probably some fiddling to get the capture card drivers working. Some users have reported success in running the MythTV frontend on Mac OS X (with the backend running on another PC). You can find help for that on the MythOnMacOsx (http://www.mythtv.info/moin.cgi/MythOnMacOsx) page. You could obviously use a PC as the backend and as the frontend for the TV, and then use a PowerBook as an additional frontend, for editing videos while watching TV, or for portability. If you're interested in this, you can also run the MythTV frontend on a modified Xbox (running Xbox-linux (http://www.xbox-linux.org/)), or even on a diskless Via EPIA M system. For help with running MythTV on an Xbox, read the how-to (http://www.ps.masny.dk/projects/linux/mythtv-0.4b-xbox-HOWTO.html) and download files here (http://bit.blkbk.com/). To run a network-booting MythTV frontend, use MiniMyth (http://linpvr.org/).

Selecting a linux distribution

In principle, any linux distribution should work with MythTV. Of course, your selection of distribution will be affected by many other things. If you are familiar with a particular distro, then your first impulse may be to use that one. However, you should of course check if there are any compatibility issues with the hardware you're planning on using.

KnoppMyth (http://www.mysettopbox.tv/knoppmyth.html) is a variant of the Knoppix (http://www.knoppix.net/) distribution that has been specifically customized to make MythTV as easy to install as possible. It includes the MythTV suite and many required drivers. In principle, it would be the easiest distro to use for someone who wants an easy install, and since it only installs what is needed for MythTV, it should run smoothly. In practice, other factors may make KnoppMyth a non-ideal choice. If you want your machine to be used for other tasks, then another distribution might be more flexible and powerful. The minimalist design of KnoppMyth may also make it harder to troubleshoot problems that arise. KnoppMyth is certainly worth a try. When starting out, you could download KnoppMyth, burn it to a CD, install it, and see what happens. If everything works, then great! If you find KnoppMyth isn't working out for you, you can just try a different distro. You can find help for KnoppMyth by visiting the forum (http://mysettopbox.tv/phpBB2/).

Many people decide to use Fedora (http://fedora.redhat.com/) because it is a well-supported and popular distro, and because of the highly detailed how-to (http://wilsonet.com/mythtv/fcmyth.php) guide available for MythTV on Fedora.

Many users of MythTV have reported successful installations when using Mandrake linux (now known as Mandriva (http://www.mandriva.com/) linux). Advantages of Mandrake are a healthy user base, the ability to obtain additional help online with Mandriva (for a small fee), and a fairly user-friendly interface (Mandrake includes many GUI-based configuration tools). The availability of MythTV tutorials aimed at the Mandrake distribution make this a nice choice.

Ultimately the choice of distribution is up to you. Probably the most important thing is to pick a distro that others have had success with, that has lots of support documentation online, and that has an easy method for automated packaging and installing of software over the internet. This will make your experience much smoother!

Software prerequisites

MythTV depends on many other software packages being installed on your system. If you are performing a MythTV installation using a package manager, then probably all these other requirements will be automatically downloaded, installed, and configured properly during your MythTV package installation. However, for those of you attempting a manual install (and for your knowledge), these are the packages that MythTV needs to have installed:

  • kernel source and drivers: You need the source code for the kernel to properly compile the capture card driver. Obviously you need all the drivers required for your hardware to be installed and configured properly.
  • X: You need some sort of window managing system. At a minimum, X must be running, although most people will add a desktop environment (such as Gnome or KDE) on top of that.
  • QT: a multi-platform, Graphical User Interfaces toolkit for C++ programming.
  • Freetype fonts
  • MySQL (http://www.mysql.com/): A powerful open-source database system. The MythTV backend manages video recordings using MySQL entries. (The recordings themselves are simply stored as normal files.)
  • LAME (http://lame.sourceforge.net/): Open-source mp3 encoder.
  • LIRC (http://www.lirc.org/): Linux Infrared Remote Control.

Other information

You probably have lots of questions about how you'll end up configuring your MythTV and about what it'll eventually be able to do. Here's some additional information about MythTV (just to give you a preview of what you'll be installing).

Backend and frontend

MythTV uses a client/server architecture, like most linux software. What this means is that one program (mythbackend) deals with capturing video and managing the database, while another program (mythfrontend) deals with showing the user video and proving the on-screen interface. Why split it into two programs? There are many advantages. For one, if mythfrontend freezes or crashes, the backend will continue recording and managing properly. This makes the system rather robust. Secondly, this architecture means that you can have one computer run the backend, and use a different computer as the frontend. The frontend computer will log into the backend to get the video data. This gives you quite a bit of flexibility. You can even have multiple computers attached to different televisions, each running a separate instance of the frontend, but all getting their video from the same backend. This gives you even more flexibility. Some users have a laptop that also runs the frontend, so they can watch TV in bed, or even edit recordings while watching something else on TV. You can even copy recordings to your laptop and take them on vacation with you. There are many possibilities.

With regard to configuring MythTV, remember that the frontend and backend are separate. Even if you exit the frontend, the backend is probably still running. During the configuration phase, you may need to exit the backend and restart it for changes to take effect. In principle you can do this without even shutting down the frontend.

Remote controls

Will you be able to control your MythTV with a remote control? Yes, it's possible. A program called LIRC allows linux to interface with remote controls. Some capture cards come with remote controls. LIRC can be configured to receive data from these. A number of IR detectors can also be interfaced via LIRC, enabling you to use other remotes. LIRC in principle can be configured to interface with multiple remotes and IR blasters.

TV listings

Will you be able to have an on-screen program guide? How will you get your listings? In many places, you can sign up for a DataDirect account with Zap2It (http://labs.zap2it.com). By answering a simple survey, you'll receive a subscription that allows you to download program listings. MythTV has built-in functionality to connect to that service. If you need a "certificate code" for zap2it, you can use ZIYN-DQZO-SBUT (this lets zap2it know that you're using MythTV). The code TGYM-ZKOC-BUTV may also work.

Set-top box

Will you be able to control your satellite or cable provider box (set-top box)? What you can do is use a device called an IR Blaster. This device can be programmed to send IR pulses that mimic the signals from your remote control for your set-top box. Essentially, whenever MythTV needs to change a channel, it will send a signal to your set-top box to change channels as required. This introduce an additional delay in switching channels, which can be annoying if you're trying to "channel surf" on live TV. However, most users of MythTV change viewing habits, and rarely watch live TV anymore.

Many set-top boxes have input connections (serial, USB, etc.). In principle, a direct connection between your MythTV and the box should be possible. In practice, few cable providers or set-top box companies will give out the required details in order to make your box work. It is much simpler to use an IR blaster.

Capture card

In order to use a capture card, you of course need a linux driver. The ivtv driver is an open-source driver written for linux to enable interfacing with capture cards. This driver is geared towards the Hauppauge WinTV PVR-250 and 350 cards, although other cards are also supported. The people at Hauppauge have provided the people at ivtv with some useful information, which has enabled a highly functional driver to be written.

Plugins

MythTV's functionality has been greatly extended by a large number of plugins. In most modern MythTV packages, all of these plugins are wrapped together into a "MythPlugin" package. Thus, they do not need to be installed individually. Available plugins include:

  • MythBrowser: allows web browsing on your MythTV
  • MythDVD: DVD library features
  • MythGallery: image gallery/slideshow plugin
  • MythGame: lets you play video games on your MythTV using xmame frontend
  • MythMusic: play music (with visualizations) through MythTV
  • MythNews: RSS feed reader
  • MythPhone: video conferencing plugin
  • MythVideo: play any video file in MythTV
  • MythWeather: get localized weather forecasts
  • MythWeb: lets you control your MythTV from anywhere, using a web browser

Installing MythTV

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 gprmi (graphical version of urmpi), 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

Download and install Mandrake

You can download the latest Mandrake ISO images from the official download page (http://www1.mandrivalinux.com/en/ftp.php3), 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. So install:

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

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 (http://easyurpmi.zarb.org/). 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 (http://rpm.nyvalls.se/index10.0.html) have what we need:

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

Download MythTV

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

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 (http://ivtv.sourceforge.net/) and select download. You'll then have the option to download (http://ivtv.writeme.ch/tiki-index.php?page=DownloadIvyTv) 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 (http://ivtv.writeme.ch/tiki-index.php?page=Drivers+and+Firmware) 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 (http://ivtv.writeme.ch/tiki-index.php?page=FirmwareVersions) 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

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

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 (http://labs.zap2it.com/) 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

We'll be using LIRC (http://www.lirc.org/) to read the signals from the Hauppauge remote. Refer to the mailing list archive (http://sourceforge.net/mailarchive/forum.php?forum=lirc-list) 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 (http://www.lirc.org/) 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

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 (http://www.schaefer.dhcp.biz/pvr350tvout.htm) and here (http://wilsonet.com/mythtv/fcmyth.php).

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 (http://membres.lycos.fr/badzzzz/), 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 "Hauppauge Layout"
    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

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.

Fine tuning

Once MythTV is mostly running (i.e.: you're able to pause, record and play TV), then you can start tuning your system to do exactly what you want. The possibilities are endless, but there are a couple of things you'll probably want to tweak.

Remote control

For your remote control to work, LIRC must be loaded. Thus, in one of your boot scripts, you should have:

/sbin/modprobe lirc_i2c

This loads the lirc_i2c kernel module. Thereafter, you can configure your remote using the "/home/mythtv/.lircrc" file (which is actually a symbolic link for "/home/mythtv/.mythtv/lircrc"). Inside this file, you will find a bunch of statements like:

begin
   prog = mythtv
   button = Power
   config = Esc
end

These statements should be self-explanatory. The "prog = mythtv" tells LIRC that this command should be bound to the MythTV application. The "button = Power" tells LIRC that when the "Power" button on the remote is pressed, this command should be issued. The "config = Esc" tells LIRC what command to pass along to the application. So when I press "Power" MythTV will receive the "Esc" signal (a convenient mapping, since then you can use the power button to exit from MythTV). You can set these mappings up however you like. To find out what names are allowed for your particular remote, go to the documentation provided with LIRC (created when you untarred the LIRC source). For instance:

$ cd /home/mythtv/lirc-0.7.1/remotes/hauppauge/
$ emacs lircd.conf.hauppauge

Obviously you should navigate to the documentation appropriate for your remote. In the end, your lircrc file should have a bunch of begin/end statements (one for each button), which are bound to MythTV functions in a way you like. If your MythTV installation went well, there are probably already some smart defaults loaded.

To make proper use of specialty buttons, you can set key bindings. In MythWeb's settings mode you can set additional key bindings (such as using F2 to launch MythWeather directly, for instance). Then in LIRC you can set a remote button to that same key.

When using MythVideo and MythDVD, mplayer (http://www.mplayerhq.hu/homepage/index.html) is called to show video. If you want your remote control to work with mplayer, then you can set additional bindings for mplayer. The bindings might look like:

begin
   prog = mplayer
   button = Vol+
   config = volume +1
   repeat = 2
end
begin
   prog = mplayer
   button = Vol-
   config = volume -1
   repeat = 2
end

The program is now "mplayer." The allowed keys are the same as before (find the doc for your remote). The allowed "config =" lines are based on the commands that mplayer knows. Type "mplayer -input cmdlist" for a list of commands that are allowed, and then bind the ones you want. Note that the "repeat = 2" command controls what happens when a button is held down. That is, changing this number will control how quickly the button will repeat when held (a low number repeats fast, a high number is slow). You can play with these settings to suit your fancy. You can also find samples (http://wilsonet.com/mythtv/lircrc-haupgrey.txt) online of other people's settings, for inspiration.

Control set-top box with MyBlaster

If you have a set-top box that you want to be able to control from within MythTV, you have several options. Many types of IR blasters (whether purchased or home-built) can be controlled using the LIRC (http://www.lirc.org/) program already described.

If you're using My.Tv (http://www.mytvstore.com/)'s MyBlaster (http://www.mytvstore.com/product_id_004.html) product, then here's what you do. First of all, note that My.TV only guarantees that the serial version of their product will be compatible with linux. You can view their instructions (http://www.mytvstore.com/mythtv_linux.html) or go to the forum (http://www.mythtvtalk.com/forum/viewtopic.php?p=622#622) for help. Another user of MythTV has written Perl module that lets us easily interface the MyBlaster product. So first you should download the MyBlaster14.zip (http://www.my.tv/download/MyBlaster14.zip) file from somewhere. Inside the zip file, you'll find documentation for a variety of devices (TVs, satellite boxes, etc.). Find your device type and brand, and you'll see a bunch of codes that might work for your device. So next let's test to see which code works. Let's put the MyBlaster.pl perl script into "/usr/local/bin" (as root):

# cp MyBlaster.pl /usr/local/bin

Now edit this file in your favorite text editor. Change the "$Device_Type=" to your device type. Now change the "$remote_code=" to one of the codes suggested for your brand. Save the file and exit. Now turn on your set-top box (or TV, or whatever), and point your IR blaster product at the box, and type:

# MyBlaster.pl power

This will tell the product to send the signal for "power on/off". If your box turns off, then obviously the code works for your model. If nothing happens, edit the script again, and try a different code. Eventually you'll find the code that works for your product. Then inside mythtvsetup you can change the "external channel change comamnd" option to be "/usr/local/bin/MyBlaster.pl". Now everytime MythTV wants to change channel (for that video source), it will call MyBlaster.pl, and pass the channel number as an argument. You can restart your lirc module and try it in MythTV. When you change channel, you should indeed see your set-top box change channel (remember to point your IR blaster at the device!).

Control other devices

You can in fact use your whole setup to control multiple devices, such as your set-top box and your TV (and VCR, etc.). All it takes is some imagination and time modifying the right scripts. A useful option to be aware of is setting "prog = irexec" inside your ".lircrc" file. Here's a trivial example: let's say we modify our "/home/mythtv/.lircrc" file to contain

begin
   prog = irexec
   button = Power
   config = echo "Hello world!"
end 

If you save these changes, and then run "irexec" from a command line, you should see "Hello world!" output to the prompt every time you press the "power" button on your remote control. The irexec program lets us execute arbitrary shell commands using any key on the remote. The only catch is that the irexec program has to be running. You can easily arrange for this to be the case by, for instance, adding "/usr/local/bin/irexec &" to your "/usr/local/bin/start-ivtv" script (the trailing & tells the command to be placed into the background).

Now we can get a little more clever. Let's say our remote buttons are mostly bound to MythTV, and we are using the "MyBlaster.pl" program to control our set-top box. Now say we further want the "power" button on our remote control to turn the television on and off (but not turn off the set-top box!). Here's what we could do. First, let's make a copy of MyBlaster.pl:

# cd /usr/local/bin
# cp MyBlaster.pl MyBlasterTV.pl

Now find the device code for your TV in the MyBlaster documents (figure out which one is the right code, as before, by modifying the file and trying "MyBlasterTV.pl power" until the TV turns off). Once your MyBlasterTV.pl file is controlling the TV, you can edit your .lircrc file and add:

begin
   prog = irexec
   button = Power
   config = MyBlasterTV.pl power
end 

When you press the power button on your remote, the LIRC daemon (lircd) will pass the command to "irexec" which simply executes "MyBlasterTV.pl power" which should send a signal to your IR blaster that fools your TV into turning off. Obviously you can map buttons on your remote to all sorts of different scripts. In this way, you can control a wide variety of AV equipment.

Changing channels faster

New users of MythTV are usually quite annoyed with how slowly it changes channels, especially if you're using a set-top box. MythTV is constantly buffering live TV. This is what allows you to pause and rewind at will. However, this also means that you're always 4-5 seconds behind live television. So, if you want to change channel, there's always a delay while buffering of the new channel starts. If you're using an IR blaster to control a set-top box, then there's an additional lag due to that. Can anything be done?

You can (slightly) optimize the channel changing of a set-top box. If you're using the MyBlaster script, you can optimize it. First off, in the "/usr/local/bin/MyBlaster.pl" file you can enable the finalize option by setting "$finalize=1;", which will cause the blaster to send a keystroke to immediately confirm a channel change. For most remote controls there is a "select" or "ok" button that does this, so set that in the "$finalize_key=" section. You can also try editing the "Emit_Time=0.333;" option. This is the time that each keypress IR signal lasts. By reducing this, key entry will be faster. Don't reduce it too much, however, or else keypresses will be lost. You can adjust this value and see what happens. Modern set-top boxes seem to be able to handle "Emit_Time=0.2;" without much trouble. The "$inter_key_delay=1;" option can also be changed. This is the time in between key pulses. As usual, too low a setting and your box will become confused. The default 1 second is safe, but many boxes can handle 0.2 seconds without trouble. These options can make channel switching faster.

Ultimately, however, you won't be able to get rid of that last 4 seconds of buffering delay. This leaves you with two options. First, you could set up your TV so that a live signal from your set-top box goes straight to your TV, and another signal goes to your MythTV. Then you could switch between "live mode" and "myth mode" by changing the input selection on your TV. This requires some user intelligence, however, because you might be changing channels while MythTV is trying to record something, thereby ruining that recording.

Another option is to just adapt! Most users of MythTV find that after awhile they give up the whole "channel surfing" habit, as it is mostly a relic of not being able to find anything interesting on TV at any given moment, or being bored by commercials. With MythTV, you'll hopefully only be watching recorded shows that you like, and you'll watch them when it suits you. When you sit down to watch TV, you'll just look at the listing of recently recorded shows, and watch something that interests you. Not only that, but you'll just use the auto-commercial-skip feature to avoid boredom. Give this new paradigm a chance, and you may find that the need to compulsively change channels will disappear.

MythWeb

If your MythTV installation went well, then MythWeb is probably already running perfectly. On your MythTV box, open a web browser and go to "http://localhost/mythweb/" (or "http://127.0.0.1/mythweb/"). Don't forget that trailing slash, or you'll just get a "page not found" error! If you can see your MythWeb, then all is well. Refer to the next section for information on making it accessible worldwide on the internet. If you can't see your MythWeb, then you should probably look into the options (http://httpd.apache.org/docs/mod/core.html) for apache (http://www.apache.org/), the web server that is running your MythWeb (note that the apache process/service is called httpd or httpd2 depending on your version). To modify the behavior of your MythWeb, you are meant to modify the files:

/var/www/html/mythweb/.htaccess
/var/www/html/mythweb/config/conf.php

These documentation also suggests that you add the option "UseCanonicalName on" to your apache configuration file, located at: "/etc/httpd/conf/httpd2.conf" However, the default is "on" in modern versions of apache, so adding this directive is usually not necessary.

If you have problems seeing your MythWeb page outside of your local network, then it may be that your ISP is blocking the default http port (80). You can work around this by running MythWeb on another port (anything greater than 1024, like, for example, 8050). Remember to adjust any router settings for port forwarding aswell. See elsewhere in this document for more help on that.

If you have problems seeing your MythWeb page inside your local network, but can see it outside, then probably your router is not passing internal requests properly. One easy fix is to use your MythTV's internal IP address inside your network (instead of using the domain name that you would use outside of your home network). You may want to set your MythTV to use a static IP address if you do this. You may also be able to fix this by adjusting router settings (but probably not). Alternately, you can buy a router that does port forwarding properly (Cisco (http://www.cisco.com/) routers have been reported as being a good choice in this regard).

Dynamic DNS

MythWeb allows you to access your MythTV over the internet. However, to access your MythTV from outside your house (work, vacation, etc.), you need your computer to act as a web server. Linux makes running a web server easy. A program called Apache (which runs as "httpd") will do everything for you. If you've installed MythTV and MythWeb properly, then apache is already running.

However, if you connect to the internet with an ISP that uses DHCP, then you're probably assigned a random IP from a pool. This means that your IP address will change periodically. This is called having a "Dynamic IP address." With your address constantly changing, how will other computer know where to reach your MythWeb?

The solution is to use a DNS service that updates when your IP addres changes. Luckily, there are numerous free subscription services that will let you do this with linux. The most well-known appear to be no-ip.com (http://www.no-ip.com/services/page/free/dynamic/dns) and DynDNS (http://www.dyndns.org/services/dns/dyndns/). An extensive list (http://www.technopagan.org/dynamic/#TheList) of options is available. Pick the one that suits you! Most of these services will allow you to pick the domain name from a short list, and then will map your username onto that. So if your username with their service is "user155" then you may end up with a domain like "user155.no-ip.com" or whatever. Then you can get to your MythWeb anywhere. It's address will be: http://user155.no-ip.com/mythweb/

You may have to play with port options in Apache if your ISP blocks port 80. Refer to other help in this document for details. These services will provide you with a program that runs on your linux box. Whenever its IP address changes, it will update the service, so that DNS lookups always get sent back to your current IP address. It's an easy (and cost-effective) way to get your own (semi-customized) domain name. If you want a full-featured domain name, you can upgrade your service easily.

DVD menus

By default, MythTV uses mplayer to play DVDs. However, mplayer doesn't support DVD menus. You could try installing xine (http://xinehq.de/index.php) instead, and configuring MythTV to call xine instead (see xine man page (http://www.die.net/doc/linux/man/man1/xine.1.html) for command line syntax).

Problems along the way

Trouble installing MythTV RPM for Mandrake

You may encounter errors after trying to "urpmi mythtv-suite". If during the MythTV package installation you receive errors like "bad signatures" try entering 'y' to continue, and see if the packages work anyway. If you get errors like "installation failed", it may be because you're running Mandrake version 10.1 Community. To figure out your Mandrake version:

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

This apparently has to do with conflicting files in different packages. Let the install attempt complete, then run "urpmi mythtv-suite" again and see what happens. You can look through the error message to isolate which packages are having problems. Try installing these packages seperately (urpmi package_name) and then install MythTV again (urpmi mythtv-suite). You can also try to force the install to finish:

# urpmi --allow-force mythtv-suite

There's no guarantee this will work, however.

Error during make of ivtv

There are many reasons why an ivtv compilation might fail. You can try different versions of the driver. If you are receiving missing directory errors, you might be missing a symbolic link. Check that it is correct:

Conclusion

Installing and configuring MythTV can be a challenge. However, there's no denying that having a functional MythTV is both a matter of fun and pride. There's so much a MythTV can do, that you'll be happily playing and tinkering for a while to come. Also, most users of MythTV note that they change their viewing habits entirely. Instead of watching TV based on the network's choices, you can watch on your own schedule. This doesn't necessarily mean you'll watch more TV. Rather, you'll find that the time you spend watching TV is better spent. You watch quality shows and don't waste time surfing, unable to find something interesting on TV when you are in the mood to watch. You'll also be amazed how many good shows and movies routinely play on TV (especially at odd hours). By using your MythTV, you'll be able to finally take full advantage of your subscription to cable or satellite television. It's a liberating experience, especially because you're in full control of both your TV viewing experience, and the hardware/software that makes it all possible. So enjoy it!


Also helps finding: mythtw, ythtv, mthtv, myhtv, myttv, mythv, mytht, hythtv, jythtv, kythtv, nythtv, mtthtv, muthtv, mgthtv, mhthtv

   
 
  
Add to bookmarks
Top Articles
 
Ada Programming/Keywords/array
Ada Programming/Keywords/else
Ada Programming/Keywords/package
Ada Programming/Keywords/private
Ada Programming/Keywords/subtype
Ada Programming/Keywords/type
Cookbook:Chicken
Cookbook:Dessert
Cookbook:Flour
Cookbook:Pepper
Cookbook:Sugar
Cookbook:Tablespoon
Dichotomous Key
Main Page
Robotics
SA NCS:Dramatic Arts
SA NCS:First Additional Language
SA NCS:History
SA NCS:Mathematical Literacy
SA NCS:Mechanical Technology
SA NCS:Second Additional Language
Search LiveJournal blogs for MythTV
 

Credit Consolidation  •  IKA Processing Equipment  •  Cheap Sheets  •  Credit Cards •  Credit Consolidation

Copyright @ 2005 eMyTextBooks.com
This article is from Wikibooks. All text is available under the terms of the GNU Free Documentation License.