Home DVD Howto

How to make a DVD of home movies in Linux using tovid and makedvd. This is a description of the process as I do it. Your method may vary. You need basic Linux/unix scripting knowledge, command-line familiarity, and should know how to edit simple XML files. A slight knowledge of Perl will be handy. Knowledge of XML, scripting, and Perl can be substituted with intelligence and a good ability to extrapolate.

If this work for you, fine. If this delete all your stuff, don't blame me. This is for experts. And it relies on tovid and imagemagick and the Perl GD library, if not more stuff.

Don't use this at all. None of the text here or anywhere else should be taken to imply that you should use my scripts or methods.

Here's a tarball of my DVD authoring scripts. (and a github copy) See bottom of page for changelog, history. Put the contents in ~/dvdauthoring (that's what I assume below).

Start and end points

I'm going to assume, because that's how I have things, that you have a bunch of raw DV files in directories. The filenames will be like this: 2008.08.31_22-07-29.dv, that is, year, 2-digit month, 2-digit date, and two-digit, 24-hour, to-the-second, times. With the "dv" extension. They're in directories by month, although this isn't necessary, but I put them in 200808 for August 2008, for example.

Each directory has a "desc.txt" file formatted like this:

2008.08.31_22-07-29 Short description of video
2008.08.31_22-07-29.dv

So that each video file is a 2-line entry.

The DVD has a root menu from which you can choose "Play all" to play all the videos on disc, or choose a sub-menu. The sub-menu will have all the videos from a directory, to a maximum of 9 or so (the scripts automatically make multiple sub-menus if the videos won't fit), along with a "play all" which plays all the videos in that sub-menu.

It's best to have each directory contain a maximum of 9 videos, so that each directory produces only one sub-menu. It simplifies things later. So, you could have 200808-1 containing 6 videos and 200808-2 containing 5. If you had just 200808, with all 11 videos in it, you'd get a menu for the first 9, and then a 2nd menu for the remaining 2. By making 2 directories, you get a more balanced set of menus.

In addition to all those directories, I have a rootmenu/ directory where I build the DVD's root menu. This contains a Makefile and an mkimg.pl file.

The scripts I have eventually build a Dvd.xml file which is used by the makedvd command to create a DVD filestructure. This is then burned to DVD.

Assume all this activity takes pace in a dvd/ directory somewhere, so you have dvd/Dvd-basic.xml, and directories dvd/200808-1/, dvd/200808-2/, dvd/rootmenu/, and so on.

Creating the DVD videos

(Note: see Shortcut below, but read these sections anyway.)

Your raw videos aren't in DVD format. Convert them by this command (go to each directory and do it):

for r in *.dv; do tovid -in $r -out $r -ntsc -dvd -noask;done

This will take a long time. Note that this will produce NTSC video. If you want PAL, use -pal instead of -ntsc.

Creating the menus

Now we use the vid2dvd.pl script that I've provided. In each directory of videos, you'll have to do something like this:

perl ~/dvdauthoring/vid2dvd.pl -t ntsc -l 200808-1/ > t.sh

Assume that command is run in the dvd/200808-1/ directory.

Call that script with no options (perl ~/dvdauthoring/vid2dvd.pl) and you should get the usage help message. -t tells it to make PAL or NTSC menus. -b gives it a background image to use for the menu. "-s 1" makes it create subtitles out of the desc.txt file, so that enabling subtitles shows the description while the video plays. This option will work over the videos created by tovid again, so could cause more delays. I don't use it any more.

If you let vid2dvd create multiple sub-menus from one directory (instead of having just enough videos in each directory for each sub-menu, so that each sub-menu corresponds to exactly one directory of videos) then it can happen that you get almost all videos on one sub-menu and then the 2nd page has only 1 video. That's lame, but using "-f 1" forces vid2dvd to cram an extra title onto each sub-menu.

The -l option gives a prefix for the current directory relative to where the Dvd.xml file is going to be. In our example so far, the Dvd.xml file is going to be in the same directory, i.e. at the same level, as the 200808* directories. So "-l 200808-1/" makes sense. You could also put the video directories somewhere else, such as in videos/, so you'd have "-l videos/200808-1/" instead. It's a path relative to the Dvd.xml file.

The -p option gives a page offset number. If this directory's sub-menu is going to be the 3rd sub-menu, you should use "-p 2".

Once you've created the t.sh file, run it with the command "sh t.sh" (no quotes, of course). That'll create a menu/ directory under 200808-1, since we're in 200808-1. This menu/ will contain the sub-menus for this directory of videos, and is not the same as dvd/menu/. It'll also create one or more dvdpage*.xml files. (Only one if you make sure to have 9 or less videos per directory).

Shortcut to previous two steps

Instead of "Creating the DVD videos" and "Creating the menus", you can use the make-dvd-xml.sh script. Edit it so that the first for loop covers all the directories with the video files. Set the type to pal or ntsc (1st line). Fix the line that says "perl ~/dvdauthoring..." if necessary. You'll need to have the Dvd-basic.xml file ready.

To use this script, you have to make sure each directory contains 9 or less videos, and you have to edit the Dvd-basic.xml file to contain the appropriate commands (see the one included in the tarball).

This script goes in your dvd/ directory. Once you run it (it takes a long time to run as it converts the videos too), everything should be ready except the root menu.

sh ./make-dvd-xml.sh

The root menu

The root menu is built in the dvd/rootmenu/ directory. Copy the contents of ~/dvdauthoring/menu-example there. Edit the mkimg.pl file to alter the strings in there so that it contains your main menu's titles, aside from "Play all". Keep them short if there are 10 or more, as it will make 2 columns in that case. And fix the line that says "use lib" to point at your ~/dvdauthoring directory.

In the rootmenu/ directory, run ONE of these commands:

make pal palvideo clean
make ntsc ntscvideo clean

Making the DVD

In the dvd/ directory, you can say this to build the DVD filesystem:

dvdauthor -x Dvd.xml
du -sch dvdfs
genisoimage -dvd-video -o dvd.iso dvdfs

The second command above tells you the total size of the DVD, so you can make sure it fits. The third command builds an ISO file.

Once you insert a blank dvd, use this command to burn it (you may need to specify a device like /dev/dvdrw with "-device /dev/dvdrw"). Or you can use your favorite burning software like k3b or whatever.

wodim -v speed=1 dvd.iso
speed=1 sets the burn speed to the lowest possible, giving you a more reliable burn. Omit that option to use the default speed. -v makes wodim tell you what's happening, otherwise it's too quiet.

Cleanup

You can remove the dvd/menus/ directory, and the dvd/rootmenu/menu.mpg file. You can also remove the entire dvd/dvdfs/ directory, the mpg files created in each video directory, and the Dvd.xml file.


Changelog:

May 3 2012
ffmpeg needs a -ar option to make silent ac3 files from /dev/zero. Fix tovid command line for new version. Move menu watermark image a little away from edge. make clean should clean better.
Jun 23 2010
Revision 6. Uses Perl GD library to generate all the text menus. Streamlined a *little* bit.
Apr 24 2009
Changed the DVD generation and burn commands. Changed the sample XML file to use the g3 register correctly (see tarball).

This page was first created Oct 4 2008.