Five Pounds of Flax

Every culture has a burrito.

DIY Video On Demand - Part 1

Saturday, January 28, 2006posted by Michael Rothwell @ 2:53 PM

I have recently set up a Video On Demand (VOD) system in my house.

The core is a terabyte-capacity fileserver based on Fedora Core 4. It has five 320GB USB2 drives configured as a RAID5 volume. An LVM2 volume is built on top of that, allowing future expansion of the volume. The filesystem is Ext3 with an external ordered-data journal and ACLs enabled. Files are served using Samba and the Eyehome software (which is just Tomcat, really; it turns out the Eyehome is mostly a web browser). USB raid array?!? Yeah. It works! I get about 15-20 MB/sec to the array over the network, and up to 24 MB/sec off the array, also over the network. All the Fast Ethernet network can handle is around 9-10MB/sec before it saturates. That's still more than plenty to play any video file on the array. Even straight DVD video fits down that pipe.

The fileserver and my Powerbook (which transcodes all of the video) are connected via Gigabit ethernet. I want the better transfer rates when transcoding and copying multi-gigabyte files.

Until recently I had a ReplayTV in the mix, recording shows from DirecTV and/or cable. The MPEGs were transferred to the storage array using mReplay and DVArchive.

The Eyehome uses 10/100 ethernet, S-Video and Component video outputand RCA and optical audio outputs. I have it connected to my Samsung DLP HDTV via component video, operating at 480p. The Eyehome supports higher resolution output, but its native resolution is 480p. Rather than have it scale video down to 480p and then back up to 720p, I just stick with 480p and let the HDTV monitor do the scaling. If your video file has AC3 audio, it can be played back using only the optical output, as the Eyehome does not have any AC3 decoder capability, and just passes it through. Since none of my equipment has optical in, I transcode the audio to MP3 or AAC for this reason. Silent movies were great in ther day and all... but I want noise. The Eyehome decodes DivX, MPEG4, MPEG2, MP3, AAC and MP2.

For the archiving and transcoding, I use four programs.

mtrMac the Ripper (MtR) to backup DVDs to the array. The transcode step works faster from a VIDEO_TS folder than it does from the disc itself. Also, I like to leave my DVDs in the cases when possible, to avoid scratching and other damage.

YadeXYade X is a nice utility for dumping portions of a DVD to a single VOB file. I can then post-process the VOB file with other tools, such as mencoder, ffmpeg or DVD42.

HBHandbrake is a good DVD-to-MPEG4 transcoder. It use it to make MPEG4 video with H.264 video and AAC audio. Its queueing system is primitive, but functional.

vxForty-TwoDVD-VXPlus is a wrapper for mencoder, mplayer and some other GPL-type tools. It's pretty basic, and the end result is that it just invokes the command-line mencoder with certain options. The new version (3.0) says it's a universal binary, but all the tools that do the work are PPC only. Expect it to not be that great on an Intel mac. For some reason, the authors are using old builds of mencoder, still. The setting I use is "QDVD" (DivX with Mp3 audio in a quicktime-compatible wrapper), with a custom bitrate of 2400 and the volume adjusted manually (Stargate tends to have low-level audio). Its queue system is its killer feature.

These tools produce AVI files (DVD42) or MP4 files (Handbrake). I think that the MP4 files are the best, in terms of video quality and file size. However, Handbrake has a problem with audio sync on some DVDs (such as Stargate discs). I use Handbrake or DVD42 as appropriate. Handbrake will de-interlace the video and does H.264 encoding, so I prefer to use it, barring any sync problems.

The end result is that we can sit on the couch and select movies and TV shows to watch using a regular remote control.

There needs to be a better toolchain for doing this work, and Sal and Keith and I have started working on one. It, too, will be mencoder-based. But we'll use recent source, build it ourselves, and add the features that we want to use.

Stay tuned!
In Part 2, I will detail the specifics of the setup. Drive enclosures, kernel parameters, samba config, the eyehome software, etc.

RHCE, Baby!

posted by Michael Rothwell @ 2:20 PM

I just received my RHCE certification. Sal and I were at RedHat all last week. Our instructor was Check Mead. Nice guy. Plays WoW.

Now I have one day of "business-skills" Professional Development left in my budget. I wonder if paintball counts?