MythTV is the ultra flexible framework for media that belongs in your living room. Originally MythTV focused on allowing a user to get TiVo like functionality from their PC, but it has since expanded to a complete solution for media management. It supports a wide variety of TV tuner cards included Hauppauge WinTV-PVR series and even Comcast DCT-6200 cable boxes over the firewire connection.
I first installed MythTV in May of 2003 after getting a sweet deal on a Hauppauge WinTV-PVR 250. This original version ran on RedHat 7.3 at the same time as my desktop operating system. The hardware was a relatively modest AMD Athlon 700 with 768MB of ram and 45GB of hard disk. For SDTV it worked perfectly fine.
Over time I managed to upgrade the machine with bigger hard drives and purchased an HDTV tuner card even though I couldn't really use it. It seemed like I was going to stay with this setup for a while even though the HDTV didn't really work. However, then a disaster happened. The five and a half year old system died. It started to crash quite frequently and then stopped powering on. Suck. Not wanting to go without I shelled out about $600 to pick up a new system that actuall fit well in my entertainment center.
I've prepared this document in an attempt to provide a comprehensive set of instructions on how to get MythTV running on an Athlon64 with Ubuntu, a WinTV PVR-250, pcHDTV HD-3000, and firewire connection to a Motorola DCT-6200 cable box. This is not going to be a 100% complete walkthrough beacuse some things, like setting up the database, didn't have to be done again. Yes, this was not going to be an easy task.
Throughout this document you'll see certain key phrases highlighted in various colors. If you get lost, use this key to figure out what they mean.
The name of a specific program. This is just to make program names stick out, you should not type these at the prompt at this time though. | |
A command you should type at the command line. Please, don't just take my word for these though, make sure you understand what the command is going to do first. | |
A
command to be executed either as root or using
| |
A set of commands that should be typed
at the command line. The stuff in bold and ending with the
| |
A specific file on the system. Just highlighted for reference. | |
Specific quoted output from a program or a file. | |
Google! | A hyperlink |
Also, for brevity, some of the sections of this document are hidden.. You can chose to hide or reveal various portions of the document by clicking on the section headers.
Eventually I'd like to set up a public subversion archive for users who wish to contribute to this document. For right now, feel free to edit the XML version and send me diffs. If you're interested, you can find the XSLT sheet here, and the CSS sheet here. What you're reading is the XML source that should have been translated by your browser automagically. If someone wants to give this some serious design loving I would appreciate it. Please email diffs to wagspat at iit dot edu.
This document has taken a long time to prepare and the creation of the nice XSLT sheet was not the most straightforward of tasks. If you find this useful, you can send some money to me on paypal. I'm not trying to make a lot of money from this, but at some point it would be nice if I could get a real hosting service for this. So help a brotha out. Give me a dollar for the tip jar.
When building a dedicated MythTV box, the choice of hardware is very important. While MythTV will run on almost any hardware, it never hurts to make sure you get the good stuff. That being said, here are the parts that reside in the actual computer.
In addition to the above parts, you're going to need a display, speakers, and other fun stuff that makes a media center nice. I truthfully haven't gone that all out on these, but they do provide a very nice environment.
Hopefully I managed to not lose you in the last description of
hardware. For a bit more, figure
Here's a brief description of how things are connected in bullted form for a better explanation.
I'm not really the type of person who always picks the best tool for the job, usually I pick what I'm familiar with, in this case, we'll be using Ubuntu Linux version 2005.10 (aka Breezy Badger). We've got a 64 bit processor, so we might as well use a 64 bit operating system, right? Most of the other software choices were mades on this. In all reality, installing the 32 bit version of MythTV is MUCH easier. Daniel Hyams has an excellent writeup on installing MythTV on Ubuntu i386. It involves a lot less compiling and lot less work.
For completeness, here's a list of the main pieces of software used in this guide. Where a version is not listed, it was probably the default from Ubuntu.
The ASRock on board NIC does not work well with the stock Ubuntu kernel. This certainly creates a chicken and egg problem as you need a network connection to download the new driver. If you'd like the network to work, you can download this module which is compiled for Ubuntu kernel 2.6.12-9.amd64-k8. Then copy the file to your root directory and run the following commands:
There is one final requirement. Apparently the device is still not properly picked up by
the hotplug infrastructure. Here's a complete and total hack you can do to get it to work. If someone
knows a better way, let me know. Open up
This forceably removes the old drivers and reloads the drivers in the correct order when starting up the network. Like I said, it's a total hack. Also, you'll need to recompile the module whenever you switch kernels. If you're running the stock 2.6.12-9-amd64-generic kernel this module might still work.
For future reference, you can download the driver from ULI's download site and recompile the driver. I haven't found a need for the other drivers yet. Also, I've been bad and haven't checked out the license on this module yet, so if you're a GPL zealot, this might break stuff. Then again, later in this walkthrough you'll be installing the proprietary nVidia drivers.
Now that you've got your shiny new AMD64 system, you probably
want a kernel to take advantage of it. Also, I'd imagine you'd
like to have support for your video card in X. Ubuntu, being
based on Debian, uses the
Uncomment those lines, and after the word
Next, we'll tell
However, if you're like me, there is a good chance that your
graphics display won't come back up. This is because we need to
compile the nVidia kernel module to go along with the new
kernel. Luckily,
Now, we just make sure that the system knows to use the driver.
First, we'll build the new database of available modules using this command:
At this point, it might also be useful to install openssh-server
on your computer. My MythTV sits in the entertainment center
and isn't the easiest thing to work on.
Before installing MythTV, you'll need to install quite a bit of
other software. Unfortunately, Ubuntu doesn't even ship with a
compiler. Luckily,
I cannot guarantee that this will be everything that you'll need, or even that you'll need all of this, but it should get you started.
Next up, we need to install the drivers for the nVidia card. Fortunately, Ubuntu released that this was going to be a common task and made it simple. Select system->help->Ubuntu 5.10 Starter Guide->Hardware. The very first question is on how to install the 3D Nvidia video card driver. Follow those steps, then you'll probably want to restart your computer. Just to be sure. You can be certain that the driver is working because when X starts up you'll see a nice nVidia logo.
Before getting too involved with the installation of MythTV, we need to upgrade and install some drivers first. Although Ubuntu ships with firewire support, it's really old and not useful for what we need. IVTV support is right out, and as we'll see, LIRC support isn't too terribly difficult.
MythTV supports the use of a DCT-6200 digital cable box as a tuner for high definition television. This is mainly because the FCC has mandated that "must carry" channels be sent unencrypted out the firewire port of new cable boxes. Translation: you can take a firewire cable from your PC to your cable box and tune in the high definition feeds for your local broadcast stations. Pretty slick. Your other option is to use the box to tune SDTV digital cable, which won't come out of the firewire port, but you can still change channels over the firewire connection.
There are three different components that we'll be working with. Unfortunately, I didn't document what you need for just channel changing and what you need to do to use it as a tuner.
The bad part is that Ubuntu doesn't really ship with up to date version of these and I could not find a source for them. So we'll need to just go download them ourselves. The next three subsections document how to go about this procedure. In all cases, we're going to be performing a normal installation and not really worrying about the Ubuntu packages. Not good form, but it seems to work well enough.
Here's the simple order of commands to download and install libraw1394. As of this writing, the most current stable release is 1.2.0.
This follows a very similar procedure as the one stated above.
Finally, we follow the same procedure for libavc1394.
The IVTV driver is used by Hauppauge WinTV PVR 150/250/350/500 analog tuner cards. This driver has been in development for some time and is reasonably feature complete. For the WinTV PVR 350 line of cards it also provides accelerated MPEG output to a television. However, being as I'm not using the PVR 350, that issue is not addressed here.
The build process is really straight forward for the driver, but there are some catches that you need to pay attention to. Notably, it installs the drivers to the wrong directory and also conflicts with one of the modules that the pcHDTV card needs, but we'll tell you how to get around this.
We're not quite there yet. Now we need to hide some of the old
modules and move the new modules somewhere that
Your driver is now installed, but you'll still need to get the firmware for the driver. There are lots of versions, and while the version on your install CD will probably work, it's not the ideal version. For that, you'll need to trust me that the version you can pull from the internet is better. Here are the last commands you'll need to run:
If everything is going okay, you should be able run the
command
There are two different ways that you can get support for your remote control, both require some work because unfortunately Ubuntu doesn't ship with great LIRC support and the lirc-modules-source still doesn't work for building kernel modules for Linux 2.6. Both of these methods will require the installation of the LIRC package.
Most of this part is specific to my style remote, as pictured
in figure
If you're worried about compiling kernel drivers, you can
use the
The first step is to download the linux input stack, compile it, and install it.
Here we're going to do something very bad thta we probably
shouldn't do, but unfortunately it's the only way that I
could figure out how to get everything to work. Install
LIRC and tell it that you're going to be using i2c devices
and that it will be a hauppauge card. Next, tell LIRC not
to load the
Now comes the part that makes you a bad person. The
That's really all that you need to do. Now, LIRC should be
up and running, your kernel modules should be compiled, and
you should be off on your way to using your remote control.
If you'd like to make sure that your receiver is receiving
messages from your remote run the command
We're going to build MythTV directly with LIRC support, this means that it will read the configuration for LIRC
out of
Ready to compile more drivers? Too bad. The drivers for the
pcHDTV are already built into Breezy. However, there is one
caveat, you need to make sure that
You'll need to do one more small step to get the card working, download
the firmware. This is a simple matter of downloading the firmware and
then placing it in
From this point, you'll need to decide whether or not you're going to use over-the-air HDTV broadcast (called ATSC) or the signal from your cable provider (called QAM). Over-the-air works quite well for most people, especially if you live someplace flat. The drivers are well tested and generally stable. QAM is an option for people who live places not-so-flat (like Pittsburgh) and need to get their HDTV signal from their cable provider.
If you're going ATSC route, then you're probably going to need an antenna to receive the signal. The problem is that there are lots of different antennas available for HDTV signal reception and it's difficult to know which one to use. Thankfully, the fine folks at the Consumer Electronics Association have put together AntennaWeb to help you choose your antenna. Simply select where you live and it will tell you what type of antenna you need and how to orient it.
As I haven't been able to get a good HDTV signal over the air, I can't provide much more help on this issue. For further reference I recommend this writeup from PenLug.
QAM is a strange beast that really pushes most peoples HDTV tuner cards. The first thing to know is that just because your cable box is perfectly willing to show you TNT-HD and Discovery-HD, that doesn't mean your cable company is willing to let you get them on your tuner card. Thanks to the wonders of 5C encryption, you probably won't be able to get anything more from a direct cable connection to your HDTV tuner than you would from the firewire output of a motorola DCT-6200 cable box. Thankfully, I've heard many reports from people who don't have Comcast that they've had great luck getting these other channels on their pcHDTV cards.
The first thing that you're going to need is the pcHDTV tools. You can either download these directly from the Linux TV site through CVS, or grab the copies from pcHDTV. I'm going to use the pcHDTV stuff as it's probably a bit more straightforward.
Adding in channels for HDTV is not the most straightforward of processes. However, I've gotten quite a few questions about how to do this, until I get a chance to write up this section, I'll refer you to this thread on the MythTV mailing list.
Congratulations on making it this far. Believe it or now, you've already made it past some of the harder parts of MythTV setup, but don't worry, there are a few spots where adventure lies ahead. That being said, let's learn how to compile MythTV.
There are a few different version of MythTV out there, there is
the main release, which is, as of this writing, 0.18.1 and there
the development release, sometimes called
Before we can go about compiling MythTV a few changes are in order for Ubuntu and Breezy.
Now, we're ready to configure MythTV. Here are all the arguments that I passed to MythTV:
--enable-xvmc | Provide support for XvMC MPEG accelleration. In theory this drops the CPU load of your system while playing back MPEGs. I've had mixed luck with XvMC, but some folks swear by it. In reality for this level of computer you really don't need XvMC. |
--enable-opengl-vsync | Supposed to help out with video synchronization issues. I'm not 100% sold on this option and there is no way to toggle it at runtime. Some folks on the users list suspect this may cause video stuttering issues with different versions of the nVidia driver. |
--enable-dvb --dvb-path=/usr/src/linux-headers-2.6.12-9-amd64-k8/include | Enable DVB support in MythTV. Needed for proper support of the pcHDTV HD-3000 card. |
--enable-lirc | Remote control support for MythTV -- you'll want this. |
--enable-firewire | Support for capturing video from the Motorola DCT-6200 tunerbox over firewire. |
Congratulations, you should now have MythTV installed into your
tree at
MythMusic required a small bit of modifications to compile
properly. On line 57 of
The current SVN version of MythTV has a built in DVD player, but
the stable release does not yet -- in order to play DVDs you'll
need to install an external DVD playing application. The most
popular are
For video player the two dominant choices on Linux are Xine
and MPlayer. Personally, I've had more luck with using Xine
for DVDs. Installation is straightforward just run:
Installation of MPlayer is fairly straight-forward. Simply
run:
MythWeather built without any modifications to the source
code. You can configure it from the setup menu of
MythVideo also built without any modifications. You'll probably want to install Xine or MPlayer for watching the videos as discussed earlier in this section.
MythGallery required two changes to the source code in order
to function. First, modify line 77 of
You should be ready to go for MythGallery now.
MAME is the venerable arcade machine emulator from Nicola Salmoria. Currently it emaultes about 2000 different games and countless variations and bootlegs of those. Unfortunately, in most cases, unless you own the original arcade machine, the ROMs for these games are protected under copyright. If you'd like to get some legal roms, StarRoms may be a good choice for you. Your other choice is to buy the game boards off eBay and then dump the roms yourself. A nice project if you're an electrical engineer (like I was in a past life).
The problem with MAME compilations is that it has more options than you'll ever be able to use. I've had the best luck using the SDL version of MAME. To start out with, you'll need to ensure that the SDL development libraries are installed.
Now, running the following commands should get you going with compilation. This will download and unpack the source and then download my configuration to compile the program.
Unfortuantely, there still is a little more work that is needed to get MythTV to function properly with this version of MAME. MythTV expects the version of MAME to be only two characters long, while this version has three characters. Unfortunately, I still need to write-up how to do that.
ZSnes has large portions of the code written in x86 assembly. Unfortunately, as we're running in x86_64 mode, this isn't very useful. Attempting to compile ZSnes with a target of i686 gives an error that the selected cpu does not support the x86_64 instruction set. Compiling it for the Athlon64 reports errors that the assembly modules cannot be linked in. I've heard that using Yasm may make compilation possible, but I haven't gotten this to work yet. ZSnes does work just fine on x86.
To get around this, you've got two options, both of which are suboptimal. First, you can try to run a work-in-progress version of ZSnes, available from http://www.ipherswipsite.com/. Download the source code here and then try to get it going. I didn't have any luck as there still were issues with the 64bit assembly language conversions. Trying it with Yasm produced something that compiles, but crashed with an illegal instruction. Yikes.
Your other option is to run the 386 version directly on your
system. You can download an up to date release from here.
Then it is possible to install it by passing
To the best of my knowledge Snes9x does not work in 64bit mode. It crashes out when it tries to load a rom. If you've gotten it to work let me know. You can run the 32 bit version by installing a 32 bit deb, like previously described for ZSnes, but once again, you'll lose joystick support.
It would be a little silly if after being based on a Linux
box, MythTV couldn't play the games that were available for
Linux. By default this is controlled through
MythGame also provides a way to display images in the menus.
For each PC game place a file with the exact name of the
game in
I'm a sucker for FPS games once in a while, and now that I have a computer powerful enough to run Quake 4, I figured I'd pick it up for cheap the day after thanksgiving. Here's what you need to do to get it going.
First, go and download the linux client from the ID Software
BitTorrent Tracker. This will take a little while to
download, but not too terribly wrong. Then run the
following commands to install the game:
Now, we need to play a little fun and get the emulation
layer for x86 setup - id software does not provide an
x86_64 executable yet. This is actually really easy. Go
and download libsdl1.2debian-alsa and libasound2 and extract them
to a new directory
Finally, modify your
This is an addictive game that basically anyone can play.
It requires only a modest system, and is completely free.
Best of all, there are precompiled packages for it. You
can install it by running this command:
First, make sure you have your emulation layer setup as I described in the section for Quake 4. Then, download the linux installer from the iD Software BitTorrent tracker. Finally, copy over your .pk4 files as needed and the game should run just fine. For more information, consult the Linux Doom 3 page at iD Software.
Wolfenstein Enemy Territory is a free (as in beer) online
game built on the Return to Castle Wolfenstein game
engine. You can download it for free from the iD Software
BitTorrent tracker. Installation went smoothly for
this game, but I couldn't get sound to work natively, for
that you'll need to run the following command as root
every time the system reboots:
I don't currently use MythPhone, so I can't really comment on how easy it is to use. In the future, I'd like to hook MythPhone up to an Asterisk setup so you can receive phone calls at the television.
I don't use MythBrowser.
I don't use MythNews.
You'll probably want to make MythBackend start automatically at system boot. Here's a set of commands you can use to make this happen automatically.
It is now possible to have MythTV automatically connect and
download television listings without the need for using
The above command will automatically fetch the schedule at 1:55pm localtime. Most users setup their system to download the schedules sometime in the night, but the folks at Zap2It have requested that all times be set between 9am and midnight Central time. Obviously, you'll probably want to move the time some. It would be horrible if everyone started downloading their schedules at 1:55pm.
I've got a slight modification to my file. I would like my HDTV tuner to only record high definition programs, to achieve this I actually use the following line (put all on one line by removing backslashes):
You'll most likely have to do some hacking in the MySQL database to get the exact command line here, so make sure you know what you're doing. Basically, MythTV assigns each video source a number and then appends the channel number. On my system, the HDTV is source 3 (it's configured to be only HDTV), so I wipe everything from channles 3000 - 4000 that is not HDTV. In the future there is a good chance that it will be possible to mark a tuner as HDTV only, but as of 0.18.1 that is not possible.
Ubuntu utilizes a program called GDM to provide the nice graphical boot menu you see when first starting up. GDM is a very flexible infrastructure that has the ability to automatically log in a user on system start and if the login menu has been idle for too long. We'll use both of those functions to ensure that MythTV starts when the machine starts and also to restart MythTV if it crashes and dies. At the same time we'll keep a moderate delay before GDM starts MythTV up again to allow you to log in as a different user if you choose.
The main configuration file for GDM is
XvMC is short for XVideo Motion Compensation - using this technology it is possible to offload a large amount of the work in processing movies to the graphics card, unfortunately it still is rather hit and miss. I've found that when watching HD content it does lower my CPU load to about 15%, however the playback stutters for a few seconds when the OSD is up and occassionally I see a frame that is out of sync. Research into this problem has shown that it is related to the driver quality for x86_64.
So here's the problem, apparently under x86_64, XvMC has trouble obtaining the proper handles to the video card. You'll experience anywhere between one and 30 failures before successfully grabbing your first context. After this first context is obtained, everything will work just fine after that. Being lazy, we can automate the process with a custom version of MPlayer and a very short movie that won't actually show anything.
The script
The script in the previous section should have taken care of setting up your remote control to work with Xine. Pressing the menu button will take you to the root DVD menu, the arrows move around, volume works the same as MythTV. If you'd like to zoom in or zoom out use the 1 and 3 buttons. This is helpful if you'd like a movie to take up more of the screen. Pressing 2 will zoom back to the normal level. Pressing the blank button toggles the deinterlacing in the player.
One nice thing that we'd like to do is setup the remote so pressing the power button turns the monitor on and off. Thankfully, with DPMS, it is possible to send a command to the monitor to power the monitor off, or just place it in standby. Using this setup will make you think that you have a real monitor. Just follow these commands as your MythTV user.
MythWeb was not addressed in the section on plugins because
it's not a plugin per-say. It's acutally a separate program
that you can in conjunction with a
All that being said, have fun losing all your stuff to some random web crawling script if you're not protecting your MythWeb install enough.
If you're in the United States, you're using the Zap2It
DataDirect connection to download your listings. While this
system is nice because your channel listing doesn't break
every time the web pages change, it lacks the ability to
download the icons for channels in the database. Luckily,
MythTV has a way to get around this. First of all,
disregard what the documentation says about using
In your MythTV source directory you'll find a file called
This command compares the listing of available channels in your database with those in the iconmap and downloads the channel icons as appropriate. After this, when browsing channels in LiveTV, you should see the icons indicating what channel you're currently watching.
Hopefully this guide helped clear up a few of the nasty hurdles related to getting MythTV working on Athlon64s and Ubuntu. Here's a a gratioutous photo just to prove that yes, it can actually be done. The video playing is ABC's HDTV broadcast of Monsters, Inc. from October, 2005.