oreilly.comSafari Books Online.Conferences.


Clever Tricks with MythTV

by John Littler

MythTV is one open source answer to TiVo. Its creator started the project because he thought that the TiVo was cheap enough, but having to sign up for subscriptions was a pain. MythTV allows you to record and play TV and skip ads; and with plugins, retrieve TV schedules, play DVDs, emulate a Nintendo, check weather forecasts, play Linux Games, read RSS feeds, play music, and more.

Beware that some stations are actively working to defeat ad skipping, so it doesn't always work.

Putting It Together

While this series of thoughts is not about setting up MythTV, it's probably not a bad idea to mention some of the easier ways of putting it all together. The easiest way if you're starting from scratch is to use the Knoppmyth ISO, a 500MB bootable CD file that will set you up and get you ready (well, almost ready) to go. Note this is not a run-from-the-CD thing--it installs a special truncated Linux that has all of the necessary MythTV commands. If you want to add to the basic lot of apps, of course you can. Another easy way, with Gentoo, is to emerge mythtv. Debian and Red Hat have their own ways. Despite some people saying it's a piece of cake, many people find the SuSE installation to be hard work. There isn't even a MythTV package on the CD/DVD, which is a bit strange for a distro that used to be known for having practically everything on it.


  • Remote Control

    The general advice is not to buy a TV card with its own remote. Apparently, this almost guarantees that you'll have difficulty making it work. The best way is to use an IRda keyboard and a programmable remote control that operates on a variety of frequencies. You train the remote from the keyboard, which will be useful also for web browsing or other activities you might consider later.

  • TV Cards

    The usual deal of checking what works on Linux before buying still applies. There are a range of Hauppaugge cards and others that do work, but when you look at documents about people's setups, beware of differences such as the differences between NTSC and PAL. Don't assume that because someone has an NTSC card working, that PAL on the same named card will work.

    A tuning card can only "watch" one channel at a time. This means you can't watch live TV while you're recording another channel, for example; for that, you need an extra card. You can watch on one card while serving different recorded programs over the network.

    One piece of advice from my general web experience is to test that the TV card works using a TV-viewing app before you start messing with MythTV. This could save some consternation later if you have problems. At least you'll know the card works and can look elsewhere for a solution.

    The most commonly used cards seem to be the Hauppauge PVR 250 and PVR 350.

  • Hard Drives

    For streaming over a network, you'll need to do the math regarding the network and the HDD. You'll want a fast spinning disk anyway. A 7200RPM Seagate Barracuda Serial ATA drive is one good choice.

    As far as space goes, recording at VHS quality will use 700MB an hour. DVD quality requires between 2.5 and 5GB an hour. Your needs will vary, but 150GB seems a good minimum. Remember you can export to DVD to clear out things you want to keep. That brings up the interesting question of digital archiving when you want to keep things "forever." That doesn't seem to be doable right now.

  • Video Cards

    If you'll be sending to a TV, make sure your video card supports TV out.


Related Reading

Linux Unwired
By Roger Weeks, Edd Dumbill, Brian Jepson

Once You're Going (The Fun Part)

One nice by-product of complexity and open source is that we can dream up and implement all sorts of additions or different types of use. Here's a sampling.

Web Browser -> Wireless Keyboard -> Wiki, Etc.

The scenario here is that you have the serious computers elsewhere in the house, but occasionally you might want to pop onto the Web for something. Maybe there's a house wiki and you want to check it, add to it, or whatever. Maybe you just thought of something to add to the grocery list. Maybe you've just watched a movie with friends and you want to find a local restaurant.

Using the wireless keyboard we thought was a good idea to set up the learning remote, we can input data easily enough. The Myth box is on the network, so maybe we run an Xsession somewhere else, or maybe Firefox on the Myth box through MythGame. Despite its name, you can use it to start other apps, not just games.


Copyright questions aside, there are several reasons you might want to do this. Let's say you're keeping clips of the best moments of your dog's life that you recorded for posterity, or maybe you have a webcam that takes ten-second clips every five minutes. Perhaps you have a little program to do with your web site. Whatever it might be, you can store the videos under MythVideo.

Program Metadata -> RSS or Atom Feed of Recorded Shows

Using program metadata, it's easy to script an RSS or Atom feed of all of the recorded shows and clips on the Myth box. With reference to podcasting, you could also script any necessary format changes.

With the Myth box connected to the Internet, you can check things while you're at the office or away somewhere. This could be more interesting in connection with the next idea.

Program Advice and Notification

You can set up MythTV to record time slots on a given channel once or regularly, but in order to do so, you need to know what you want to see. If you're not an avid TV watcher, reading through the schedules is liable to make your eyes glaze over in pretty quick order.

How about parsing the schedules with a script looking for certain keywords? Even better, what if there were web sites that covered your geographic area in some critical detail? You could then fetch the files with wget or curl and scan them for keywords, as well. You could run this as a cron job however frequently you find appropriate, scripting it so that the Myth box would email you on significant occasions.

After you have the keywords somewhere close to right, add to this by dipping into the MySQL back end and inserting the record information automatically. This could be especially useful if you're away a lot. You can check the RSS feed to see what your Myth box has been up to.

Alternately, getting slightly carried away, how about training a neural net by giving it information on what you really watched? Let it loose on the listings and the record information back end.


Once you've put everything together, you might want a way of remotely scanning what you've recorded to see what the heck it's about. Grab a couple of random sections at the start, salt them away, and give them the podcasting treatment. Adding a delete button somewhere around there would also be handy.


The contrib directory contains a tool called mythtvosd. This makes it easy to display any sort of message on the screen while MythTV runs. You could use it for notification of new email or to drive everyone watching crazy by scrolling new RSS feed stories across the screen.

MySQL Reports

By using different queries, you can order up reports any aspect of the MythTV back end. Maybe the available information is too basic for your needs and you'd like more on certain aspects. Suppose I'm absolutely nuts about a certain TV program named Stir Track, and I like it so much that I subscribe to one of those services that provides an ASCII summary for every episode of what every character says and does. I could use a variety of ways to set up extra fields to contain that information. Then I could search for which episodes contained, say, Captain Creak, exploding Christmas puddings, and Kora.

Digital pattern-searching (meaning, searching the TV program data itself) would be nice, but unless your Myth box is a supercomputer, the results won't be very timely. Still, that's something interesting to play with in the future.

Note: This article came about through discussions with chromatic, my editor at O'Reilly. He came up with the keyboard and wiki item, as well as the RSS feeds.

Thanks to IBM for the use of a ThinkCentre.

John Littler is chief gopher for

Return to the Linux DevCenter.

Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: