Creating DVD Menus

VDRsync Main Page

What is this dvd-menu.pl script about?


I wrote this script because I want to integrate DVD-Menu creation in VDRsync and needed a "Wrapper" script that does most of the work, including generation of background pictures.

So I ended up with dvd-menu.pl, and while it is still not easy to use, it is at least possible.
If you follow the examples below it should not be too difficult for you to create DVDs from other sources than VDRsync, I thought it might be a good idea to make it available to other scripting / command-line applications as well.

Prerequisites

  • a recent version of transcode, with ffmpeg support for mpeg2video
  • mplex from the mjpeg tools
  • gd in a version with true-type support (http://www.boutell.com/gd/)
  • the Perl Module GD
  • the Perl Module GDTextUtil
  • dvdauthor with support for the new xml Syntax
  • an True-Type font on your system, it defaults to /usr/X11R6/lib/X11/fonts/truetype/arial.ttf

If you do not have the file arial.ttf at this location you HAVE to supply a font on the command line. Or change the default in the script.
Tested Versions:
  • SuSE 9.0 with multimedia packages from packman.links2linux.de
  • transcode 0.6.11
  • mplex 1.6.1.90
  • gd 2.0.15
  • perl-GD 2.07
  • GDTextUtil 0.86
Here the download link for the script dvd-menu-0.0.1.tgz

QUICKSTART

Prepare an MPEG2 file that can be used by dvdauthor (see "man dvdauthor" if you do not know about this), for example by running
vdrsync.pl -m /Path/to/VDR/Recording/
Optionally prepare a summary text file, and background images to be used in the menus. First a minimal run, just type:
dvd-menu.pl -title vob=remux.mpg -root -run-dvdauthor

where you substitute remux.mpg with your MPEG2 file (it is a good idea to play around with a small one!) This creates very minimalistic DVD Menus with only dummy text and a white background. The oputput is located in vdrsync/ (can be set by the -o option) and can be checked with xine
xine dvd:/Full/Path/To/Current/Dir/vdrsync/VIDEO_TS/

Main DVD Menu

Title Set Menu

Now we supply a title and tell the script to use white fonts
dvd-menu.pl \
-title vob=remux.mpg,title="Männerpension" \
-root title="Männerpension" \
-font-color white \
-run-dvdauthor

This still is pretty rudimentary, but it should give you an idea where the text went.
Main DVD Menu

Title Set Menu

Now a background image for the title set menu is specified , and a text is added to the title set menu:
dvd-menu.pl \
-title vob=remux.mpg,title="Männerpension",text="mit Detlef Buck und Till Schweiger",background=bg.jpg \
-root title="Männerpension" \
-font-color white \
-run-dvdauthor

The Main Menu has not changed, but the title set menu:

Here you can see that the readability of the white text is enhanced by darkening the text area behind the text. While on some pictures this might be a good idea, it can also be turned of.
In addition, the information shown on the title set menu can also be taken from a text file.
The next example shows all this and adds a background image to the main DVD menu:
dvd-menu.pl \
-title vob=remux.mpg,title="Männerpension",text=summary.vdr,background=bg.jpg \
-root title="Filme mit Detlef Buck",background=main.jpg \
-font-color white \
-enhance-text-area 0 \
-run-dvdauthor

Main DVD Menu

Title Set Menu

Additional options:
  • a different font
  • changing the borders of the drawing box
  • putting a slightly enhanced contrast behind the text
dvd-menu.pl \
-title vob=remux.mpg,title="Männerpension",text=summary.vdr,background=bg.jpg \
-root title="Filme mit Detlef Buck",background=main.jpg \
-font-color white \
-enhance-text-area 0 \
-font /usr/X11R6/lib/X11/fonts/truetype/times.ttf \
-borders 100,250,670,556 \
-enhance-text-area 20 \
-run-dvdauthor

Main DVD Menu

Title Set Menu

The -border option is usefull to adjust to your TVs overscan, and it allows to keep areas of the menu text free, for example because you already have a title on the page.
In addition, you can see how to supply a button label to the main menu that is different from the title set title.
./dvd-menu.pl \
-title vob=remux.mpg,title="Männerpension",text=summary.vdr,background=bg.jpg \
-root title=" ",background=alt.jpg,text="Film starten|"  \
-font-color white  \
-font /usr/X11R6/lib/X11/fonts/truetype/times.ttf \
-borders 100,450,670,556 \
-enhance-text-area 0  \
-run-dvdauthor


Unfortunately this means that ALL menus are affected:
Title Set Menu

This is of course not very nice, but you can at least see that the script tries to choose a smaller font to adjust for the limited space (down to 10 pt), and if this is not enough, it starts to shorten the text until it fits.
However, here is the way around (and a general way to work in single steps).
First create one or more title sets (two in this example):
./dvd-menu.pl \
-title vob=remux.mpg,title="Männerpension",text=summary.vdr,background=bg.jpg \
-font-color white  \
-font /usr/X11R6/lib/X11/fonts/truetype/times.ttf \
-enhance-text-area 0  \
-run-dvdauthor

Just start the script again to add another title set:
./dvd-menu.pl \
-title vob=remux.mpg,title="Männerpension 2",text=summary.vdr,background=bg.jpg \
-run-dvdauthor

Now finish the DVD by adding a main menu:
./dvd-menu.pl \
-root title=" ",background=alt.jpg,text="Film 1 starten|Film 2 starten",buttons=2  \
-font-color white  \
-borders 100,450,670,556 \
-run-dvdauthor
Now the options did only affect either the Main Menu or the title set menus!

Title Set Menu 1

Title Set Menu 2

Please note the text= parameter that was passed to the -root option: If you want to assign text to button labels in the Main Menu, you can supply it as a | separated list via the text= attribute of the -root option. Please note also that you have to supply the button number to the -root option, if you build your DVD step-by-step.
The final picture shows a main menu with many titles, an how the scripts tries to adjsts for them:
Main Menu with 10 title sets:

Finally the rest of the README as bundled with the script: README
Have fun, and let me know what you think about the script.
Cheers
Peter