Write a DVD-Video from the Linux console

31 December 2007

This is probably my last post for this year, and it’s not about Ruby on Rails! Or web development! It’s about how to burn a DVD-Video from the Linux console.

I know, there are tons of fancy apps (with a decent GUI) that allow you to create DVD-Video disks from Gnome or KDE. But, my Linux machine has no monitor attached and I don’t care for hogging up resources by running X.

All you really need to burn a DVD-Video is one packages: dvd+rw-tools. If you’re on Debian or Ubuntu, just run this:

apt-get install dvd+rw-tools

So, I have this VIDEO_TS folder and a blank DVD in my DVD driver (which is known to my system as /dev/sr0). To make a correct DVD, you’ll also need an AUDIO_TS folder. It doesn’t matter if it’s empty, it should be there.

I’m assuming you’re all doing this as root. If not, just add ‘sudo’ in front of every command you perform

mkdir AUDIO_TS

Next, we need to set the correct permissions on the VIDEO_TS, AUDIO_TS and the files contained in these directories.

chown -R root:root VIDEO_TS AUDIO_TS
chmod 500 VIDEO_TS AUDIO_TS
chmod 400 VIDEO_TS/*

Well, you already have all your files prepped, and you’re good to go.

The following command will burn you a nice video DVD. Make sure a blank DVD is inserted into your drive. As I said before, my drive is located at /dev/sr0. You system is probably different. Check your boot log (dmesg) for messages of a dvd driver.

growisofs -dvd-compat -Z /dev/sr0 -dvd-video .

It’s very important not to forget the tailing dot, it tells growisofs that you want to use the current directory as the source for your DVD. Depending on the speed of your burner, you’ll have a new DVD to watch in a few minutes. Enjoy! And a happy 2008!