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:
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
- the menu text
- the buttons when highlighted
- and 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
width: 720 height: 480 x-axis: 81dpi y-axis: 72dpi
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
width: 720 height: 576 x-axis: 75dpi y-axis: 80dpi
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
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.
- 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.
- Delete the Background layer.
- 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.
- Create two new layers.
- 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.
- 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.
- Delete that bottom layer that I told you we would eventually delete.
- 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.
- Select the bottom layer and change the Opacity to 0%. Now save the image as menu1.png.
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 precedent for ordering. If your buttons are ordered primarily by rows, then select "rows". If your ordering is by column, then choose "columns".
Then create the final menu with
# spumux menu.xml < menu.mpg > menu_final.mpg </nowiki></code>
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!
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.
Create the DVD file structure with
# dvdauthor -x dvd.xml
Test the created DVD file structure with
# xine dvd:/full/path/to/DVD/VIDEO_TS/
Then burn the DVD file structure to a dvd with
# growisofs -Z /dev/scd0 -dvd-video DVD
Use MythBurn script as an alternative
There are screen shots and a guide on how to install MythBurn on MythBurnInstallation