Geek House: Home Television ServerBy Marcia Press | Print
Re-Imagining Linux Platforms to Meet the Needs of Cloud Service Providers
Build It: This chapter from the ExtremeTech book, Geek House shows you h
This is chapter three from the ExtremeTech book, Geek House, published by Wiley Publishing. The book shows how to make the most of technology in the home, with 10 PC-based hardware hacking projects. Hack, customize, and modify everything-from your sprinkler systems to the temperature of your barbecue.
In stark contrast to the pre-rural electrification farmhouse of yore, the geek's house is a thicket of networks. Considering anything that passes a signal (and hence information) from one point to another as a network, here are the ones we identified in our own home:
- Wired and wireless telephone
—Plain old telephone service (POTS) voice over paired telephone wires or radio signals. Wireless telephone includes both radio connections from wired telephone jacks to handsets and ones from remote sites to cellular handsets.
- Wireless PDA
—Radio connections from remote sites to handsets, supporting e-mail and POTS voice.
- Broadcast television
—Radio connections from remote sites to local antennas and coaxial cable distribution, supporting 6 MHz standard definition (SDTV) analog signals.
- Cable television
—Coaxial cable from the cable company's external demarcation point to a modem supporting broadband Internet. Other people also use the cable television feed distributed throughout the house for both SDTV and HDTV reception.
- Satellite television
—Coaxial cable from an external parabolic dish and low noise amplifier through amplifiers and switches supporting reception of digital MPEG-2 encoded television signals.
- Wired and Wireless LAN
—Ethernet over Cat 5 or Cat 6 cable, or IEEE 802.11 radio, interconnecting the broadband modem, switches, routers, servers, and client computers supporting IP networking and Internet access.
—There's a wide variety of other information connections you might have, including weather and rain sensors, X-10 power line communications, wireless garage door openers, the doorbell/intercom combination, atomic clocks, and wireless cooking thermometers.More than anything, this list shows that up to now the cost of electronics has been high enough to force connections to be tailored to the specific information being sent—no one network technology carried all the different signals used in a home.
IP networks are changing that distribution. The telephone companies learned years ago that it was less expensive and more reliable to run their voice networks using Internet IP packet switching than the older voice circuit switching, and are finally learning that they can benefit by extending telephone service to consumers over IP networks using voice over IP (VoIP) technology. In this chapter, you'll see that although the standards for television over IP aren't as well defined as they now are for voice, you can gain significant benefits by moving your television reception off coaxial cable networks and onto your LAN.
Perhaps the strongest impetus towards digital television was satellite broadcast, because the economic viability of the satellite system is dominated by the number of distinct television channels it can support. Ignoring overlap at the channel edges, the 6 MHz channel required for U.S. analog television permits at most 12 channels in a standard 72 MHz transponder. Wider channel spacing to eliminate interference due to overlap reduces that number noticeably.
A 6 MHz spectrum segment can support 20 to 40 Mbps, however, depending on the waveform, so digital television offers the opportunity for more channels in the transponder so long as one channel fits into no more than 1.6 to 3.3 Mbps. The compression technologies devised by the Motion Picture Experts group (MPEG) solve that problem, reducing the approximately 160 Mbps raw video signal significantly:
- MPEG-1—1.5 Mbps at VHS video tape quality
- MPEG-2—3-10 Mbps at DVD quality
- MPEG-4—4.8 Kbps to 4 Mbps at varying resolution and quality
Some digital TV receivers—including a digital display—look a little different from the analog receiver in Figure 3-1. The tuner still selects a modulated waveform from the available spectrum, but the demodulator outputs error-corrected bit streams rather than analog waveforms. Those bit streams are decoded from the MPEG format to raw video and audio data.
Figure 3-2 In the digital receiver of Figure 3-2, there are many ways to transport the signal besides the lossy, inconvenient coaxial cable so common in conventional TV systems.
Figure 3-4 The most interesting aspects of Figure 3-4, though, are the disk storage and networked video functions, because there aren't common consumer electronics devices—other than PCs—for them. If we redraw Figure 3-4 to use a PC, and assign all the functions reasonably done by a PC that way, we get Figure 3-5. Yes, there's another simplification, in that you can use either amplified speakers or an external stereo or home theater amplifier, but again, that's not important. What's important in Figure 3-5 is that, with the exception of a tuner and demodulator, a PC can do everything the system requires. Build the tuner and demodulator into the PC in the form of an add-in card, and the PC does everything.
Figure 3-5 Not that this plan is without flaws. The most significant one is that you can't get add-in cards that let your PC decode digital satellite or cable TV signals, because those systems use proprietary formats with closed encryption standards. Instead, you have to use one of their set top boxes, but because few set top boxes accept channel change commands from your PC in a convenient way, you'll have a harder problem to solve. We've put some hints in the "Extending the TV Server" section at the end of this chapter to help you get started. If you're using broadcast TV or analog cable, though, you're set.
However, Comcast seems to be incapable of believing we don't want cable TV too, along with Internet access. In that vein, the installation was fascinating in what it unintentionally revealed, because the installers had a list of who had what on our fiber node. Not only were we the first to sign up for cable Internet service—not surprising since it had just become available—there were also literally no digital cable TV subscribers on the node. Not merely just a few, but zero, despite it having been in the area for years.
We did an informal poll of our neighbors to find out why they don't use digital cable, and discovered reasons like these:
- Too expensive altogether, along with constant rate hikes
- Too expensive to have a set top box for each TV
- Ridiculous to sign up for digital cable when the analog cable service has been so bad
Regardless of the reason, cable operators and consumers seem to be at loggerheads. We think cable operators could go a long way towards solving this problem by creating an open standard for digital TV, much as their Cable Labs R&D center did for cable modems, which would create consumer-level competition in the cable TV set top box market. If that happened, you'd be able to buy PC add-ins that natively understood how to talk on a digital cable TV system and could deliver all the advanced features those systems were capable of. As it is they haven't done that, so you're forced to kludge a PC together with a set top box. There's no gain for the cable operators keeping set top box capability out of the PC, because you canmake a PC look like a remote control. There's a big loss for you, because it's a pain to kludge a connection between PC and set top box, and the resulting combination doesn't necessarily let you use all the features the set top box offers.
Stupid. And not in the funny way like in Invader Zim, either ("It's not stupid, it's advanced!").
You can either put all the functions in a single PC or network multiple PCs together across a LAN and distribute the functions. The simplest realization of that idea is to split out the disk storage to a file server with huge drives, letting you share storage and recordings across several PCs and, therefore, several TVs. That approach requires running the coaxial cable to every PC serving as a television, though, which means you're installing single-purpose cabling and have to deal with the noise and losses radio frequency (RF) transmission over coax creates.
There's a better way. You can partition the system as in Figure 3-6, separating the reception and recording functions from the playback and decode ones. Your LAN now becomes the video distribution network, sending error-free streams from one PC to the next; the only PC needing the RF signal is the one with the tuner.
Figure 3-6 You can connect as many clients to the server as your LAN can support. You're only looking at 3–10 Mbps for MPEG-2, so in principle you should be able to handle 5 to 25 clients on a 100 Mpbs LAN (assuming no other network traffic and depending on video compression rates) without any collisions or pauses in the video. You can distribute video on a wireless LAN too so long as you scale the number of active clients to the capacity of the system.
The most serious limitation you'll have to resolve with this system design is that you need a tuner for every independent viewer you want to be able to support. If there are three active televisions that all need to broadcast a different channel, you'll need three tuners. You'll see ways to meet that requirement in the next section.
- Receive broadcast video
- Provide full personal video recorder (PVR) functionality, including pause, rewind, and fast forward/reverse, and including selection of shows to record
- Compress recorded video, and provide sufficient storage for many hours of recorded video
- Record video on a server for playback on multiple networked clients
- Play recorded video, MP3 audio, and DVDs
- Provide a client user interface suitable for use on the TV screen, from across the room, via remote control
- Create DVDs from recordings or other sources, including video editing and authoring
If you match these requirements against the key components, you get the requirements for those components:
- Tuner—The tuner (which incorporates the demodulator function) inputs RF or composite video signals and outputs a compressed digital video stream. The tuner selects the channel you're watching, extracts the analog video signal, and then digitizes it (or a direct composite video signal input) into a bit stream. A compressor (see Video CODEC below) reduces the size and data rate of that bit stream, which then appears at the tuner output.
- Disk storage—A standard quality DVD runs at a little over 5 Mbps, or 0.625 MBps. Multiply by 3600 and you get about 2.25 GB per hour, a number you can use to start to size the disk storage you want in your server. You'll want the large disks directly in the server so you can avoid the network traffic you'd see between a file server and the TV server if you put the disks on a remote machine. It's better to save the network bandwidth for video distribution to clients.
- Video CODEC—Including both compression and decompression, and indicated as the MPEG decoder in the figure, the video CODEC (coder/decoder) is responsible (in the server) for compressing video headed to disk storage, and (in the client) for decompressing video headed for the display. Compression is typically part of the tuner, because it's usually done in hardware to meet the need to do compression in real time, but faster processors have improved the quality of compression possible in software. The day is not that far off when a PC can do real-time, high-quality MPEG-2 compression entirely in software, although it's less clear why you'd want to use essentially the entire processing capacity of a PC to replace the function of a chip costing about one percent of the price of that PC.
- Server processing—The TV server software imposes only a small load on the host processor. Software able to do MPEG-2 compression on the processor would let you use a wider range of TV tuner cards, but will consume even the fastest processor to handle just one stream.
A more useful way to consume processor cycles is in authoring and burning DVDs. You'll compress raw, uncompressed AVI files, and may need to transcode (decompress and recompress) MPEG-2 files to reduce the data rate. That processing runs on the PC, and although the software we worked with wasn't able to exploit the hyperthreading architecture of the Intel processor we used, the raw speed helps keep authoring time to a minimum.
- Client processing—Each television needs client processing in an attached PC to provide the on-screen user interface and to play video stored on the server computer. Playback includes both network access and MPEG-2 decompression (see Video CODEC); MPEG-2 decompression is less demanding on the processor, and although it was a challenge to do in real time with the first Pentium and Pentium II processors, it's easily done now in software on even the slowest processor you're likely to have lying around. Processing on the client PC should also include the capability to play a DVD from the local drive so you don't need a separate DVD player.
- Remote control—Even though you can use a wireless keyboard and mouse to control the client software, it's awkward to need all that hardware. More useful is to have a remote control similar to what you'd normally use to control a television. You can use either radio or infrared signals; infrared doesn't go through walls, so is less likely to have inter-room interference issues, but you'll need to be careful if you're also using infrared to control a satellite or cable TV set top box.
We decided to only require reception of off-the-air video for the version we describe here, but the components we used are capable of being adapted to drive satellite and cable TV set top boxes, feeding a composite or S-Video signal into your video capture device.
You'll need to decide how much storage you want. If you follow the lead of the first generation TiVo PVRs, you'll want up to 35 hours of capacity, which translates into 35 hours * 2.25 GB per hour = 78.75 GB. Translate that to disk capacities (which use factors of 1000 and not 1024) and you need 85 GB of space. (In practice, first-generation TiVos shipped with 40 GB disks, but use a range of compression rates—that's why the specification is for up to35 hours.) Table 3-1 uses the same approach, and includes two different compression rates. The 0.625 MBps rate assumes MPEG-2, as above; the 3.614 MBps rate assumes video compressed to an AVI format with little processing and higher quality. Total storage numbers in the table are rounded up.
|Hours Stored||Data rate (MBps)||Total storage (GB)|
Table 3-1 notwithstanding, we simply decided to cram as much storage into the box as we could conveniently fit. You'll need Windows 2000 or later to address the very large files and partitions associated with video; depending on the software you use, you may or may not be able to segment the storage into multiple partitions. If you can't, then you'll need to use RAID striping to combine multiple disks together. You can do that with Windows Server, or with hardware.
- Microsoft Windows 98 Second Edition or Millennium Edition, or Windows 2000 (SP3 or later) or XP. Windows 9X won't handle the large files and disks well.
- 128MB RAM (256MB recommended)
- Intel Pentium III or later, or AMD Athlon. Either way, the processor should run at 600 MHz or faster.
- Supported TV tuner card and video card; make sure you have both composite video capture inputs and television outputs to get the most from the system.
Being the performance fanatics we are, however, we built up a PC specifically for this project, selecting these components in particular:
- 3.6 GHz Pentium 4 (Prescott) CPU for compression performance when burning DVDs.
- Thermally advantaged case to meet the higher cooling demands of the Prescott CPU.
- Added fans at CPU air case inlet and case front, including noise reduction gaskets.
- Four 200 GB disks. The 250 GB Serial ATA (SATA) disks were hard to get, and 400 GB units didn't ship until after our publication deadline.
- RAID controller on the motherboard to simplify disk integration.
Table 3-2 lists the key PC components we included. The processor, motherboard, disks, video card, and case are matched—the motherboard supports the processor power and socket interface, while the case is specifically designed to provide the extra cooling the processor requires. The video card works with the PCI Express graphics port made available by the motherboard.
|Intel 3.6 GHz Pentium 4 Processor 560|
|4 Seagate ST3200822AS (200 GB SATA)|
|Thermally Advantaged Case|
|PCI Express Video Card|
|ATI Radeon X600|
|Hauppauge PVR-250MCE||Packages including the SageTV software, a Streamzap remote control, and one or more of the Hauppauge tuners is available
|PC-4200 Memory (two 256 MB modules)|
Don't overlook the need for more than standard levels of cooling with the Prescott series of processors—the heat sink and case must, collectively, be able to dissipate 115 watts from the processor alone, and the power supply must meet that requirement along with the requirements of the memory, motherboard, and disk drives.
The PC industry refers to cases designed for these processors as Thermally Advantaged Cases (TAC). The key difference you'll see looking at a TAC unit is the presence of an air inlet on the side of the case directly in line with the CPU. Using the standard power supply and case rear fans, and adding fans for the CPU air inlet and case front, we measured the processor temperature to be no higher than 63@@dgC under all processing loads.
We used four disks simply because that's how many SATA drives the motherboard supports. The RAID hardware controller on the motherboard only supports RAID striping for pairs of drives, however, so we used it to create two arrays. Those arrays show up in Windows as 372 GB each, reflecting the factor of 1000 disk makers use to convert bytes to KB, MB, and GB versus the factor of 1024 Windows uses. We set the second RAID array as a folder in the first because we dislike drive letters, but you could equally well make them independent drives.
We're assuming that readers know how to build PCs and install Windows, so in this section we're only going to highlight parts of the server PC we built that are different than common practice. If you need more details on how to assemble and start up a PC, please see our PC Upgrade and Repair Bible (Wiley, 2004).
The first difference you'll see is the hole in one side of the case. There's a duct attached to the hold inside the case to direct cool air from outside the case straight to the CPU cooling fan. We interposed an 80 mm fan between the case side and the duct (Figure 3-7) to increase the air flow onto the CPU cooler. (As it happens, we used an Antec fan with blue LEDs, and wired it to a pulse width modulated fan connector on the motherboard. The result is that the LEDs flash and stay on more the hotter the system is.)
We also used a soft gasket between the fan and the case side to help reduce noise from fan vibration. Figure 3-8 shows the details of the installation—the gasket is between the fan and the case side panel; fan screws inserted from the outside of the panel anchor the fan to the metal. Another set of screws anchor the duct to the fan. We used soft washers between the fan and the duct to further reduce noise.
The case provides noise isolation mounts for the disk drives too. Figure 3-9 shows the stack of four drives we used for an aggregate 800 GB capacity.
The D915GUX motherboard (Figure 3-10) is somewhat different from the usual micro ATX board too—the processor socket is more dense, and the board hosts PCI and PCI Express sockets (but no AGP socket).
Figure 3-12 shows the processor after installing it in the socket and closing the retention clamp. You ensure the processor is properly oriented, gently drop it straight down into the socket, verify it's located right, and latch the clamp down.
Figure 3-13 shows the PCI Express X1 connector, shown next to PCI connectors for size comparison.
It's easier to mount the processor when the motherboard is outside the case, but you'll want to mount the CPU cooling fan after you install the motherboard. Figure 3-14 shows the cooling fan and heat sink.
There's a specific process for attaching the cooling fan assembly to the motherboard involving turning the retention clips. It's important you get that process right, because if you don't the clips won't be secured properly and the cooling fan will either not be in tight contact with the processor, so it won't perform properly, or—far worse—it will fall off. Figure 3-15 is a close-up of the retention clip.
Figure 3-16 Many cases and power supplies—including the ATX12V 1.2 supply in the Antec case we used—don't have the necessary newer connector, so in addition to the now-common 12-volt auxiliary power connector, the D915GUX adds a disk drive–type connector to bring more power onto the motherboard. Figure 3-17 shows both the 12-volt auxiliary power connector (on the right) and the disk drive connector (on the left). We connected both to the power supply to provide the necessary additional power the motherboard and processor require.
Figure 3-17 Figure 3-18 shows the motherboard PCI Express X16 connector above a PCI connector for comparison. The PCI Express X16 connector, which provides more bandwidth to the video card than PCI or even 8X AGP, is similar in size and position to the older AGP connector, and significantly longer than the PCI Express X1 connector in Figure 3-13. There aren't many PCI Express video cards on the market as we write this—the ATI Radeon X600 is one of only a few—but the market should expand rapidly as more machines with PCI Express motherboards are deployed.
Figure 3-18 You'll get the best TV video quality using an S-Video output from the video card to the television. We suggest setting the video card at 800x600 resolution, and 32-bit color. Don't forget a screen saver, particularly if you're using a large-screen projection TV subject to burn-in.
The hardware you choose will affect the capacity of your system, the number of simultaneous channels you can watch or record, and the quality of the video you see, but it's the software that determines how much you like the end result. Media Portal is available as open source on SourceForge.net (mediaportal.sourceforge.net), and looks very capable. If you're looking for a more ready-to-go software suite, however, SageTV is what you'll want. The software gives you capabilities similar to TiVo (Figure 3-19), including the ability to schedule future recordings by specific times or by what shows you want (Figure 3-20). In full-screen mode, the user interface is well suited to display on a television and control with a handheld remote.
The software not only gives you the client/server structure we've designed into the hardware, it extends that design to let you play MP3 playlists and DVDs, and to run multiple TV tuners in networked PCs. You'll start to see more network traffic into the server as well as out from it, so you'll want to make sure your LAN has the necessary bandwidth.
Multiple tuners, something we'd previously only seen on the DirecTV TiVos, give you more options when you're watching. Even if there's only one TV in use, multiple tuners can be useful when there are shows you want recorded while you watch something else, or when there are several shows you want to flip among. The presence of multiple tuners does more for watching multiple live channels than skip commercials, because it lets you pause playback, shift to other channels, and then return—because the video was on pause, you miss nothing in the process.
Video editing and recording onto DVD (called authoring) remains one of the best applications of a fast, capable PC. You can do everything you used to do with a VCR, including preserving both off-the-air broadcasts and camcorder video, but do it with better quality and with editing to select just the parts you want. Your PC can do more than the standalone DVD recorders, too, because you can get software that's more capable than what's hardwired into the standalone units. You can now get dual-layer DVD burners too, enabling you to store about 9 GB (about 2 hours of standard quality compressed video) on a single disk.That's the good news.
The bad news is that, despite having tried a number of programs, we've not found reasonably priced editing and authoring software we can recommend unconditionally. Here's our take:
- InterVideo WinDVD Creator 2
—With a user interface (Figure 3-21) similar to that of Pinnacle Studio, we were prepared to like WinDVD Creator as much as we like WinDVD, which is our favorite DVD player software. Our initial work with it went well, but after we discovered it crashed regularly on files we'd pulled in with another manufacturer's video capture card and codec, we gave up. If you can be sure you'll never need a foreign codec, you might like WinDVD Creator.
- Pinnacle Systems Studio and Expression
—We've used Studio since we started making DVDs, and like it a lot. Unfortunately, we've had problems with it, too. The version of Studio we use, Studio 8, often fails to keep the audio and video in synchronization, and has a relatively slow MPEG-2 encoder. It's possible those problems have been fixed in Studio 9, but when we read part of the license agreement that gave them unlimited permission to make changes to our computers remotely, with no liability to them for problems created, we terminated the install. Pinnacle Expression is a basic authoring package and doesn't seem prone to the synchronization problems Studio has, so the pair give you the total capability you need.
- Ahead Software NeroVision Express 3
—As we've come to expect from Ahead Software, NeroVision Express 3 was a solid, reliable program that on installation recognized and was compatible with the dual-layer Sony DVD burner we used. We found the user interface (Figure 3-22) a little clunky and dumbed down as compared to Pinnacle Studio, but if you can work past that, this might be the one to choose.
Regardless of the software you use, making a DVD consists of these steps:
- Capture the source video as one or more clips. Use the best source format you can, such as S-Video, and—ideally—capture to disk with no compression or lossless compression. You'll want to preserve the choice of compression parameters for when you write the DVD, and multiple compression cycles only reduce the video quality.
- Edit the video into a complete program. We generally combine all the clips together, leaving breaks only where we want menus to go on the DVD. Add any necessary sound tracks and transition effects.
- Render the completed program to disk. Strictly speaking, you don't have to do this before you burn the DVD, but we've encountered enough problems in the authoring steps following this one that it's a time-saver to keep a copy of the final version. Editing and rendering go much faster if the source and destination files are on local disks, and faster yet if they are themselves on different physical disks.
- Build the DVD menu (or menus if you have so many clips you're setting as chapters that you need to segment them) in your authoring software. Set a background image, number of menu items, item formats, and item images as you want, then test the menu operation. Testing is useful to make sure you've defined the menu the way you want. If you extract short video segments from the program or another source—say, 10 to 20 seconds—some programs let you set them as the menu item or screen background.
- Burn the DVD and test it in a DVD player. Set the compression so the program adjusts the degree of compression to make the overall program just fit on the DVD, which will give you the least degree of compression and the highest video quality that fits on the DVD.
Much to our surprise, we didn't think of many variations on this project, which probably reflects how well the version we describe turned out. The ones we came up with are:
- Play DVDs from a remote drive.
- Use multiple tuners.
You might do this on multiple PCs. Recording multiple streams at once is relatively simple—the only real complexity is that you'll need the SageTV Recorder software to control remote tuners on other PCs. The biggest issues in the entire effort will be getting the video signal to all the tuners and making sure you have your network equipped with switches and enough bandwidth.
- Set up IR remote transmitters so SageTV can control set top boxes.
You can get many more channels on cable TV or satellite, but (because the data streams are encrypted and must be decrypted against data stored in a smart card) digital cable TV and satellite require you to use the provider's set top box. SageTV can control those boxes using infrared signaling through a transceiver you attach to the corresponding PC. We suggest using the USB-UIRT infrared transceiver. Summary
TV doesn't have to be the constrained, simplistic enterprise most people are accustomed to. You can centralize the recording and video operations, distributing compressed video over your network. The result is a far more flexible system with which you can not only watch what you want, but also watch it where you want it.