HowTo build a DVD menu, by JSC

Content

Prolog

I have searched many days to find any information how to build DVD menus. Mostly i found "You can do it with gimp", but nobody has written how. So this HowTo will explain how i build menus based on my novice level knowledge of gimp ;-) and a working example!
If you have some hints, how to do some things better, faster, simplified or the best - do it automatic - please drop me a note over the avidemux forum.

My DVD will contain a starting trailer before the DVD menu. Than you will see a menu with DVD title and subtitle, thumbnails and title of each video. You can select a thumbnail and choose to start the video. If the video ends, you will come back to the menu again.
Because i'm capturing a TV series, i will have mostly 5 videos on one DVD. Keep in mind that you can choose as many videos as you want. It's just an example. There are unused layers in the dxf file for a 4 video DVD menu also.

My structure on harddisk

To understand all the files and paths here an overview of my directory organisation:

project_dir/
project_dir/mpegs/             # the video files - video: 720x576 MPEG2, audio: 48kHz MP2
project_dir/mpegs/video1.mpg
project_dir/mpegs/video2.mpg
project_dir/mpegs/video3.mpg
project_dir/mpegs/video4.mpg
project_dir/mpegs/video5.mpg
project_dir/dvd_stuff/         # the trailer and menu help files
project_dir/dvd_stuff/Makefile
project_dir/dvd_stuff/dvd_menu.xcf
project_dir/dvd_stuff/dvd_menu_background.jpg
project_dir/dvd_stuff/dvd_menu_background_submuxed.mpg
project_dir/dvd_stuff/dvd_menu_highlight.png
project_dir/dvd_stuff/dvd_menu_selected.png
project_dir/dvd_stuff/dvd_menu_submux.xml
project_dir/dvd_stuff/dvdauthor.xml
project_dir/dvd_stuff/trailer.mpg
project_dir/dvd_stuff/video1-1.jpg
project_dir/dvd_stuff/video1-2.jpg
project_dir/dvd_stuff/video2-1.jpg
project_dir/dvd_stuff/video3-1.jpg
project_dir/dvd_stuff/video3-2.jpg
project_dir/dvd_stuff/video4-1.jpg
project_dir/dvd_stuff/video4-2.jpg
project_dir/dvd_stuff/video5-1.jpg
# created by the process ...
project_dir/dvd_content/       # here will dvdauthor place the DVD tree
project_dir/dvd_content.img    # toast THIS to DVD-R

To get a working structure on other computers too, i'm working with relative path values. Please note, that the working directory for all described commands is the "project_dir/dvd_stuff/" directory.

You can download the tree here.

If you wish to play with some dummy data, you could run:

$ make example_data
in the "project_dir/dvd_stuff/" directory. It will create:
project_dir/mpegs/video1.mpg
project_dir/mpegs/video2.mpg
project_dir/mpegs/video3.mpg
project_dir/mpegs/video4.mpg
project_dir/mpegs/video5.mpg
project_dir/dvd_stuff/trailer.mpg
project_dir/dvd_stuff/video1-1.jpg
project_dir/dvd_stuff/video1-2.jpg
project_dir/dvd_stuff/video2-1.jpg
project_dir/dvd_stuff/video3-1.jpg
project_dir/dvd_stuff/video3-2.jpg
project_dir/dvd_stuff/video4-1.jpg
project_dir/dvd_stuff/video4-2.jpg
project_dir/dvd_stuff/video5-1.jpg

Step 1 - The trailer

The captured TV series in my case has a trailer 3-5 minutes after the begin in each video. I'm simply will copy this trailer and place it before the DVD menu.

Open "../mpegs/video1.mpg" in avidemux2 and index it if needed. Choose the start frame of the trailer as ">A" and the end of the trailer as "B<". Use "File -> Save -> Save as DVD PS" to save the file as "../dvd_stuff/trailer.mpg". Quit avidemux2.

Step 2 - Thumbnails

I will use a characteristic picture from each video as reference point in the menu. It is not so ugly/simple as a point or circle and not so complex to handle like a frame around dynamic text.

Open the first video "../mpegs/video1.mpg" in avidemux2, scroll through the film and search for a characteristic frame. I'm using the percent-bar for "fast playing" the video. Keep the mouse-button down and move it slowly. So you get really fine jumps through the stream.

You should search for a bright frame. It will have the best contrast in front of the black background. If you have found the right frame, just save it as jpg file. Use <Ctrl> + <j> and save it as "../dvd_stuff/video1-1.jpg". If there are other important frames, save it as "video1-2.jpg", ... we will decide later which is the best.

Do for same for video2.mpg .. video5.mpg.

Now we have at least 5 pictures in clear quality and of the format 720x576 pixel. Because we use the ready mpeg files, they are already handled by crop, add border, deinterlace, smooth-filters, ... of avidemux2. The pictures are good, but are to big in visible size.

To scale the pictures down to thumbnails, use:

$ convert -scale 144x115 infile.jpg outfile.jpg
for every generated picture.
If you use my naming scheme, simple type:
$ make
video1-1.jpg 720x576 => 144x115
video1-2.jpg 720x576 => 144x115
video2-1.jpg 720x576 => 144x115
video3-1.jpg 720x576 => 144x115
video4-1.jpg 720x576 => 144x115
video5-1.jpg 720x576 => 144x115
[some notes]
$ 

Step 3 - Customize the gimp template

$ gimp dvd_menu.xcf

Step 4 - Export the source files for the menu

$ gimp dvd_menu.xcf

Step 5 - Build the menu

A DVD menu is not static. It is a MPEG2 stream with video and audio data. If the streams ends, it will be played from start again. To build a video without audio, i'm using:

# jpg to MPEG2 video
$ jpeg2yuv -n 50 -I p -f 25 -j dvd_menu_background.jpg | mpeg2enc -n p -f 8 -o dvd_menu_background.m2v

# generate silent mp2 audio # no audio is not valid, but silence is ok ;-)
$ dd if=/dev/zero bs=4 count=1920 | toolame -b 128 -s 48 /dev/stdin dvd_menu_background.mp2

# build the MPEG PS stream
$ mplex -f 8 dvd_menu_background.m2v dvd_menu_background.mp2 -o dvd_menu_background.mpg

To insert the button information into this stream, i use:

$ cat dvd_menu_submux.xml
<subpictures>
  <stream>
    <spu start="00:00:00.0" end="00:00:00.0"
         highlight="dvd_menu_highlight.png"
         select="dvd_menu_selected.png"
         autooutline="infer"
         force="yes"
         autoorder="rows"/>
  </stream>
</subpictures>
$ vi dvd_menu_submux.xml    # if needed
$ spumux dvd_menu_submux.xml < dvd_menu_background.mpg > dvd_menu_background_submuxed.mpg

If you use my naming scheme, you would do both (building mpg file and insert button infos) by running:

$ make
[many output]
[some notes]
$

Step 6 - Author the DVD

The structure of the DVD is described in "dvdauthor.xml". I wish to play the trailer and call the menu then. The selected thumbnail should call the related mpeg video. After the end of this video, then menu should be visible. My DVD player has no real fast forward mode. So i wish to have jump references all 5 minutes.

$ cat dvdauthor.xml 
<dvdauthor dest="../dvd_content/">
   <vmgm>
      <menus>
         <pgc>
            <vob file="trailer.mpg"/>
            <post> jump titleset 1 menu; </post>
         </pgc>
      </menus>
   </vmgm>
   <titleset>
      <menus>
         <pgc>
            <button> jump title 1; </button>
            <button> jump title 2; </button>
            <button> jump title 3; </button>
            <button> jump title 4; </button>
            <button> jump title 5; </button>
            <vob file="dvd_menu_background_submuxed.mpg" pause="inf"/>
         </pgc>
      </menus>
 
      <titles>
         <pgc>
            <vob file="../mpegs/video1.mpg" chapters="0,5:00,10:00,15:00,20:00,25:00,30:00,35:00" pause="3" />
            <post> call menu; </post>
         </pgc>
  
         <pgc>
            <vob file="../mpegs/video2.mpg" chapters="0,5:00,10:00,15:00,20:00,25:00,30:00,35:00" pause="3" />
            <post> call menu; </post>
         </pgc>
  
         <pgc>
            <vob file="../mpegs/video3.mpg" chapters="0,5:00,10:00,15:00,20:00,25:00,30:00,35:00" pause="3" />
            <post> call menu; </post>
         </pgc>
 
         <pgc>
            <vob file="../mpegs/video4.mpg" chapters="0,5:00,10:00,15:00,20:00,25:00,30:00,35:00" pause="3" />
            <post> call menu; </post>
         </pgc>
         <pgc>
            <vob file="../mpegs/video5.mpg" chapters="0,5:00,10:00,15:00,20:00,25:00,30:00,35:00" pause="3" />
            <post> call menu; </post>
         </pgc>
      </titles>
   </titleset>
</dvdauthor>
$ dvdauthor -x dvdauthor.xml
The structure is prepared, you should check the stuff with "ogle" now:
$ ogle ../dvd_content/
But remember: ogle has timing issues (buttons come earlier than background) and confused colors (the left line of the frame around the thumbnails has sometimes another color than red) sometimes and in my version used. Not all effects you see in ogle, are also visible on your dvd player!

Now you can build a DVD image:
$ mkisofs -dvd-video -o ../dvd_content.img ../dvd_content/

If you use my naming scheme, you can handle the complete step by running:

$ make vdvd
dvdauthor -x dvdauthor.xml
DVDAuthor::dvdauthor, version 0.6.10.
Build options: gnugetopt iconv freetype
Send bugs to <dvdauthor-users@lists.sourceforge.net>

INFO: Locale=C
INFO: Converting filenames to ANSI_X3.4-1968
INFO: dvdauthor creating VTS
STAT: Picking VTS 01

STAT: Processing dvd_menu_background_submuxed.mpg...

INFO: Video pts = 0.184 .. 2.184
INFO: Audio[8] pts = 0.144 .. 0.192
INFO: Audio[32] pts = 0.184 .. 0.184
STAT: VOBU 4 at 0MB, 1 PGCS
INFO: Generating VTSM with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x576
INFO: Audio ch 0 format: mp2/2ch, 48khz 20bps

STAT: Processing ../mpegs/video1.mpg...
STAT: VOBU 16 at 0MB, 5 PGCS
INFO: Video pts = 0.184 .. 15.184
INFO: Audio[8] pts = 0.144 .. 0.456

STAT: Processing ../mpegs/video2.mpg...
STAT: VOBU 41 at 1MB, 5 PGCS
INFO: Video pts = 0.184 .. 15.184
INFO: Audio[8] pts = 0.144 .. 0.456

STAT: Processing ../mpegs/video3.mpg...
STAT: VOBU 66 at 2MB, 5 PGCS
INFO: Video pts = 0.184 .. 15.184
INFO: Audio[8] pts = 0.144 .. 0.456

STAT: Processing ../mpegs/video4.mpg...
STAT: VOBU 91 at 3MB, 5 PGCS
INFO: Video pts = 0.184 .. 15.184
INFO: Audio[8] pts = 0.144 .. 0.456

STAT: Processing ../mpegs/video5.mpg...
STAT: VOBU 116 at 4MB, 5 PGCS
INFO: Video pts = 0.184 .. 15.184
INFO: Audio[8] pts = 0.144 .. 0.456
STAT: VOBU 125 at 5MB, 5 PGCS
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x576
INFO: Audio ch 0 format: mp2/2ch, 48khz 20bps

STAT: fixed 4 VOBUS                         
STAT: fixed 125 VOBUS                         
INFO: dvdauthor creating table of contents
INFO: Scanning ../dvd_content//VIDEO_TS/VTS_01_0.IFO
INFO: Creating menu for TOC

STAT: Processing trailer.mpg...
STAT: VOBU 16 at 0MB, 1 PGCS
INFO: Video pts = 0.184 .. 15.184
INFO: Audio[8] pts = 0.144 .. 0.456
STAT: VOBU 25 at 1MB, 1 PGCS
INFO: Generating VMGM with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x576
INFO: Audio ch 0 format: mp2/2ch, 48khz 20bps

STAT: fixed 25 VOBUS                         
mkisofs -dvd-video -o ../dvd_content.img ../dvd_content
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 4096
Path table size(bytes): 42
Max brk space used 4124
3616 extents written (7 Mb)

Please verify DVD structure with:
ogle ../dvd_content