dvd-menu.pl (c) 2004 Dr. Peter Sebbel A helper script for the automated generation of Video-DVD containing menus using dvdauthor. Synopsis dvd-menu.pl [-enhance-text-area NN] [-font /path/to/font.ttf] [-o output_dir] [-run-dvdauthor] [-borders x1,y1,x2,y2] [-font-color black¦white] [-title Option1,Option2] [-root Option1,Option2] If you are really impatient skip down to Quickstart. But if you encounter problems, read this full text before asking things that are already answerd here. Description 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. WARNING: Yesterday I tried without success to get it up and running on debian woody. This is mainly a dvdauthor issue, I gave up when I could not "backport" a version from "testing" to "stable". There are some other minor problems, but I could solve those. So be warned and have a look at the list below! 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 Options -enhance-text-area the script will enhance the contrast of the text by merging a white box (or a black box in case of white text) into the text area with a weight of 50 %. If you do not want that, set this value to 0 -font supply the full path to a true type font here, default is FIXME -run-dvdauthor this option tells the script to actually run dvdauthor, otherwise only the images / menu mpegs / xml-files are created -font-color choose black or white text here -o the parameter is passed to dvdauthor as the -o parameter. The directory where the Video Files will be placed -borders due to the overscan of a TV you can not use the full picture size for a menu. I defined the borders of the box to be used to 50,50,670,526. If that does not fit your needs, you can change the settings here -title tells the script to add a title set to the DVD. Parameters for this title are supplied as a comma separated list. Valid parameters are: title="My Episode" Sets the title text for this film that is displayed at the top of the title set menu vob=film.mpg Sets the mpeg2 File that is used for that title set. This can also be a FIFO that collects the output of a multiplex process, nice for "on-the-fly" generatation of title sets text="My Summary Text" Defines the text that is displayed in the title set menu. Normaly this is a short summary of the movie. You can also supply a text file here, it's contents will be used. background="myImage.jpg" A image file in JPEG format, that is used as the background for the title set menu chapters="0,10:00,20:00,30:00" This parameter is also passed to dvdauthor for chapter generation -root tells the script to add a Main Menu to the DVD. Parameters for this Menu are supplied as a comma separated list. Valid parameters are: title="My DVD Title" Sets the title text for the DVD displayed at the top of the Main DVD Menu menu text="Film1 Button Label| Film2 Button Label" Defines the text that is displayed in the Main Menu next to the buttons. Normaly the text is taken from the title sets, but you can override the button labels by supplying text here as a | separated list. background="myImage.jpg" A image file in JPEG format, that is used as the background for this menu buttons=NN The number of buttons to be drawn, normaly calculated from the title sets you specify. Since you can generate the DVD step-by-step, you can supply this number here. QUICKSTART Prepare an MPEG2 file that can be used by dvdauthor (see "man dvdauthor" if you do not know about this) Optionally prepare a summary text file, and background images to be used in the menus. The following example assumes that you have a text file containing the summary, and two JPEG images, one for the main menu and one for the title set menu. Example: dvd-menu.pl -title vob=movie.mpeg,title="My descriptive title",text="summary.txt",background=title_set.jpg -root title="My DVD title",background=main_menu.jpg -run-dvdauthor -o MyDVD This should create a complete DVD directory structure in MyDVD ready to be burned. It should be tested by xine before burning it: xine dvd:/Full/Path/To/Current/Dir/vdrsync/VIDEO_TS/ (DON'T FORGET the trailing slash) You can supply multiple title sets on the command line, just more "-title" switches to the command line (with the appropriate parameters). More detailed explanation: As I learned from the dvdauthor man page and the internet, a DVD consists of one or more title sets. A title set is what I would call a film. This film can contain several menus, and the main film of this title set. In addition, the DVD contains a main menu that can not contain a film but only menus that point to title sets. I am not really sure whether I got that right, so please have a look at the man page of dvdauthor yourself. In my terminology I refer to the title sets as "titles" and to the main DVD menu as the "root" menu. To complete confusion, I refere to the captions of the menus as titles as well. I will clean that mess in a later version of this README. This script is pretty limited in what it can generate, so do not try to author a fancy DVD with 10 level deep menus using this script, it will not work. In fact all you can author is: - One or more title sets, each consisting of a menu and the film. The Menus contain some text, a "play" button, and a "back" button, that's it. - a Main menu that contains a button for every title set, and a back button. So what can you do with it? First, the script can only do two things by itself: - generate images that can be used for the menus - generate xml Files that dvdauthor accepts as Input In addition, it can create the Mpeg Files for the menus using transcode and spumux (from the dvdauthor package) Finally, it can run dvdauthor that then generates the DVD according to the instructions found in the xml files Step-by-Step explanation: First, the script parses the command-line options. This is not yet fool-proof, so pay attention to supply all the parameters correctly. Then the script tries to author the title sets: If a background image has been specified, it is rescaled to 720x576. Then the title (=Caption) for this menu and the summary text for the movie are added. The resulting image is written as a jpeg file to /tmp/background.jpg Now three images that just contain the buttons are created, and stored in /tmp. They are called menu.png highlight.png select.png Afterwards transcode is used to generate a one second MPEG2 movie from background.jpg. A one second silence MP2 Audio file is generated by the script, and this is multiplexed with the MPEG2 from transcode. The three png files are used to create the buttons using spumux from the dvdauthor package Then an xml file is generated (in /tmp/title_menu.xml) that describes the title set, and dvdauthor is started to generate the title set (if you have supplied the "-run-dvdauthor" switch). These steps are repeated for every title set supplied on the command line. Finally the Main DVD Menu is added, by a similar process: The JPEG and PNG Files are created, but for every title set present a button is added to the menu. The text next to the button is the title (=caption) that you specified for this title set. An xml file is created, and dvdauthor is started. That's it. You can also add only one title set a time, and then finish the DVD in a last run with the root parameter. This would be done like this: dvd-menu.pl -title vob=film1.mpeg,title="Film1 Caption",background=Film1.jpg -o MyDVD -run-dvdauthor add the next film by running dvd-menu.pl -title vob=film2.mpeg,title="Film2 Caption",background=Film2.jpg -o MyDVD -run-dvdauthor and so on. Please note that you have to check the size of the DVD yourself. Finally, create a root menu with the following command: dvd-menu.pl -root title="My Collection",text="Film1 Caption|Film2 Caption",background=Collection.jpg,buttons=2 -o MyDVD -run-dvdauthor Here it is important that the text parameter contains all the button labels as a "|" separated list. It is also neccessary to tell the scripts how man buttons it has to create in the main menu (one per title set). If you create everything in one run, the script just takes the individual titles (= captions) of the title sets as labels, and it knows how many title sets are present. If you decide to create the DVD step by step, you have to supply this information yourself. If you like this script, let me know! If you think it is not good enough,or should have other features, let me know, too. If you improve the script, please send me a copy ;-) Cheers Peter peter@vdr-portal.de