Linux DevCenter    
 Published on Linux DevCenter (http://www.linuxdevcenter.com/)
 See this if you're having trouble printing code examples


Building a Linux Media PC

by John Littler
05/27/2004

In this article I'm going to look at a particular sort of setup of a Linux home theatre PC — one where the primary consideration is space. Suppose you have a small studio apartment, or a bedroom or study where you want to work on your computer, watch movies and TV, and play music and maybe games as well.

If you did things the normal way, you'd have a TV and DVD player, a computer and monitor, a CD player, amplifier, and speakers. If you're extremely finicky about sound quality, for example, and already have expensive audio gear, and if you cringe when you hear poor quality audio, you'd better stick with at least part of that. For people who can live with somewhat lesser quality, the media PC can be quite OK. There are options to make it sound better than a standard PC from the local warehouse store, but they cost more. We'll explore those shortly.

Screens

Let's consider an ergonomic issue first: screen size. Most people like to lounge while watching movies. This implies that, even if you do have a super-comfy work chair, you'll sit further away from the screen for entertainment than for work. This will require a larger screen than the basic minimum necessary for computer work alone.

There are rules of thumb for movie or TV screen size, but they tend toward recommending extra large screen sizes which don't fit our compromise, so we're I'll ignore them. The next time you're at the movies, measure the effective screen size by putting up your hands and framing the screen, then measure the distances between your hands. When you get home, sit where you'd want to, put your hands in the same position, and project that size onto the position of the screen. If you choose where you sat at the movies, this could be enlightening. If you chose to sit down the front, the results won't be enlightening at all ... you just want an enormous screen. Next, ask yourself whether the screen has to be where you projected it.

The closer it moves to you along the projection path, the smaller it appears. For example, suppose you're holding your hands out like a film director, about 15 inches apart. If the monitor is at arms' length, it will need to be 15 inches across. If it's on the other side of the room, it needs to be much larger to appear the same size.

Learning Lab TigerLinux/Unix System Administration Certification -- Would you like to polish your system administration skills online and receive credit from the University of Illinois? Learn how to administer Linux/Unix systems and gain real experience with a root access account. The four-course series covers the Unix file system, networking, Unix services, and scripting. It's all at the O'Reilly Learning Lab.

The problem with a small screen is finding a comfortable position when you're close. You might need a little ingenuity here.

Sound

Let's face it, most PC speakers suck. They have nasty little drivers and built-in amps that lack headroom. No one seriously intended them as high fidelity devices — and they aren't. Many of the three or more speaker box solutions are little better. Some are even worse.

One of the problems with badly executed surround sound box sets, besides cheap components, is the cutoff frequency for the bass box. Very low frequencies are non-directional — that is, you can't tell where the sounds come from. Ideally, the bass speakers in this sort of system will only operate in the non-directional frequency band. The satellite speakers should handle frequencies down to this point (or, better, an octave below) and then the bass box should take over. In most consumer models of this system, the cutoff point is nowhere near the non-directional point. To add insult to injury, the bass speaker will frequently generate upper harmonics of the sounds it should be producing. This is especially bad if the bass box is reality churning out sounds in the midrange.

What does all that mean? These systems do sound bigger than ordinary PC speakers but that's the best that you can say about them. The mix you hear will have little resemblance to the one the sound engineer slaved over. At worst, speech intelligibility will suffer and you'll cry when you hear violins, though not because of the sadness of the music.

Related Reading

Linux Music & Sound
How to Install, Configure, and Use Linux Audio Software
By Dave Phillips

The extent to which any of this is upsetting is intensely personal, so without turning this section into a book, I'll just add a few points. For a small-scale setup, I'd forget about surround sound. Small, self-powered, bi-amped studio monitors are a nice option here. Yamaha, Genelec, and Tannoy (amongst others), make reasonably priced models, and the models are quite small. If you use this approach, though, you might need a small mixer to handle the cables.

Another alternative is to purchase a pair of high quality headphones from a studio supply shop. This is also a nice if you need to keep the noise down, but lots of people don't like to wear headphones for long periods of time. Once again, the small size and combination of the speakers mean that you won't hear the sound engineer's mix.

The Computer

In the search for a one box solution, you could buy a Sony PlayStation2 and its Linux kit, or you could purchase an Xbox and perform possibly illegal acts on it to make it into an all-purpose computer. In an earlier article I looked at the PS2 Linux kit, which works fine for basic computing needs. It could be quite a good solution if you already have the console and want to play a lot of PS2 games.

Instead, we'll consider running a normal PC. The issues that arise are performance, silence, and maybe looks. Adequate performance is easy to provide. We don't want to edit video, just watch it, so any newer setup will work just fine. That's true of music as well. If we want to store movies, TV programs, or music, we'll want the biggest hard disks we can afford. If we want to play PC games as well, then in addition to the possibility of dual booting we'll want the highest hardware specs we can find.

Having a relatively silent PC is a big plus here. Constantly straining to hear over the whine of fans and hard drives will make you grumpy. Your options are to put a a silencing kit over a noisy PC or to buy a quiet PC in the first place.

There are many boards suitable for a project like this but one wacky (in the context of this article) alternative I just came across is the Soyo SY-P4VAL. This is relevant if you don't particularly want to use the box as a computer; it does all the media playing from BIOS, without needing an OS!

The Machine

I started with a P4 board and a really nice looking cast metal compact case from Hoojum.com. It has 1 Gig of RAM, 264 Gigs of disk space, and a 3.3 GHz CPU. That's more than enough for what we intend. The setup is capable of serious work. As well, it looks nice, which is part of my goal.

The Linux

The computer came with Windows XP, so the first thing I did was get rid of it entirely. I had an old SuSE 8.4 CD set around and also a Gentoo starter CD so I started with those, but the old SuSE couldn't catch the video card or monitor and wouldn't let me set it manually, so I moved onto Gentoo. Gentoo is a really nice way to do things if you start with some Linux knowledge, as the system and apps all end up being optimized for your setup. Unfortunately, it needs broadband to update packages and to avoid some heavy mucking about to do the installation without importing any files. I did the heavy mucking only to find that the bootloader Grub couldn't and wouldn't (given options) find the kernel. A few swear words later, I decided to try one of the easy distros. Mandrake 9.2 installed without difficulty. I then upgraded it to 10.

There's no particular reason why you couldn't use your own favorite flavor of Linux for this task. There are also music studio add-ons in both Debian and RPM format, but that's a different story for another article.

A 64-bit Aside

Before the Hoojum machine arrived I thought I'd receive an AMD Opteron, so I went off to look at what that would mean. I ended up with a Pentium 4 but this information might be useful anyway, so here goes ...

Most people have a hazy idea that bigger is better in this line, and it is sort of true but there are a few gotchas. For example, the AMD Opteron CPU runs 32-bit applications in a "native mode". This is not true of Intel's Itanium, which runs those apps in an allegedly slower emulation mode. If you have a collection of 32-bit apps that aren't going to take advantage of the increased address space with a recompile, then there's no point to the extra juice.

If we were going to run studio apps on our media PC, we'd likely benefit from the extra 32 bits but it's not quite so clear when our aim is mostly to play things with existing applications. If we were to look at what we could do then things are different — any kind of post-processing, for example, would be easier to handle in real-time with 64 bits.

The first thing you need to take any advantage of the 64 bits is a 64-bit OS. There are 64-bit Linux flavors available including ones from Red Hat and SuSE.

You'll also need applications written and compiled especially for the 64 bit environment. This assumes that the app can usefully use the increased address space available. You can just recompile an app for 64 bit without changing the code and if it can use the increased address space, it will.

The last option is to run a 32-bit app as is. This is quite OK on an Opteron, but it seems a bit of a waste of the resources available.

If you feel like looking further into the 64-bit business, AMD have quite a few 64-bit resources. You can also find information about porting Linux apps to 64-bit machines at the AMD 64 homepage

The Media Apps

With the hardware options out of the way, it's time to consider the necessary software. There are several categories to consider.

Music

In the olden days (not that long ago), in order to play a music CD, you needed to read a few docs and learn things — man mount and all that. These days, you can stick the CD in the slot and click the app that came with the distribution without even downloading anything! That's certainly true of Mandrake and the KDE desktop and most others.

There is quite a range of apps available to do this job and I suspect that most people will use the one with the greatest visual appeal.

Files and Ph1l3z

There is quite a range of players for mp3, Ogg, and other file formats. XMMS has been very popular for a while and will also play your CD's. Should I give a lecture here about lossy CODECs being for the cloth-eared? No, no, I won't. And yes, I do understand that there are circumstances where lossy CODECs aren't vitally important.

DVD

The next step is to play DVDs. The problem here is well known: encryption. Most DVD player apps come packaged without the necessary library for decryption to avoid the unwelcome attention of lawyers. It's a trivial problem to add that support again; all we have to do is find a compatible version of libdvdcss. Once that's done, programs such as totem, mplayer, xine, and ogle will play your commercial DVDs.

While CDs don't require any CPU grunt at all, DVDs must be decrypted on the fly so they require a little. Ogle, for example, mentions a PII 400 as a useful minimum CPU.

TV

Some people won't even bother with playing TV on the media PC. One reason for non-TV watchers to consider buying a TV card is to play console games — you can plug the console into the TV card and away you go.

Unfortunately, TV cards don't have anything like the ALSA sound card matrix where you can see what the driver status is for different cards. As an illustration, my test PC had a Hauppauge WinTV PVR 250/350 card. I don't know much about these cards, so I assumed it was the same WinTV card that everyone else could run successfully. I only found out it wasn't supported (but support is coming: see ittv) in a conversation with Billy Biggs, tvtime's developer.

Before you buy the card, make sure to find firm (if anecdotal) evidence that it has support and actually works. You could always ask the mailing list of the app you plan to use.

There aren't that many TV-playing apps to choose from. xawtv comes with a few distributions but with Mandrake 9.2 at least, it can lock the system up if it zeroes in on the wrong input by mistake. tvtime is more friendly and is easier to adjust.

For those that are really serious about their TV, the TIVO-like MythTV allows you to download program listings, watch TV, skip ads, play DVDs ... and lots more. The web site has a full feature list. It's meant to be an all-in-one app and it pretty much is. The downside is that it has a huge list of dependencies that are not all that clearly indicated, and I couldn't find an Emacs-like sumo pack to download.

Games

If you haven't checked out Linux games, you might be surprised at just how many there are. There aren't any ports of PS2 and Xbox blockbusters but there are plenty of fun time-wasters there, including Tux Racer, which has you speeding down a snowy mountain collecting a somewhat miraculous string of herrings.

There are some interesting things in the land of emulators as well, but I haven't explored this.

With the PC setup described above, we could easily dual boot to play PC games. With the correct TV card, we can plug in consoles too.

Convergence and Greenness!

It must help the environment and your power bill to run fewer components but unless you're accustomed to running everything at once — and a one box solution stops you from doing that — you likely won't see huge savings in power costs or power needs. Likewise your non-investment in various other components won't make much of a difference to the environment either, but if lots of people make do with fewer devices, it may have a cumulative effect.

Besides the ecological manufacturing costs and externalities of power generation and supply, there's also the trash disposal question. That's a win too. PCs and electronics equipment are notoriously difficult to dispose of safely.

Conclusion

Is a Linux media PC a good idea? Sure it is! There are plenty of apps available and the project includes just enough tinkering to give you a sense of accomplishment. If you're starting from scratch, then the main caveat is to make sure your sound and TV cards have support for the features you want to use.

John Littler is chief gopher for Mstation.org.


Return to LinuxDevCenter.com.

Copyright © 2009 O'Reilly Media, Inc.