video on linux

I have a newborn, which means I have a burning need to take video that no one wants to look at. I have a digital video camera that make it possible to fulfill this fetish.

Like most digital video cameras, the one that I own has a firewire (ieee1394) port on it. I have an Apple Powerbook that also has said port. I have a DVD burner attached to my Linux server.

So I’m figuring that I can use iMovie on the Mac, capture my home movies, edit them, and make DVDs to torture my family with. Alas, not so easy!

Capturing video from the camera with the Powerbook was very easy. Hook up the camera, and OS X automatically offers to start iMovie, which has a friendly button on the display labeled "import" or somesuch. Boom. Trivial. I was pleased to note that it even automatically divides the project into clips where there is a break in the footage.

I then spent many hours with iMovie editing my masterpiece: adjusting brightness/contrast, fixing colors, adding effects/transitions, cropping out the boring parts, creating a soundtrack, etc. It was great. Eventually, I declare success, and am ready to master the DVD image… Except that iMovie doesn’t do that, it only offers to export to iDVD. Which I don’t have installed.

So I turn to my trusty aide, the IN TAR NET, and summon a copy of iDVD. Of course, now that I’ve got a zillion gigabytes of video on the laptop, I don’t have room to install it, so I set up an NFS server just so I can run iDVD from the Linux box.

iDVD, however, refuses to run without a DVD burner installed. Apparently it’s not designed to create ISO images. I had expected to be able to create an ISO image, which I would then go burn to DVD on the Linux box where the burner is installed. No such luck.

But I really want to be able to make my own home-movie DVDs, so I wasn’t deterred at that point. I then bought an external firewire enclosure, and a firewire card for the Linux server. Once these things arrived, I was able to easily swap the DVD burner between the Linux server and the Apple Powerbook G4.

Except that iDVD still wouldn’t start up, again claiming that the appropriate hardware wasn’t installed. A little more research on the IN TAR NET, and I determined that iDVD only works with the Apple Superdrive; my third-party device will not work with the software. Apple sells a product called DVD Studio Pro that would work but for big bucks. Sure, I could probably find a copy "somewhere" but I’m don’t approve of pirating software, which is one of the reasons that I run open source software in the first place.

So… after a week or so of gnashing my teeth and swearing at Apple, I start looking into Linux based software. After all, I bought an ieee1394 card for the Linux machine when I bought the external enclosure. This should allow me, I reckoned, to connect the camera and the DVD burner to the Linux machine and to Hell with the Powerbook. With hardy any effort I installed Kino which pretty happily captured the video from the camera, and gave me some minimal editing capability. It’s not iMovie, that’s for sure – it has only the bare essentials, but it imports DV (Digital Video), and provides a GUI to export into MPEG files suitable for DVD authoring.

Annoyingly, there apparently is not currently an easy Debian package for mjpegtools, which is a project that Kino uses to do the MPEG encoding. I found a debian package, but it was dependent on some other package, which I didn’t have either, and couldn’t find. I have years of experience building things from source, and that took no time at all.

MPEGs having been built, I used dvdauthor to covert the raw MPEG files to the DVD format, which is a great piece of software with a completely arcane interface. I then attempted to use dvdrecord to burn the DVD. This caused another world of pain, because the Linux ieee1394 implementation is somewhat unstable, and trying to send raw-SCSI commands to an ATA drive over an ieee1394 interface was just one transform too many, and I was able to lock up the operating system very repeatably. I posted the error to the Linux Kernel Mailing List, but like most lurkers with obscure bugs, was ignored.

There’s another program for Linux that will create DVDs called growisofs which worked. This program does not use raw-SCSI, but instead works through the kernel cdrom driver (sr_mod instead of sg).

As an aside, I also looked at Polidori which is a nice idea, but not ready for anything. I’m tempted to contribute to the project, but I know I don’t have time to do so.

I burned my movie to DVD+R media, and my set-top player rejected it as unreadable. I tried again with DVD-R media, and it worked! But the audio sounded somewhat like chipmunks gargling. As it turns out, mp2enc, the audio encoder from mjpegtools, defaults to CD-quality audio (44.1kHz), but DVD’s are recorded at 48kHz. So when played back, the audio on the DVD I created was about 10% too fast, but the video was playing back at normal speed. This caused everything to be higher in pitch, but to then stretch out the audio to maintain synchronization, there were tiny gaps inserted into the sound. Hence, gargling chipmunks.

This can be fixed by adding the ‘-r 48000’ option to mp2enc in the ‘export’ tab of Kino. At last, I have created a DVD that plays correctly.

This process really highlighted to me how far the user-interface problems with Linux have to go. On the other hand, at least I was empowered to do what I needed to do – the open source software made me spend hours figuring out how to make it work, but they were solveable problems. The proprietary solutions (iMovie and iDVD) are undoubtedly more powerful and easy to use, but they did not accomplish the task, because a business manager and a copyright lawyer don’t want to make things easy.

Given the choice, I’ll take the free software. I like freedom.