Page 1 of 1

Setting Menus up for Best Play of Background Audio or Video

Posted: Wed Sep 29, 2010 11:46 pm
by ckhouston
WARNING October 23, 2011: CX2D version and later generates menus with different durations than specified in the template INI file. However, the approach 2 solution outlined below and implemented as discussed in the How to Do it section still works for those wanting to make their backgrounds loop seamlessly as long as a vdeo background is used (playback speed will be altered sightly though). An audio background without a video background does not work as good. This warning will be removed if the bug is fixed.

Understanding Menus

You can skip to the Now the Answer section below if you already fully understand menus, read on otherwise.

CX2D menu parameters are specified in INI files in the various folders under the templates folder which is under the folder where CX2D is installed. Those INI files are referred to as menu templates, and each template is available to be chosen from drop down lists in the program settings or in the tree view -- read the manual available from the VSO site.

CX2D templates can include separate menu types for title, root, settings and chapters depending on which are specified in the template. The types available in VSO supplied templates are given in ... t6119.html and in the manual.

Title menus list all titlesets/source files in the project and allow you to select one of them to play. Doing so either plays the title directly or takes you to a root menu, depending on options chosen, where you can elect to go to a settings menu to change audio or subtitle tracks if the project has multiple tracks, or go to a chapters menu to select play starting at a specific chapter point rather than from the beginning.

Menus are short video segments, even still image backgrounds are made into video with an audio track if you choose to include one. You can see that by playing files in your converted folder. The title menu is in the VIDEO_TS.VOB file and root, settings and chapters menus for each title are combined in the VTS_nn_0.VOB files where nn is a titleset number. If all titles don't fit on one menu page, video segments for each page will be appended in VIDEO_TS.VOB. More than one page may also be required for settings and chapters. A short dummy file is used for VTS_nn_0.VOB when the template doesn't include a root menu and in VIDEO_TS.VOB when the "no menu" template is chosen.

Video segments for each menu type are broken into intro, main and outro sections, and the templates specify durations of each of those sections. Search a template for style=MNUS_TITLE, ROOT, SETTING or CHAPTER and you will find the section durations listed below -- in seconds in version 5, in microseconds in earlier versions -- for that menu type. Default durations of all three video sections are given for VSO supplied templates in ... t6120.html and in the manual.

The intro and outro sections can be animated, i.e. menu items are gradually placed during the intro and removed during the outro. The intro will play when the menu is first displayed followed by the main section. If a menu item is not selected before play reaches the end of the main section the first time through, play will return to the beginning of the main section and that section will be repeated. The main section will continue to repeat (loop) until a menu item is selected, then the outro section plays. So the intro and outro sections play only once but the main section will loop until a selection is made.

A short fadein from black is usually done at the beginning of each segment, and a fadeout to black at the end.

Menu Rendering

The process of making the video segments for each menu type is called rendering. A bar shows progress with the menu type below it and a percent completion is also shown in the top bar.

Rendering can take some time depending on the template and options chosen. Each menu will have either a video background from a file or one rendered from a still image, and background audio, if provided in the template, must be combined with the video for the final video. Then navigation buttons, from image files in the template folder, and page titles, captions, etc., must be overlayed on top of that.

Some of those components can be customized while others may not be depending on the template. The references above show that info for different templates. But the best way to see the options available is to import a file in CX2D, pick a template, and then start expanding the tree view. There are some templates in ... t6947.html that provide more options than those supplied with the program.

Now the Answer

There are three approaches that are practical for most users:

1. Use any available video or audio file for the background, this is what most users do. If that file is longer than the total play time of the menu, CX2D will use only a portion of it that is equal to the sum of the intro, main and outro durations -- you can specify in the tree view (see the manual) where that portion is to begin within the file. If the file is shorter than the total play time of the menu, CX2D will build the menu by adding the file as many times as needed to meet or exceed the total menu time. Either way, playback will be discontinuous because of the way play skips around in the file as described above.

2. A better way is to make the audio and video (if used insead of a still image) background file length and the duration of the main menu section equal. Then CX2D will build the menu using the file plus an amount taken from the beginning of the file that is equal to the durations of the intro and outro sections. Your background will then play from beginning to end but there will be a delay while the player loops back to the point corresponding to the begining of the main menu section. That delay can be objectionable if it is very long because it happens inside your background clip, not at its beginning or end.

3. The best most professional way is to build a video or audio file before conversion begins that has appropriate intro, main and outro sections. For example, one could show a performer walking on stage for the intro part, a segment of the performance for main and a segment showing stage exit for the outro. Or a fadein from black and a fadeout could be used for video intro and outro sections. An audio file could be made with whatever you like for the three sections, one simple one could use silence for intro and outro sections. Fadein/fadeout for the main section, audio or video, will make playback smoother when it loops. Looped playback will be smooth and continuous from beginning to end.

Your choice of those three approaches will depend on your expertise and time available. The last two approaches will usually require the use of a video and/or audio editor.

There is another approach (for experienced users) that will give good background playback, you can remove the intro section in the menu template. Payback will then be smooth and continuous until an item is selected, so it is probably best to also remove the outro at the same time. Those with experience in modifying templates can compare the regular cx2 version with the one without animation to see how it is done.

An Example

Let's use the blackmirror template as an example, its standard section durations are 2 + 12 + 2 = 16 total seconds.

The standard template provides a default background still image but there is no default audio background in title menus despite the tree view indicating there is, the reason being that the program doesn't know what audio would be appropriate if there are multiple titles.

Suppose we doubleclick the Background audio for Title menu is using audio clip starting from 00:00:00, choose Use a custom file (Audio) from the dropdown list, and then browse to an audio file we wish to use.

If the length of that audio file is greater than 16 sec, CX2D will use only the first 16 sec of it for the title menu segment. Then, when the menu is first played, the first 2 sec will play followed by the next 12 sec. If no menu item is activated before that, play will return to the 2 sec mark in the clip and play between the 2 and 14 sec marks. Play will repeat between the 2 and 14 sec marks until a menu item is chosen. When a menu item is chosen, the last 2 sec of the audio will play.

Now suppose we pick an audio file exactly 12 sec long. CX2D will use that file plus the first 4 sec of it to build a total time of 16 sec. Then when the menu is first played, the first 2 sec are played plus the next 10 sec available in the file plus the first 2 sec again before returning to the 2 sec mark in the file to begin repeating. So the entire audio clip will play during looping but there will be a delay that may be objectionable as already described.

Video backgrounds will behave the same way.

How to Do It

For approach 2., you simply use a background file with a length equal to the default main_duration of the template (see ... t6120.html or the Templates/Template Options section of the manual), or you can change main_duration in the template to be equal to the length of the background file.

Changing main_duration is easier than describing how to do it.

For version 5, if you want to use a custom background, simply change the menu duration within the program. Add the duration of the intro and outro sections (given in ... t6120.html) to the duration you want for the main segment to get the value to enter there. If you do not want to use a custom background, follow instructions below for version 4.

For versions 4 and 3, open the appropriate INI file in Notepad if you have a CX2D version later than You can use Wordpad for earlier versions -- refer to the note in ... t6260.html

Search for main_duration, the menu type will be described just above, keep searching if you need to change main_duration for another menu type, then change the value of main_duration. The durations are specified in microseconds ( 1 millionth of a second) and must be an even integer -- end with a 0, 2 ,4, 6, or 8.

It is important that background length and main duration be equal to millisecond (1 thousandth of a second) accuracy or you may hear a pop or clicking sound when play switches from one point in the background file to another. Good video or audio editors will give millisecond accuracy or you can use the free MediaInfo program to get lengths of background files, do not use the inaccurate durations provided by Windows if you can help it. You can also put a short fadein in front of your file and a fadeout at the end if you have problems and have an editor that can do that.

You can simply save the template after making changes. But, if you want to keep the original template, go to the top of the INI file, find the template_name parameter in your language, add a note reflecting your change, and then do a Save As to the original template folder but with a new file name reflecting your change. Then a template choice for your new changes will be available to choose the next time you start CX2D in addition to the original.

Approach 3. requires more sophisticated work and will probably only be used by experienced users. They might even want to change the duration of intro and outro sections -- see ... t6260.html