Creating Menus
Start by creating a new image, the size and dpi depends on what video standard the final DVD adhere to:
- PAL 720×576, 75×80 dpi
- NTSC 720×480, 81×72 dpi
Still menu backgrounds without any motion or animation can be created with GIMP.
Create the menu background in one layer and export it as a JPEG file Now use jpeg2yuv and mpeg2enc to create a MPEG file and multiplex it with an audio file. Menus need at least one audiotrack to work, so if you want a silent menu you have to use an audiofile containing a short burst of silence.
Return to the original image and add another layer and mark out the location of the buttons that can be highlighted. Export that particular layer as a indexed PNG. Make sure you set the colors to four, or three if you’re saving the transparent background as a color.
You can go on and repeat the last step if you want to create a mask that shows what the buttons look like when selected.
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 XML file, use our highlight and selection masks, and multiplexes subtitles into our existing MPEG-2 background stream.
When finished creating all elements of a menu, the background video, all masks and the submux XML file we run it as:
$> spumux menu.xml < input.mpg > output.mpg
The tool takes an MPEG-2 stream as input and spits one back out, with subtitles multiplexed in.
The submux XML file format is as following:
<subpictures>
<stream>
<spu start="start-time"
[ end="end-time" ] [ image="picture.png" ]
[ highlight="picture.png" ] [ select="picture.png" ]
[ transparent="color-code" ] [ force="yes" ]
[ autooutline="infer" [ outlinewidth="width" ]
[ autoorder="rows" | autoorder="columns" ] ]
[ xoffset="x-coord" yoffset="y-coord" ] >
<button
[ label="name" ] [ x0="x0" ] [ y0="y0" ] [ x1="x1" ]
[ y1="y1" ] [ up="label" ] [ down="label" ]
[ left="label" ] [ right="label" ] />
<action [ label="name" ] />
</spu>
</stream>
</subpictures>
The start and optional end attributes describes when the subtitle will be displayed on screen, in “HR:MM:SS.HU”. Defining the start time as zero instructs the DVD player to keep the subtitle on screen continuously.
The image attribute describes the main subtitle image. But normaly when creating a menu you include all the buttons in the background image and only supply a mask for the highlight and/or selection.
The transparent attribute describe which color should become fully transparent if you saved the masks without an alpha channel. The color is in hexadecimal as “RRGGBB”.
To force the display of the subtitle, regardless of whether the user has enabled subtitles or not, you can use the force tag. This is required when making menus.
The button and action tags describe the buttons (visibly selectable objects on the screen) and actions (commands that are executed as soon as the associated key is pressed on the remote).
The label attribute is used to give a button or action an easy to refer to name. By default they are numbered sequentially starting with “1”. The (x0,y0) coordinates describe the upper left hand corner inclusively, while the (x1,y1) coordinates describe the lower right hand corner exclusively. The up, down, left, and right labels describe which button or action should be tied to the corresponding key when the current button is highlighted, though if omitted spumux will use a reasonably intelligent algorithm to determine which buttons to move to.
Here’s an example of the simplest possible submux XML for a menu:
<subpictures>
<stream>
<spu start="00:00:00.00" highlight="menu.png" force="yes"
autooutline="infer" autoorder="rows" />
</stream>
</subpictures>
To aid in button creation, the autooutline attribute instructs spumux to infer where the buttons are located. It does this by attempting to draw rectangles around a composition of the highlight and select images which do not intersect any opaque or semi-opaque pixels. In order to support textual buttons, the attribute outlinewidth allows you to specify the width of the rectangle which is tested. Wider rectangles won’t be able to squeeze between the letters. Finally, autoorder describes which way to order the automatically detected buttons, which is important for numerically selected buttons and for mapping buttons to button labels or to the implied label
If you are using the autooutline feature, just designing buttons, are happy with the inferred button navigation, and can deal with the simplistic labelling system, then you actually do not even need to specify any buttons or actions.
Subtitling
As previously mentioned, a DVD can have up to 32 different subtitle streams in a VTS. Although they’re called subtitle streams, they actually are implemented as overlaid picture files rather than as a text representation, so they can do other things as well.
The submux tool reads in subtitle information from a XML file and multiplexes subtitles into an existing MPEG-2.
The submux XML file format with attributes needed for subtitling is as following:
<subpictures>
<stream>
<spu start="start-time"
[ end="end-time" ] [ image="picture.png" ]
[ transparent="color-code" ] [ force="yes" ]
[ xoffset="x-coord" yoffset="y-coord" ] >
</spu>
</stream>
</subpictures>
Each subtitle image is described by an
When finished creating all subtitle images and the submux XML file we can run it as:
$> spumux menu.xml < input.mpg > output.mpg
The tool takes an MPEG-2 stream as input and spits one back out, with subtitles multiplexed in.
4 comments
Considering you’ve copied some of this from the Linux Journal article by Ian Pointer, you might consider attributing it properly.
Agreed, especially in view of the link to this page you’ve added in a comment to the LJ article!
Here’s is the link to the above-mentioned Linux Journal article:
http://www.linuxjournal.com/article/6953
That link is already included in the post above if you read the fourth paragraph a little bit closer…
Post a comment