Creating a DVD with a menu
How to Create a DVD with a Menu
Check out the attached shell script attachment:dvd-automenu.bash.ksh for an experimental way to do this automatically using netpbm and ffmpeg, it creates a menu with no manual interactions directly from the video files and text description files extracted from the database:
1. Creating a Menu
I find this to be the most difficult part of creating a DVD with a menu. Basically, you have to capture or create a background image with the appropriate resolution. Then, mplex that together with an audio file (typically empty sound, though you can use sound) and then create overlay images that show 1) the menu text, 2) the buttons when highlighted, and 3) the buttons once selected. You then use spumux to combine the background video with the overlay menus.
The background image must be saved as JPG and the overlay images must be PNG with only three colors used (four colors are allowed, but the transparent background counts as one of those colors). For this how-to, the background file is called menu.jpg, the menu text is called menu1.png and the highlighted and selected buttons are the same and called menu2.png.
Create a Background
To get a background image, I use avidemux2 and find the frame that I want to use as a background image. I then save the frame as menu.jpg by going File -> Save -> Save JPG Image. Or you can create your own background image in the GIMP. Use the following settings:
For NTSC Video
Convert the background JPG file into a M2V video file
jpeg2yuv -n 50 -I p -f 29.97 -j menu.jpg | mpeg2enc -n n -f 8 -o menu.m2v
For PAL Video
Convert the background JPG file into a M2V video file
jpeg2yuv -n 50 -I p -f 25 -j menu.jpg | mpeg2enc -n p -f 8 -o menu.m2v
Merge the background you just created with audio
You will have to have some sort of audio to mplex with the M2V file you just created, so either capture some audio using avidemux2 or another program, or to create empty audio to mplex, use this command
dd if=/dev/zero bs=4 count=2000 | toolame -b 128 -s 48 /dev/stdin menu.mp2
This command requires that you have toolame installed, of which I had difficulty finding any packages other than source. It's a hack, but I would just try and find a period of silence at least one second long in a PVR-250 recording and save that using avidemux2.
Merge the M2V video with the MP2 audio
mplex -f 8 -o menu.mpg menu.m2v menu.mp2
Create the menu buttons in PNG files
The next step is to create the PNG files. This is another step that I find difficult to explain and the steps here are not the cleanest way, but they work for me. If anyone can describe a better way of doing this, please do.
A. Open the background menu.jpg file in the GIMP. Add a transparent layer over the background and mark where you will want the different buttons to be located. This layer will later be deleted, so it doesn't have to be clean. When creating this layer, use all the colors you want to use with your buttons. Remember, no more than three colors.
B. Delete the Background layer.
C. Change the image to an indexed color mode. Do this by right-clicking on the image and selecting Image -> Mode -> Indexed. Enter "4" in the number of colors.
D. Create two new layers.
E. In the top layer, you will enter the text for your buttons. Select the color you want for your text either in the color palette or by using the Color Picker Tool. To use the Color Picker, you must make sure you have that bottom layer selected. Enter the text for all the buttons on the top layer according to whatever layout you decided on.
F. Now you will create the actual buttons by drawing boxes around the text and filling that area with the Color Fill Tool. Be sure and select the color you want (contrasting to the text) and to create your boxes in the second from the top layer.
G. Delete that bottom layer that I told you we would eventually delete.
H. Save the current image as menu2.png. Do that by right-clicking and selecting File -> Save as, and make the name menu.png. Click "Export" and make sure that "Save Background Color" and "Save Resolution" are selected.
I. Select the bottom layer and change the Opacity to 0%. Now save the image as menu1.png.
Create the final menu video
To create the DVD menu, an XML file is used. An example menu.xml file is shown below. The autoorder line is used to decide what takes precident for ordering. If your buttons are ordered primarily by rows, then select "rows". If your ordering is by column, then choose "columns".
###menu.xml### <subpictures> <stream> <spu force="yes" start="00:00:00.00" image="menu1.png" select="menu2.png" highlight="menu2.png" autooutline="infer" outlinewidth="6" autoorder="rows" > </spu> </stream> </subpictures> ###end menu.xml###
Then create the final menu with
spumux menu.xml < menu.mpg > menu_final.mpg
You should see some lines in the output to the console that show
INFO: Autodetect ...
The number of these lines that you see should be the same number of buttons you created. If there are, then good job!
2. Authoring the DVD
To create the dvd structure, an XML file is used. The below file is an example dvd.xml file. This example file allows for the 4 buttons in the menu created earlier and has three video segments making up each of the 4 video titles. Each of the separate video segments will be treated as separate chapters of one consistent video title.
### dvd.xml ### <dvdauthor dest="DVD"> <vmgm> <menus> <pgc> <button>jump title 1;</button> <button>jump title 2;</button> <button>jump title 3;</button> <button>jump title 4;</button> <vob file="menu_final.mpg" pause="inf" /> </pgc> </menus> </vmgm> <titleset> <titles> <pgc> <post>call vmgm menu 1;</post> <vob file="1a.mpg" /> <vob file="1b.mpg" /> <vob file="1c.mpg" /> </pgc> </titles> </titleset> <titleset> <titles> <pgc> <post>call vmgm menu 1;</post> <vob file="2a.mpg" /> <vob file="2b.mpg" /> <vob file="2c.mpg" /> </pgc> </titles> </titleset> <titleset> <titles> <pgc> <post>call vmgm menu 1;</post> <vob file="3a.mpg" /> <vob file="3b.mpg" /> <vob file="3c.mpg" /> </pgc> </titles> </titleset> <titleset> <titles> <pgc> <post>call vmgm menu 1;</post> <vob file="4a.mpg" /> <vob file="4b.mpg" /> <vob file="4c.mpg" /> </pgc> </titles> </titleset> </dvdauthor> ### end dvd.xml ###
Create the DVD file structure with
dvdauthor -x dvd.xml
Test the created DVD file structure with
Then burn the DVD file structure to a dvd with
growisofs -Z /dev/scd0 -dvd-video DVD
Use MythBurn script as an alternative
MythBurn is a script that can be activated via MythWeb. It allows you to select recordings within MythWeb and modify the menu slightly.
There are screen shots and a guide on how to install MythBurn on MythBurnInstallation