Free TiVo: Build a Better DVR out of an Old PC
by Ken Sharp
www.provedorcrescenet.com
April 25, 2005
Digital Video Recorders (DVRs) have become a necessary luxury over the last several years. Millions of people rely on these devices to pause and rewind live television, and to keep track of broadcast schedules and record programs for them. Many consider them just as essential to their daily lives as their cell phones.
Several months ago, I finally became sufficiently jealous of the millions of DVR owners to motivate me to put a DVR in my own living room. But I wanted something more versatile than a normal TiVo, ReplayTV, or Ultimate TV system. I envisioned an all-purpose media server that would function as a full DVR, but would also work as a music server and play console games. It would have an easy remote-control interface, just like a commercial DVR, and a way to program it through the internet. Finally, I wanted to avoid the monthly fees that many DVR owners pay to keep their machines' schedules up-to-date.
I earn a living as a computer engineer, so I understand how long it can take to write custom software. So, in order to build my dream machine as quickly and easily as possible, I wanted to use only off-the-shelf software and components. I knew this was all possible, and after a month of research and a few late nights of construction, I had my custom DVR box. It works just as I'd hoped and does even more. For instance, it streams music over the internet, so I can listen to my music collection from work (or anywhere else).
Beauty shot of DVR PC
The final installation of my DVR PC: Note the PC on the left, which is concealable behind a cabinet door, the Playstation controllers on the top shelf, and the keyboard, which is barely visible under the cabinet.
Here's how I did it.
SET UP:
You'll need:
* Windows machine with at least 256MB of RAM (512MB is better), plenty of hard drive space, and a good video card.
* TV and receiver presumably from your existing home theater system).
* TV card I used a Hauppauge WinTV-PVR-250 card, $149 at hauppauge.com.
* PC DVR software I used BeyondTV, which was bundled with the Hauppauge card, but is available from SnapStream separately for $70 at snapstream.com.
* WinDVD I already had an old copy of this from my video card, but it's $50 from intervideo.com.
* Winamp The standard Windows MP3 player, free at winamp.com.
* VNC Remote PC access software, free at realvnc.com
* SlimServer Lets your server stream music remotely through the internet, free at slimdevices.com.
* Various game emulators Run console game ROMs, many free ones listed at zophar.net.
* Playstation or Nintendo game controllers These work much better than PC gamepads for the price, and are available lots of places for $15 and up.
* PSX/N64 to USB converter Lets you use console gamepads on the PC, $13 each at lik-sang.com.
* Girder Automation software, $20 at promixis.com
* Cygwin and server software Linux-like operating system, free at cygwin.com.
* Dynamic DNS service Lets you connect to your home server using a fixed domain name if your broadband account allocates your IP address dynamically. I got this from dyndns.org.
MAKE IT:
The basic sequence of steps is:
1. Build the PC
2. Install the TV and receiver
3. Install the Hauppauge WinTV-PVR-250 card and BeyondTV
4. Install video, music, and game utilities
5. Install PSX/N64 to USB converters
6. Install and configure Girder
7. Install Cygwin and server software
8. Set up firewall and dynamic DNS service
1. Build the PC
I started with an old PC (a Dell Dimension 4500) that had unfortunately been destroyed by lightning. After some experimentation, I figured out that the only bad portions of the PC were the motherboard and the modem (which I didn't need anyway). I decided to replace the motherboard and keep the same case and other hardware because I really liked Dell's clamshell case design. I did some research at my local Fry's electronics store and got a motherboard that would allow me to use the same memory, processor, and case. After getting the PC back up and running with this hardware, I had a pretty decent machine with a 1.8 GHz P4 processor, 256MB DDR2100 RAM, and a 20GB HD. Not bad for a resurrected PC.
I then formatted the hard drive and put Windows 2000 on as the OS. I did this mostly because I had an extra license for Win2K lying around that I wasn't using. I may eventually upgrade to XP, but right now, everything is working well with 2000.
After I had the machine up and running, I decided to add some extra hardware. I added 512MB of RAM, since this would be a server machine and could probably use a little extra RAM. I also added a lot of hard drive space and ended up buying two 120GB hard drives. I figured that I would need quite a bit of space for use with the DVR software, and I would also need quite a bit of space to act as a general file server (for MP3s, movie files, etc.). So I assigned one of the 120GB drives for DVR duty and the other for general file storage. This ended up giving me plenty of room for file storage and about 50 hours of good quality video with the DVR software.
Any modern Windows PC can be used for DVR duty. When choosing an appropriate PC, keep several key features in mind: 1) make sure to have enough memory. If you want to run several applications (for instance, watching a DVD while recording a TV show), then you will want more RAM. You can probably get by with 256MB of RAM, but 512MB of RAM is better. 2) You'll want plenty of hard drive space for your DVR to record TV shows. The more hard drive space, the better. 3) Make sure your power supply is rated high enough to allow you to power the devices in your system. If you add multiple hard drives, a DVD drive, and a hefty 3D graphics video card, then you'll probably want to have a 350 - 400W power supply in your PC.
2. Install the TV and Receiver
Next I needed to hook up the PC to a TV and a receiver. Luckily, I already had a 32-inch TV and a receiver. I also had a working Gainward GeForce3 video card, inherited from the old lightning-struck PC. The card had an S-Video out, and it came with an S-Video to RCA conversion cable, which I used to connect it to the RCA input of the TV. This way, to switch to the the PC, I just hit the TV/Video button on the remote, like I'd do with a Playstation or DVD player. Then I connected the line-out from the PC's sound card to one of the receiver's inputs. I checked out both the video and sound quality by playing a DVD on the PC, and it looked pretty good.
3. Install Hauppauge WinTV-PVR-250 Card and BeyondTV
Next, I wanted to get the DVR functionality up and running. I wanted to create a TiVo-like experience, so I researched what PC DVR software was available. After a bit of searching, I narrowed the prospects down to BeyondTV and SageTV. After toying with the trial versions of each of these, I decided I liked BeyondTV better. There weren't any good technical reasons for this, as they both seem like excellent products, but I just liked the look and feel of BeyondTV a little better. One of the advantages of BeyondTV is that it has a free program guide service to keep your TV listings up to date. It also has a free service through snapstream.net which allows you to remotely set a show to record via the internet. This is really nice if you've gone on vacation or on a business trip and you suddenly see something that you want to record.
Snapstream, the makers of BeyondTV, offer some very well-priced bundles that include a TV card and a copy of BeyondTV. I did a little more research and found that I couldn't get both the TV card and BeyondTV software any cheaper elsewhere. I ended up getting BeyondTV bundled with a Hauppauge WinTV-PVR-250 TV card. This card is pretty cool because it includes an IR remote, which is natively compatible with Beyond TV. It also has a hardware MPEG encoder, which offloads demand on the CPU when recording MPEG files. I thought this was important since I knew that the PC would have other things running (HTTP server, WinDVD, etc.) while it was recording shows.
Installation of the TV card and BeyondTV was pretty simple. I won't put a detailed blow-by-blow of it here, because I just followed the included instructions and that worked fine.
One thing to note with the most recent version of BeyondTV is that it can now record TV from multiple tuner cards. This means you can simultaneously record multiple shows on different TV channels.
Menu with items: Recorded Shows / Live TV / Program Guide / Set Up Recordings / Settings / Exit
Main menu of BeyondTV
4. Install Video, Music, and Game Utilities
At this point, I needed to install the rest of the software I would need:
* WinDVD (www.intervideo.com): I had a copy of WinDVD 3 that came with the aforementioned Gainward GeForce3 card. This is a pretty old version of WinDVD, but it plays DVDs, VCDs, and SVCDs perfectly, so I didn't see the need to shell out any more cash for a new version.
* Winamp (www.winamp.com): This de facto standard MP3 player is simple and works great. Why change what works? I did increase the font size and the front panel dimensions to look better on the TV screen, though.
* VNC (www.realvnc.com): I don't know if you've ever seen a PC's output on a TV, but it pretty much sucks. TVs just can't handle a resolution that high. BeyondTV and WinDVD are made to look good on lower resolutions, but regular Windows programs are a bit hard to read. VNC is a free program that can be used very similarly to the Remote Desktop feature in Windows XP (basically, it allows a graphical remote desktop view). I use VNC on the PC so that I can login and manipulate the desktop from my laptop at full PC resolution, rather than having to do it from the TV screen.
* SlimServer (www.slimdevices.com): This is a free, open source program that allows you to remotely stream your MP3 collection through the internet. The beauty of it is that you only need an internet connection, a web browser, and a media player on the client side (Winamp and Windows Media Player both work fine) in order to listen to your entire MP3 collection from anywhere in the world. I use this to listen to my music collection at work, so I don't have to lug around a stack of burned CDs. This is one of the coolest free programs I've seen.
SlimServer/Squeezebox application main window
Web interface of SlimServer. You choose songs from the left frame, and the player interface is shown on the right.
* Various game emulators: At this point, I also installed a slew of emulators. Emulators allow you to play games from various consoles and arcade machines. All you need is the appropriate emulator for a given system and ROM files, which are binary dumps of game cartridges. Some of my favorite emulators are ZSNES (Super Nintendo), Visualboy Advance (Nintendo Gameboy Advance), 1964 (Nintendo 64), and MAME (Multiple Arcade Games). There are many other emulators available; the best place to find them is www.zophar.net. If you don't already know where to get game ROMs, you should do some searching on the internet for sources of ROMs. Note that it is illegal to have a ROM for a game unless you own the original game cartridge.
5. Install PSX/N64 to USB Converters
In order to play emulators well, you usually need a good gamepad. For some reason, most of the gamepads for PC aren't very good, and if a PC gamepad is good, then it's usually really expensive. So a while back, I found a cool product that converts a PlayStation or Nintendo 64 controller to a USB interface. This allows a PC to see it as a regular PC gamepad. I bought two of these from www.lik-sang.com, and they work really well. I took two slightly used PlayStation controllers, plugged them in, and now I can use the controllers in any emulator which supports Windows gamepads (which is nearly all of them). This really enhances the gameplay experience, and the USB converters aren't that expensive.
These converters are also easy to install. Just plug them in, and Windows will automatically recognize them as Human Interface Devices.
Game controller to USB converter dongle
The Playstation/N64 controller to USB converter (shown with a Playstation controller plugged in).
6. Install and Configure Girder
Girder is a very handy program that allows you to automate Windows. Basically, it acts as the "glue" between different programs. In my case, it acts as the glue between pressing buttons on my Hauppauge IR remote and taking actions in WinDVD and in all of the other programs on my system. This completes the home-theater-style experience. For example, Girder lets me set up commands so that pressing a button on the remote simulates pressing the "Play" button in WinDVD.
Girder also has a flexible plug-in architecture that lets third-party developers create plugins to enhance Girder's capabilities. Girder doesn't natively support my Hauppauge IR remote, so I installed a plug-in that allows Girder to receive button events from the remote.
One important thing I discovered is that it is a good idea to disable the standard IR remote application that installs by default with the Hauppauge TV card drivers, because this application makes the Girder plug-in respond less quickly. You can disable this application by going to the Startup folder in the Windows Start menu and deleting the "Autostart IR" shortcut.
I installed another plug-in for Girder called OSD Menu, which allows me to easily create my own On Screen Menus. Using this, I created a custom menu that allows me to open and close all of my players and game emulators. This menu corresponds to a Girder configuration file (GML) I created, which talks to all of the programs: WinDVD, BeyondTV, Winamp, 1964 (Nintendo 64 emulator), Snes9x (Super Nintendo/SNES emulator), FCE Ultra (NES emulator), Visualboy Advance (Gameboy and Gameboy Advance emaultor), Kega Fusion (Sega Genesis, Master System, and Game Gear emulator) and MAME (multiple arcade machine emulator). This way, I can launch, play, and close everything from my Hauppauge remote. Note that the best SNES emulator is ZSNES, but it uses a very nonstandard Windows interface which Girder has trouble connecting to. As a result, I use the Snes9x emulator instead, which is almost as good.
I'm going to leave out the part where I explain how I set up all of the functions for these different programs, because it's essentially the same process anyone would have to go through to automate a program with Girder (and because it would take me forever to type it all out). Check out the GML file to see how I did it, if you're interested. I created separate GML files for all of the different programs and then imported them into a top-level GML file, which implements a nice OSD menu and enables or disables the different programs' commands based on which program you're currently running. I've included the individual GML files (named appropriately for each program) and the top-level GML file (named toplevel.gml; clever name, eh?). And if you still want more info, check out Girder's homepage at www.promixis.com; they have an excellent user forum where you can get pretty much any question answered by true Girder gurus.
Menu with items: Open/Close WinDVD / Open/Close BeyondTV / Open/Close Winamp etc., with Exit at bottom
The OSD menu I designed through Girder to allow me to open and close my DVR PC's applications.
7. Install Cygwin and Server Software
To finish up my TV PC, I wanted to add in the functionality of an HTTP server, FTP server, and an SSH server. I chose to do this in Cygwin, which is an environment for Windows that simulates the *NIX operating system interface. Many of the free software packages that are available for Linux are also available in Cygwin versions. I chose to use Cygwin for much of my server software because I like the Linux command-line interface, it's free, and I wasn't able to locate a SSH server available for Windows. Another side effect of using Cygwin is that I can install many of my favorite development tools, such as GCC, Perl, Flex, bison, and Python, and have those tools available if I need them for another project.
I chose to use the Apache webserver (httpd), ProFTP (proftpd), and OpenSSH (sshd) for my server installations. All of this software is available for download via Cygwin's standard installer (I didn't have to build any of them from source code). To set up these three programs, I used the instructions which install to the /usr/share/doc/Cygwin directory. The documents in this directory show you how to install these three programs as Windows services (they need to be services to run properly in Windows).
The only addition I had to make to these instructions was with HTTPd. To get this service to start without error, I had to go into the Windows service manager and set the service to logon as Administrator (instead of the default Local System). This can be done by right-clicking on My Computer and choosing Manage. From here, go to Services and Applications -> Services, and right-click and choose Properties on the "CYGWIN httpd (apache)" service. In the dialog that comes up, change the Log On from Local System account to the computer's Administrator account. Now the HTTPd service should start up correctly.
I also changed some of the default configuration for ProFTPd. The first thing I did was to remove Anonymous user access. Usually the authorized users for an FTP server are the same as the authorized users for the computer. But I didn't want everyone to have access to the entire system, so I used a configuration directive called AuthUserFile to set a passwd file for the FTP server only. I used a Perl script called ftpasswd to create this alternate passwd file and add users to it (the script is available at www.castaglia.org). I also set up a feature called a root jail that allows you to restrict user access to a subset of the PC's hard drive(s). Next up, I set permissions on my directories such that FTP users could only write to their home directories and to an incoming folder. Note that the entire ProFTP configuration is controlled by editing the /etc/proftpd.conf file. For more info on modifying the proftpd.conf file, refer to the documentation at www.proftpd.org.
8. Set up Firewall and Dynamic DNS Service
For remote access, I needed to configure the firewall on my D-Link router to allow connections to the FTP, HTTP, SlimServer, and SSH servers. After these ports were open, I added port forwarding, so that requests coming over these ports would be forwarded my TV PC.
Finally, I wanted to make it easier to access my servers from the outside world. As with many broadband users, I am at the mercy of my ISP's DHCP server. What this means is that the IP address of my network is dynamically assigned by my ISP and can change at any moment (in reality, it usually only changes every couple of months). I also have no DNS access, so I have to remember an easily-forgotten 12-digit number to get to my computer.
I found a free solution to this problem by using a Dynamic DNS service. Basically, a service like this allows you to configure a Domain Name for your IP address, so instead of typing "192.168.42.13" you can type something like "ken.isageek.org". These types of accounts also allow you to automatically update your IP address by using a small utility which checks your IP at set time intervals and updates your account automatically if anything changes. I chose to use www.dyndns.org for my service provider and a small utility called DirectUpdate, which runs on my TV PC to automatically update my IP address if it changes.
USE IT:
This project came together very well, and I now have a DVR PC that far exceeded my original expectations. The real beauty of this project is its versatility. If you have some additional programs or features you'd like to add, it's very simple to install the software and integrate it into the system using Girder.
For more information... please visit http://www.makezine.com/extras/4.html.