DVD Authoring

Trick out home videos with a fun, featureful menu system that viewers can navigate from a regular DVD player.
Processing Pictures

In order to make the slideshows, we need to transform the pictures into video clips. The mjpegtools suite includes a utility called jpeg2yuv that transforms a JPEG file into YUV (a color model used for video pictures) format, which then can be piped into mpeg2enc to generate an MPEG-2 video file. Before this transformation happens, though, we need to make sure the picture files are formatted correctly for DVD. It is advisable to alter your pictures manually to fit the PAL or NTSC resolution constraints (720×576 and 720×480, respectively) before feeding them into jpeg2yuv. mjpegtools includes a utility called yuvscaler that automatically resizes incoming YUV data into the correct resolution, but this can alter the aspect ratio of your pictures and cause distortion.

A sample command line to generate a slide looks like this:

jpeg2yuv -n 125 -I p -f 25 -j picture1.jpg | \
mpeg2enc -f 8 -o slide.mpg

The -n option tells jpeg2yuv how many frames it should generate, in this case 125 (5 seconds at 25fps); you should use 29.97 for NTSC. The -I option tells it to use progressive interlace (rather than throwing parts of the image away), and -f sets the required frame rate. The -f option to mpeg2enc tells it to create a DVD MPEG-2 video stream. This process needs to be repeated for all the photos to be included on the DVD, so you might want to write a quick Perl or shell script to automate this process.

Adding Music

Now we have video clips of separate slides. The next step is to add a music backing track that plays across each clip. The DVD specification allows for the use of PCM, AC-3 or MPEG-2 audio, at various bit rates. For the photo album, I decided to use MPEG-2 audio; I decided that I didn't need the higher audio quality of AC-3 or PCM. mjpegtools includes a tool called mp2enc that encodes WAV files in MPEG-2 format. Another tool from mjpegtools, mplex, multiplexes one or more audio files into a video MPEG stream. To do multiple audio files, you need the CVS version of mjpegtools. Start by concatenating all the video files required for a particular slideshow using cat, as mplex seems to have problems with handling multiple input files:

cat *mpg > video.mpg

In the title5 directory (the fifth title is going to have two audio tracks), I ran mplex on this new file:

mplex -f 8 -o video%d.mpg photos/set5/video.mpg \
audio1.mp2 audio2.mp2

This creates a series of files called video1.mpg, video2.mpg, ..., videoN.mpg in the current directory, multiplexed with the two audio tracks, audio1.mp2 and audio2.mp2. The -f 8 argument to mplex ensures that the new MPEG files are DVD-compatible, the same as mpeg2enc.

One issue to be aware of is that mplex multiplexes the whole audio track. If the track is longer than the combined length of the video clips, then the final clip is extended to cover the rest of the audio. You may want to adjust the frame times in jpeg2enc phase or edit the audio track to prevent this from happening.

Making Menus

The process for creating DVD menus is similar to generating the slides. Using The GIMP, make a new image of size 720×576 (for PAL), with a resolution of 75dpi in the x-axis and 80 in the y-axis (NTSC values are 81 and 72). Add an alpha channel, then create the menu picture you desire (see Figure 1 for the base image of the main menu). Once this is finished, add another layer and mark out the location of the buttons that can be highlighted, as seen in Figure 2. A maximum of four colors can be used for this mask; I used red to mark the button areas, and white to make sure that the text still was visible when a button was selected. When you're satisfied with the menu, export the background layer as a JPEG file and the mask as an indexed PNG. Make sure you've set the number of colors to four, three if you're saving the transparent background as a color. This process is repeated for all menus required in the DVD (see Figures 3 and 4 for a further example).

Figure 1. The Main Menu Image

Figure 2. Making the Main Menu Mask

Figure 3. A Submenu with Thumbnail Previews

Figure 4. The Mask for the Submenu

As before, use jpeg2yuv and mpeg2enc to create an MPEG file, and mplex to multiplex it with an audio file. For some reason, menus need an audio file to work, so if you want silent menus, you have to use a short burst of silence. Buttons in DVD are implemented as part of the subtitle stream, so we use dvdauthor's submux tool to define a menu's buttons. The program reads in subtitle information from a text file and multiplexes it into the video stream. The format of the submux files looks like this:


<file_name> <start_time> <end_time> <x_offset> \
<y_offset> <4 8-bit numbers>

There can be multiple entries in a .sub file, but only one line is required for the menus:

mainmask.png 00:00:00.00 00:00:00.00 0 0 0 1 0 1

Defining the start and end times as zero instructs the DVD player to keep the subtitle on screen continuously. The 0 1 0 1 sequence turns the selected button red when using the default palette file supplied with dvdauthor. The four different numbers (from 0–255) control the transparency values of the colors in the indexed PNG. You might want to experiment with these values to see what effects you can create, but the sequence above seems to produce reasonable results. Having made a subtitle file, we then run submux to add the subtitles to the video stream:


submux menu.sub < video.mpg > menu.mpg

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

The tutorial was great, but I

JR's picture

The tutorial was great, but I am still confused about something. I wanted to know more about the process of authoring a DVD to work on as many players as possible. This was still about creating cool menus and stuff like that. Where do I read more about the authoring process? Thanks.

latest advancements

crackpipe's picture

Still one of the best tutorials out there, all these years later. I wonder if there is a similar tutorial written recently with the latest linux command line and gui front-ends for authoring and editing. I've found the devil is in the details with linux authoring. It takes several tools to get the background music and menus to be just right. Or wipes and graphics. These tools seem to be around in windows so I know there must be much better linux analogues?

Bake your own!

Marcus Brown's picture

You might like to check out an application I've written that does the work for you:
http://dvd-baker.sourceforge.net/

A other tutorial

Brunetton's picture

Here is a other tutorial, in French this time. May be usefull

http://brunetton.tuxfamily.org/index.php?n=En.SimpleDVD

Although dvdauthor doesn't ha

Anonymous's picture

Although dvdauthor doesn't have the easy-to-use interface of professional applications,

This is insulting. Although many new-media monkeys today use point and drool applications in a professional setting, a professional applications is quite likely to have a scriptable "small and sharp tool" interface that will allow it to be automated, pipelined or in some other way made to fit the working environment and methods.

The programmer(s) can't know how (another) user will use the tools and should make no assumptions! And it is particularly the professionals that need to be able to throw away repetitive wizards and other joe random user interfaces and make work after work happen the right way. Every time. And when a change is needed, you make the change and only the change and re-run the process etc.

Maybe Milk of Magnesia would

Anonymous's picture

Maybe Milk of Magnesia would help you.

DV tape w. DateTime > Subtitle in Linux ?

Anonymous's picture

Is there any programs for linux that grabs the datecode from a dvstream and creates subtitles accordingly ?

I've been using DV sub maker for windows to grab the datetime but would like to go linux.
- http://icqphone.ru/video2tv/

chris

Re: DV tape w. DateTime > Subtitle in Linux ?

Anonymous's picture

You can try http://dv2sub.sf.net

Re: DVD Authoring

Anonymous's picture

I've posted a DVD Authoring on Linux primer at my website. It's still a work in progress but might be usefull to others as it is.

--
Anders Dahnielson

Re: DVD Authoring

ianpointer's picture

Just a couple of points:

I got mixed up between Japan's placement in Region 2 and what TV format it uses. Although the country is in Region 2 like Europe, it uses NTSC instead of PAL/SECAM. Apologies for that error.

Secondly, in the time since I wrote this article, the dvdauthor team have been busy improving the application. One of the main changes has been to switch to using XML to lay out the title information, thus eliminating some of the huge command-lines in my tutorial. They have a brief guide to the new format here.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState