The everyday ramblings of an everyday geek.

Friday, June 10, 2005

H.264 - A first practical look

I bought some DVDs at the weekend with the intention of watching them at work in my lunch hour. I could have gone the simple way of just taking the DVDs into work with me, but I thought this would be as a good a time as any to try out the H.264 to compress the video so I can store it on my hard disk.

I used two pieces of software: DVDBackup to rip the entire contents of the DVD to my hard disk and remove that pesky CSS stuff, and HandBrake to rip and encode these files to H.264/MP4. I had originally planned to use the H.264 encoder built into QT7. Traditionally I've always found the QuickTime codecs to be optimized better for Apple hardware than their FOSS alternatives, but Apple seem to have gone out of their way to make H.264 as difficult to use for this purpose has humanly possible. I would have add to added an additional step of 'demuxing' the audio and encoding it separately. I did try this, but the H.264 codec built into QT was actually a lot slower
than the x264 codec built into handbrake, with no noticeable gain in quality - way to waste £20 (at least I can watch it back in full screen).

The whole process felt like going back in time to 1998 - when I started backing up my music collection to MP3. You had to use a myriad of programs to do what is essentially one task, and the whole process was slow. I remember ripping a CD was measured in hours, not seconds like it is today. The same is true of ripping DVDs now. Between copying and encoding the whole
process took nearly 20 hours per DVD. During that time my poor iMac G5 thought it was running a marathon, with processor usage at around 75%. This left it useful for apps like web surfing and word processing, but severely lacking when I wanted to use Blender (really starting to love that app).

I decided to encode at 1MB per second, giving me a file size of about 1GB for 2 hours of film, reducing the size of the film by 75%, not bad. The quality is always going to be difficult to quantify. DVDs are already compressed, and although the quality is good you're still starting with a lossy source, and if anyone has tried re-encoding audio, they'll know that can often lead to some strange artefacts in the final product. Having said that I was impressed with the way H.264 handled the video. There was some loss in quality, but not enough to care about and it was significantly better than DivX at the same bit rate.

On to actual use. As I'd encoded it on my G5 I needed a way to get it to my laptop. 1GB is a funny size by modern standards as it illustrates an impasse in data transfers. Its too big to burn to a CD and its too slow to be transferred by 10/100 or airport networks (5-10 minutes is a long time). The most obvious answer was FireWire, which I figured would take around 2 mins,
but connecting my PowerBook directly to the G5 via FireWire would have meant setting up target disk mode, and that's too slow too. So I decided to use the iPod.

Everything in place, I fired up the movie. It took the poor G4 a little time to page everything in to virtual memory, but once it had enough memory the playback was rock solid! Had portable movies finally arrived? Well... no. My G4 is 18 months old now and the battery is waning. I can normally watch an hour or so of DVD before the battery gives out, I got about 20 minutes of
H.264. H.264 eats battery. Unless you are near a power supply it simply isn't an option on the move - at least not at DVD quality. I guess we're at a bit of an impasse. We need extra compression to get the content onto the laptops, but we need extra grunt to decompress it, and that costs battery life. As ever, we're waiting for battery technology to catch up. The only
way round this is to have H.264 hardware on board to reduce the processor load.

So will I continue to backup my DVD collection? Probably not. I've got around 100 DVDs, not the largest collection by any stretch of the imagination. I learnt the hard way that only a fool keeps their library in a single place with my music collection, at the moment that is covered by my iPod, and as a last resort I've still got all my old CDs somewhere. I estimate that I will need 300GB of storage just for the DVDs I've got at the moment (probably as two external hard drives) that will cost me around £250. Then there is the time it would take to backup in the first place, if I started now I'd probably be finished by September (backing up shouldn't be
measured in months). H.264 is clearly a superior standard to MPEG2 - it really is as good, if not
better because of the reduced jaggies, at 25% of the size. Unless something clever happens with the way the codec is implemented, I simply can't see a situation where I would routinely put myself through 20 hours of encoding, even at 1 hour TV program would take 10 hours to compress (not exactly real time) so its not even useful for PVR duties. The fact is that general
purpose CPUs just aren't the right tool for the job, until hardware codec's are available for £20 my DVDs are staying where the movie industry wants them... on DVDs.


Post a Comment

<< Home