Wednesday, September 24, 2008

Command Line DVD Authoring: Part 3

This is part of a multi-part series on creating DVDs manually from the command line. It is not expected that regular users will generally be performing video editing or DVD authoring from the command line. Rather, this guide is intended for programmers who may be wishing to build a front-end for DVD authoring, and don't want to sift through miles of documentaion just to get the basics. This guide makes use of command-line utilities already freely available, but is not meant to be a complete set of documentation for any of these utilities. Instead, consider it a primer. The parts in this series are:

Part 1: Editing a Video File with MPlayer
Part 2: Converting a Video to DVD Format
Part 3: Making a DVD Menu
Part 3.1: Extracting Audio From A Video
Part 4: Building a DVD .iso File

It should be noted that while the programs themselves should remain relatively the same between Linux distros, the name of the packages themselves are likely to change. This tutorial was written using Ubuntu 8.04 as the reference OS, so if you use a different distro, your mileage may vary.

Part 3: Making a DVD Menu

Part 2 dealt with with converting a file to DVD format, with or without the edl files discussed in Part 1. This part talks about taking your newly-edited (and possibly re-encoded) video files and building a menu for them.

There's an excellent suite of tools available for DVD authoring in Linux, called tovid. This package also includes a command, tovid, to convert from one video format to DVD format. The reason I didn't use this command in Part 2 is that as far as I know, it does not support .edl files, and that is key for linear editing.

But that doesn't mean that you shouldn't install tovid. There are a variety of other tools in that package that can be used for other steps of the DVD authoring process. The first of these that we will discuss, makemenu, will help us get our main menu together for our disc. It is possible to author a DVD with no menu, creating a disc that starts playing a video immediately, and then loops when it finishes. I have a commercially-produced DVD like this at home, and it feels like little more than an amateur attempt. Even if you only have one video to play, it's nice to begin with a menu and allow the viewer to start the video when they're good and ready, and when the video ends, it's nice to have it just end.

A typical command line for makemenu might look something like this:

/usr/share/tovid/makemenu -ntsc -dvd -scale \
-background my-background-image.jpg \
-audio my-menu-music.mp3 \
-textcolor '#000000' \
-font Helvetica \
-fontsize 24 \
-align southwest \
-menu-title 'My DVD' 'Show 1' 'Show 2' \
-out my-dvd

You can probably figure out the -ntsc option (there is a -pal option too). We have specified -dvd because we're not interested in creating a vcd or svcd. Both -ntsc and -dvd are defaults. The -scale option is a safeguard, in case you decide to use an image file that isn't exactly a 4:3 aspect ratio. Be careful here, it may make your background image look funny. There is also an option to crop the image to make it fit, but personally, I'll just use an image editing program to do that part.

Next we specify the background image itself. I'll leave that up to you. If you don't specify one, there is a default. You may want to specify some audio too (the default is 4 seconds of silence). I would leave that up to you too, but if you're interested in using audio ripped from your video, check out Part 3.1: Extracting Audio From A Video.

Most of the rest of the options have to do with the text that will show up in your menu. The color of the text is in #RRGGBB format (default is white, #FFFFFF) the default font is Helvetica, and the default fontsize is 24. Align tells makemenu where to actually position the text. Since makemenu uses ImageMagick, it will support any 'gravity' option from ImageMagick (including northwest for the top-left, southwest for the bottom-left, etc)

Next up is the -menu-title option. This will accept a series of arguments, the first one of which is the title of the disc itself. If you don't want to specify a title (I find that sometimes the background image says it all), you can use leave it as ' '. Every argument after that will be the name of each video segment that you provide in the next command line (see Part 4). The last argument, -out, will specify the name of the MPEG2 file in VOB format that will be used on the DVD itself.

Once you have the menu made up, you're just a couple of steps away from actually creating your DVD image. We'll finish up in Part 4: Building a DVD .iso File.

No comments:

Post a Comment

Comments for posts over 14 days are moderated

Note: Only a member of this blog may post a comment.