by Niall Douglas. Last updated . This page has been accessed 946 times since the 22nd August 2008.
|View this page in:||English||Any language:
Translation to non-English languages provided by Google Language
You are connecting to the IPv4 version of this website from the IP address 22.214.171.124. You can try the IPv6-only version if you want.
Just about everyone seems to be doing a home theatre PC project in 2007
aren't they? Well, there's good reason for that: six year old technology
is now well capable of playing back DivX and such. Why is six years so
important? Because large corporations retire their oldest PC's after at
most six years (it's five really, but it takes up to another year for
the accountants to do their work and such) - so currently we are
experiencing a flood of HTPC projects built from old hardware.
The thing is, 2001 technology isn't actually that half bad in modern terms. In the 1990's, we still had very backward 1970's style technology in most PC's which cause no ends of trouble eg; ISA expansion buses, weird artificial memory limits, or jumpers to set interrupts, or use of the keyboard controller to generate system timer interrupts (don't even ask!). Various things were underpowered or cranky. By the year 2000 though, standard PC's were actually becoming sane so long as they were of high enough component quality (think Intel).
Also, things like energy consumption, size and noise had started to become important for the first time. In 2001, you could actually get small form factor PC's which are almost silent, have excellent energy saving even by today's standards, yet had enough horsepower to play even 720p MPEG2 HDTV video. One such computer is the Compaq Deskpro EN SFF which you can see on the right which looks a lot bigger than it actually is - it's about a foot and a half by a foot and a half. There are so many of these things kicking around on eBay at the minute that you can buy half containers of them from the US at less than $5 each.
I spotted a 1Ghz model on eBay going for £23.50, and I couldn't resist. Each year since I arrived at St. Andrews I find myself doing some sort of hardware upgrade in September - I don't know exactly why, but it seems consistently regular. This year I am absolutely broke so the extravagances of previous years was most definitely out.
There are definitely other reasons I wanted it too. I don't like leaving the main desktop PC on all the time, it's in my bedroom, it's noisy and it eats about 120W at idle. During the previous year, we had our HTPC setup downstairs as using Johanna's laptop connected to a cheap 19" widescreen monitor and a Creative Soundblaster Live! USB card plugged into a 5.1 Logitech speaker setup via optical cable (all this having been bought exactly one year ago). Her laptop played movies off Samba shares on mine turned on upstairs via the wireless link which is one of those Atheros 108Mbps bonded channel efforts (the standard 802.11g 54Mbps isn't quite enough unfortunately) which worked okay except during sunspots or substantial cosmic radiation bursts. It seemed unhelpful though that her laptop & my desktop was monopolised by this (as mine had to be booted into Windows XP, not Linux or Vista), also it's a noisy Pentium 4 laptop with its fans always going on and off which is annoying when the soundtrack is quiet. Lastly of course there is the major problem that her music is completely separate and distinct from my music, and sometimes she wanted music that I had and she didn't which wasn't possible without my computer being turned on.
There are other problems too eg; downloading torrents means not rebooting my PC when I want to use Linux and leaving it turned on doing nothing otherwise. Friends couldn't download stuff from my computer unless it was turned on. All in all, a low powered always-on centralised NAS solution seemed a much easier way and for less than £50 I knew I could build one.
Well, I thought it would be less than £50, but as we'll shortly see, it wasn't as easy as that. First off, here's the standard spec of the Compaq:
Now looking at that, it all seems good. The 1Ghz Pentium 3 is beefy enough, it can still manage an IPC especially for video playback comparable to modern Core 2 processors unlike the Pentium 4 which succeeded it (in fact, Core 2 was evolved from the Pentium 3 and it skipped the flawed Pentium 4 entirely - and by the way, this 1Ghz P3 is actually faster than Johanna's 1.8Ghz P4 for movie playback!). You have 100Mbit networking which used to be sorely missing in older machines, it has modern DMA based hard drives which don't cause jerky video playback like the old PIO ones did, it even has better integrated graphics than most with its specialised 4Mb of VRAM (with system memory providing any extra needed). All of it is plug & play, no jumper fiddling required or weird interrupt sharing incompatibilities. Back in 2001, this machine retailed for well over £2000 and it was considered high technology (though way overpriced as it was intended for corporations). Best of all, it only uses 40W when idle and 70W when maxed out. It's also nearly silent at idle (though it gets noisy when maxed out).
Obviously though in some areas it needs upgrading for modern usage. 128Mb of RAM is miniscule, even by 2001 standards it wasn't enough for anything past Windows 98. USB 1.1 can only transfer at 12Mbps which is pretty useless for external hard drives and most TV tuners - and I wanted to consolidate mine and Johanna's music & video collections by simply plugging both our external hard drives into the new HTPC. Furthermore, most ex-corporate machines come with hard drive removed - this protects data confidentiality, but that was okay because I had a spare 100Gb Ultra-ATA 133 drive in the desktop.
So at the start of September 2007, I ordered this off eBay along with a four port USB2 PCI expansion card costing £4.48. One problem with the i815e chipset is it will only take 512Mb total of RAM (one of those weird artificial memory limits), and furthermore like most older Intel chipsets it wants low-density not cheaper high-density stuff (low density tends to have IC's on both sides not just one side) but I found a guy on eBay selling each stick for £7.99 each including P&P. That brought the total cost so far to £43.96.
I had a spare 3Com 100Mbit network controller, wireless laser mouse and 100Gb hard drive, so they all went in together after I cleaned out the considerable amount of filth inside the case (it has an ingenious fold out case by the way, and it's very well constructed). I definitely wanted Linux on it as it would be permanently connected as a server to the internet, and besides it is old enough to have complete out-of-the-box Linux driver support AND new enough that Linux doesn't barf on stupid antiquated hardware designs. Furthermore of course, Linux runs far smoother on older hardware than say Windows Media Center Edition would.
KUbuntu 7.01 Feisty Fawn went onto it with the original plan being Linux MCE 0704 thereafter. Linux MCE in particular took FOREVER (an entire night) to install, then it turned out it wouldn't enable anything past UI1 on the Intel graphics - it really wants NVidia graphics and NVidia alone. UI1 is crap in my opinion, furthermore Linux MCE chewed up about a third of the CPU when idle AND had really shitty quality video playback with the colour conversion being all wrong. I wiped the hard drive and began again.
Getting the video working on the i815 chipset
One of the more fun parts of the 82815 integrated graphics is that it doesn't actually support 24 bit or 32 bit colour. It says it does in the specs, but when you first boot KUbuntu on a reasonably high end display (say over 1024 x 768), you get these nine sparkling green vertical lines ie; display corruption. You then furthermore find that no matter what you do, you CAN'T enable hardware acceleration in anything except 16 bit colour - not that the docs for the intel or i810 linux driver ever say this particularly clearly. Of course, no hardware acceleration means no XVideo overlay support which means video playback is very slow indeed.
So first things first, you really want to change DefaultDepth in xorg.conf to 16 bits. Just like that OpenGL glxgears etc. will work. I spent many hours figuring this out.
The next problem you will have is that you keep getting random screen corruption in X11 whether you use the older i810 driver or the new open sourced 'intel' driver. It took me ages to find that you need to disable pixmap caching - it's a bug in the driver.
Next, 720p HDTV content won't play - you get a blank overlay. Another few hours were spent in finding that the driver doesn't allocate enough memory for the overlay - you can force it using the CacheLines option though. Even with this, 720p content is vertically stretched two times too much and is unwatchable
You also want to enable XvMC - the 82815 controller provides hardware based MPEG1/2 motion compensation which significantly improves CPU load during MPEG2 playback. Remember to also enable this inside your media player eg; xine or mplayer - though personally I found it always hanged the machine in my case.
This yields the following /etc/X11/xorg.conf:
Section "Device" Identifier "Intel Corporation 82815 CGC [Chipset Graphics Controller]" Driver "intel" # This fixes screen corruption Option "XaaNoOffscreenPixmaps" "true" # This enables hardware motion correction for HDTV 720p Option "XvMCSurfaces" "7" # This enables video overlay for HDTV 720p Option "CacheLines" "900" #Option "PageFlip" "true" VideoRam 32768 BusID "PCI:0:2:0" EndSection
Don't forget to reduce the AGP aperture size in the BIOS to 32Mb - otherwise you throw away 32Mb of very valuable system memory (as you'll shortly see). The next issue that no one tells you anywhere in any of the docs is that if you want that hardware motion compensation working without mplayer barfing about output format not being available, you need to tell X11 which XvMC library to load by modifying /etc/X11/XvMCConfig to the following:
Obviously this is the correct library for the i810 driver - NVidia or VIA Unichrome owners would use a different library. Note that this requires the media player application to be run as root to work at all with current XvMC drivers.
With this, I had my 1440 x 900 LCD display up & running with video accelerated using the onboard graphics, though admittedly it could be better.
Hmm, need more stuff!
During all of this, I was watching eBay for a second hand DVB-T (Freeview) TV tuner. Ideally it should be USB as I only have one PCI slot free (and I might want a video card in it someday) even though the USB stick variants don't come with hardware MPEG2 decompression like the USB box or PCI card variants. We want hardware MPEG2 decompression if possible because DVB is basically a MPEG2 transport stream like satellite or cable - HDTV variants in the future may go x264 (MPEG4), but they'll always remain MPEG2 backwards compatible via a sub-channel. However after running tests on sample MPEG2 transport streams, with the XvMC fix above it didn't exceed 50% CPU usage so I was happy that even without XvMC (which is basically MPEG2 hardware decompression except on the video card) it would work.
The really, really, annoying thing about eBay is that people there are very stupid. So for example, they'll happily pay more for something second hand than it costs brand new! Linux has a restricted list of supported TV tuners - anything by Hauppauge tends to be supported - and you can get a Hauppauge Nova-T Stick (which is definitely supported, but only in kernels >= 2.6.19) brand new for £20 inc VAT from Microdirect. Yet people were often bidding these as second hand over £25!
Equally, I would often get just pipped at the post just over £15 which was the maximum I was willing to pay for a second hand item when it's £20 for the same thing brand new. Occasionally I would miss an auction due to a friend calling over or talking to Megan or Johanna on the phone (which tends to last hours) and then find much to my anger that the auction closed at less than £10 inc P&P. After ten days of this I gave up and just bought the damn thing from Microdirect for £19.74.
I also bought a PS2 keyboard while I was at it because I was getting very sick & tired of constantly moving the one keyboard I have from the desktop to the Compaq and back again. For £3.06 it was more than worth the hassle, especially having to tramp up and down the stairs each time with it whenever I forgot. I also bought fifty blank DVD's as I was nearly run out plus a 240 pocket CD container as I had also run out of storage. P&P came to £4.69, so let's be unfair and add all of that to the cost: that makes total cost so far to be £43.96 + £19.74 + £3.06 + £4.69 = £71.45.
Ok, so I'm nearly 50% over budget! However, the Compaq came quite by chance with 256Mb of memory instead of 128Mb, so selling that on eBay yielded £X which after postage costs returned £X.
Another thing which happened was that by chance someone tried telling a GeForce 5200 PCI video card which they said was definitely faulty under Windows. I figured it was worth a punt and maybe it would work on Linux, so I punted £3.99 to see what would happen.
After no luck with LinuxMCE, I gave Elisa a go. Elisa looks gorgeous, is dead simple to use and has a really intuitive three dimensional spinning user interface which as you can see, spins actual pictures of the media around. It will become the standard media centre for KDE relatively soon - unfortunately, it turns out after I had fetched it from SVN that it simply won't work on the 81815's OpenGL ability.
My next attempt was Freevo v2 also from SVN which you can see on the left. This didn't use any fancy OpenGL graphics and works on just about anything. However, it was slow to navigate - you'd get long pauses, and I hadn't even loaded in any media yet. It also simply refused to passthrough AC3 audo from movies thus giving a distinctly underwhelming two channel stereo downmix. Nevertheless, things were getting better - I managed to get the Creative Soundblaster USB remote to control Freevo using this HOWTO.
Next attempt after that was the biggest name in TiVO frontends, MythTV. This is probably the most mature of the frontends, but it's also pretty heavyweight with a full MySQL based backend daemon and it is centred around TV viewing and recording rather than other media. Ubuntu comes with packages for MythTV, so it's as simple as following the very easy directions and configuring the backend and then the frontend.
It works well - AC3 passthrough works, though it required quite a bit of hassle to get RealVideo working (install RealVideo, try playing a .rm file using mplayer in a console, it will barf about a missing driver, copy that driver from the RealVideo installation, then add a custom .rm type ticking "Default Player" (which is mplayer), then don't forget to configure mplayer separately for the remote and DEFINITELY don't forget to run a window manager like flwm if booting as standalone). The only BIG problem is the memory usage - it chews up between the frontend, its XOrg instance, and the MySQL backend about 320Mb!!! This is fine when running standalone, it's very much NOT fine if simultaneously running a remote KDE session.
It turned out that v0.20.2 of MythTV reduced memory consumption by about half, so after some fiddling with feisty-proposed packages it did indeed reduce memory consumption to around XMb.
Using the default Ubuntu Feisty 2.6.16 kernel for such a machine seems a little stupid - for one thing, enabling tickless interrupts (much lower idle power consumption) and a preemptive kernel (better interrupt latency) along with better i/o and process scheduling whilst disabling all the memory consuming drivers we don't need makes a LOT of sense. Furthermore, the DVB-T tuner card I have bought (the Hauppauge Nova-T USB Stick) is only supported after 2.6.19 so I thought I might as well make the move to a custom build of 2.6.22 (the latest stable release).