Cookies and Capacitors

Making a video DVD image with the OS X command line

Sat, Dec 6, 2014 at 12:36PM

My grandfather is currently in a hospice, and I found a great movie that I thought he’d like to see: a documentary about sign painters. He used to do sign painting back in the day, and after watching it, I’d like to pick it up myself.

Anyway, when I bought the movie, I was able to download it in a variety of formats. I wanted to put it into my iTunes Library, so I downloaded the 1080p version, which came (expectedly) as an MP4.

Putting this to a DVD was easy, except for one little hiccup that I’ll talk about later.

So anyway, a DVD video is really just an MPEG2, formatted for NTSC or PAL. To convert our video file to this format, we can just use ffmpeg (if you don’t already have this installed, shame on you, it’s one of the most versatile video tools; go grab it).

ffmpeg -i signpainters.mp4 -aspect 16:9 -target ntsc-dvd spdvd.mpg

It’s important to specify an aspect ratio, just on the off chance your video isn’t exactly proportional.

Next, we’re going to use dvdauthor to make a DVD file structure. You probably don’t have this installed, but it’s available in MacPorts for OS X users, and most Linux repositories.

mkdir dvd

dvdauthor -o dvd/ -t spdvd.mpg

Now, here’s where the trouble starts. Normally, you would need to create a “Table Of Contents” for the DVD structure, but unless we set an environment variable for the video format, dvdauthor is going to complain. I had to search through mountains of mailing list problems to figure this out. So, we’ll set that environment variable…

export VIDEO_FORMAT=NTSC

…and now we can generate the table of contents.

dvdauthor -o dvd/ -T

Great! Now we have the structure, the final step of this process is to make a burn-able DVD image. For this, we’ll use mkisofs which is available as part of the cdrtools package in MacPorts.

mkisofs -dvd-video -V SignPainters -o spdvd.iso dvd/

And we’re done! Either test your ISO in VLC Media Player, or burn it to a disc. dvdauthor is also able to generate menus for your DVDs, so read the documentation if you’d like to do that.