MythTV is an application suite designed to provide an amazing multimedia experience. It provides PVR functionality to a Linux based computer, and also supports other media types. Combined with a nice, quiet computer and a decent TV, it makes an excellent centerpiece to a home theater system.
The MythTV system is split into a backend and a frontend. Each component has its own functions:
- Schedule and record television programming
- Stream video data to the frontend
- Flag commercial breaks
- Transcode videos from one format to another
- Provide a pretty GUI
- Play back recorded content
- Provide an interface to schedule programs
The frontend and backend may be on separate computers on a network, and there may also be multiple frontends. This architecture allows for a central media distribution system that can reach anywhere a network can. This is a remarkably flexible system, and it even allows very low power machines to act as perfectly usable frontends.
MythTV is a very scalable system. With standard definition television and pure MPEG2 encoding and decoding with hardware acceleration, even a very modest system can act as both frontend and backend. How modest? Some people report being able to use fanless Via systems with Hauppauge PVR cards for both backend and frontend simultaneously. While the author does not condone such a lightweight system, it has been down successfully.
On the other end of the spectrum, high definition TV with MPEG4 transcoding and commercial flagging can require serious horsepower. Most people in the HD realm use high end Athlon XP's, midrange to high end Athlon 64's, and high end Pentium 4's for their backends. The frontend can get away with a somewhat more midrange processor if XvMC playback acceleration is used.
All systems are going to need a tuner card. The Hauppauge PVR series of cards (150, 250, 350, and 500) are very popular for use with MythTV due to fairly decent linux support and low CPU usage. Other cards, like those based on the BT878 chipset are also used. Unlike the PVR series, BT878 based cards require significant amounts of CPU power to save the video, as these cards output raw frames and not compressed streams.
The only combination of hardware the author can say works is an Athlon XP 1700+ frontend with 512MB of DDR, and a Pentium 4 2.8GHz backend with 512MB of DDR2.
In order to install MythTV on your system(s), you must have a working Linux installation. Since this is the Arch Linux website, this article will be geared towards that distribution. A simple base system with no extras is a suggested starting point.
For the backend, it is also good to have Apache, PHP, and MySQL working properly so that anybody can use a web browser to schedule programming through MythWeb. While it is not necessary, it's a very handy feature.
A working X Window environment is necessary.
There is a MythTV package in Extra, but it is out of date and has problems that have never been fixed. As an alternative, there is another package in the AUR. You can install it from the Community repository, or by building it from the PKGBUILD.
- Add this to your pacman.conf file in order to access the Community repository:
[[community]] Server = ftp://ftp.archlinux.org/community/os/i686
- Install the MythTV package:
# pacman -S mythtv
At this point you have a generic MythTV installation. It must be refined into a backend, a frontend, or both.
Before setting up your backend, make sure you have a functioning video capture card or firewire input from an STB. Unfortunately, that part of setup is outside the scope of this article. It is also helpful to have an account with DataDirect from Zap2It labs. If you are in the United States, this service provides TV listings at a minimal cost. All you have to do is take a survey every three months, and you get (monetarily) free listings. Users outside the United States will need to use screen scrapers (xmltv) to do the same job.
Setting up the database:
- Install and run MySQL
# pacman -S mysql # /etc/rc.d/mysqld start
- Add this to the daemons line in rc.conf:
- Import the database structure:
# mysql < /usr/share/mythtv/mc.sql
Note that you may need to add \"-u root -p\" in order to use the root user and supply a password if you have configured MySQL in the past.
Setting up the master backend:
- Start up X, if you haven't already:
- Open up xterm, or the GUI console of your choice
- Run the mythtv-setup program
- Capture menu
If this is your master backend, put its IP address in the first and fourth fields, identifying this computer as your master and giving its network IP address.
On the next page, enter the paths where recordings and the live tv buffer will be stored. LVM or RAID solutions provide easily accessible large scale storage, but again, those are outside the scope of this article. Set the live tv buffer to a size you can handle, and leave everything else alone.
On the next page, set the settings to your locale. NTSC is mostly used in North America, and be sure to set whether using cable or broadcast.
On the next two pages, leave everything as is, unless you know for sure you want to change it. On the next page, if you have a fast backend that can handle recordings and flagging jobs simultaneously, it is recommended to set CPU usage to \"High\", maximum simultaneous jobs to 2, and to check the commercial flagging option.
On the next page, set these options to taste. Automatic commercial flagging is highly recommended. Ignore the next page and finish.
- Capture card menu
Select your card type from the drop down list. Hauppauge PVR users will select the MPEG-2 encoder card option.
Point mythtv-setup to the proper location, usually /dev/v4l/video0
- Video sources menu
This is where it gets important to have a source for TV listings. DataDirect users should create a new video source, name it, select the North America (DataDirect) option, and fill in their logon information. In order to verify that it is correct, go ahead and retrieve the listings.
- Input connections menu
This menu is rather self explanatory. All you need to do is pick an input on the capture card, and tell myth which video source it connects to. Most users will select their tuner and leave all the other inputs alone. Satellite users will select a video input, and on the next page provide the command to change channels on their STB using an external channel change program. This is also outside the scope of this article.
- Channel editor menu
This menu is safe to ignore
- Exit the program (esc)
- Run mythfilldatabase
This should populate your mysql database with TV listings for the next two weeks (or so).
- Add mythbackend to rc.conf
While it isn't absolutely necessary to restart at this point, it is a good idea, just to clean things up and make sure that all the necessary daemons start up automatically.
Compared to the backend, getting a frontend running is trivially simple. Just make sure you are in an X environment as a normal user and run mythfrontend. It will pop up a menu asking about the IP address of the backend, and the local computer's name and IP. Fill in this information and your frontend should be functional. On the other hand, the frontend has has more options than a luxury car. All of those are an article on their own. There are a few notable options that should be set to ensure a good working setup. If you don't have an interlaced monitor (and almost nobody does), you will need to deinterlace your television output. Go into the TV playback menu and select kernel deinterlacing or bob2x deinterlacing. Try both and see which you like better. Also, in the general settings page, it is good to set up your [Alsa setup] settings, but those vary so greatly it isn't worth suggesting values here.
There are a number of plugins available for MythTV in the AUR. They range from RSS readers to DVD players. Take a look at them. Simply installing the package on the frontend computer should impart the intended functionality. There is rarely any additional setup, and when there is, the install file will mention it.
Hints to a Happy Myth System
But not full articles (yet)
- Run ntpd or openntpd on your backend to make sure it always has the right time
- LIRC on your frontend allows you to use a remote control, which is wonderful in a living room
- Use gdm, kdm, or xdm to automatically log in your frontend, and ~/.xinitrc to load mythfrontend on boot
- Set the automatically run mythfilldatabase option on one of your frontends to make sure you always have listings
- Don't forget to use the verbosity statements and log file location arguments to mythfrontend so you can see when things break