Log in

View Full Version : Seamless menu looping guide


violao
19th March 2004, 14:09
Seamless menu looping guide

Introduction: You have probably noticed that whenever there is a looping menu present on a commercial DVD the audio part fades in and out at the looping point. I assume this is the default behavior of commercial DVD authoring programs and I believe their authors have chosen to setup their application that way because they expected that ordinary DVD designer would likely have very limited knowledge about underlying DVD technology. We, at the other hand, are trying to go as deep as possible in the technology in order to drive that technology to it's maximum. I think this is a perfect example.

Background: It appears from what I have found on Internet that DVD specification doesn't enforce strict rules upon all HW issues of DVD players and that's what differentiate one player from another. I believe that's the reason why some player would read fully compliant disc, while the other had problems with it. It seems one of these issues is Track buffer. This is the HW part that is supposed to buffer data while the head of the player perfoms a jump. However there is a reccomendation that it should have 2 Mbits - that corresponds to 250 ms of 8 Mbps VBR stream playback. Today's DVD drive seek times are well under this limitation, you will find maximum seek times of around 200 ms and this is the time of the longest possible jump. Therefore if the drive had this 2 MB buffer theoretically it should be possible to continuously randomly and seamlessly jump to any place of the disc. I believe this is more or less achieved, otherwise we would have big problems with multi-angle and seamless branched movies - they both use jumps in normal playing sequence.

Note: I will show you how it is possible to achieve seamless looping menus using dvdauthor (http://dvdauthor.sourceforge.net/), but I can not guarantee that it will work in your player. Try to experiment before you decide what direction is the best for you. I would also like to encourage all advanced DVD authors to devise their own methods based on the idea presented here, using tools of their choice, so that the readers can choose among the various methods and not be restricted to a single tool.

Tools:
Video editor of your choice (VirtualDub, Avisynth,...)
Audio editor of your choice (CoolEdit,...)
MPEG/AC3 encoders of your choice (CCE, TmpgEnc, ffmpeg,...)
any DVD menu authoring application (DVD Lab,...) - alternatively use any image editor that supports PNG + spumux from dvdauthor package
dvdauthor 0.6.9
IfoEdit 0.96
VobEdit 0.6


Creating video/audio menu background

1. This part is not really discussed here. Obviously you would like to make video part such that the first and last frame (that's where the jump occurs) are played smoothly. There are other guides for that such as this one (http://forum.doom9.org/showthread.php?threadid=25844&highlight=looping). In any case note the number of frames since you'll need to have the audio of exactly the same length. The number of frames * fps gives us this length.

2. Next find a nice PCM audio clip that you can loop without noticing audio discontinuity. That would likely be a short rhythm sample, but not necessarily. I have succsessfully looped instrumental parts from middle of songs. Important thing is it has to have approximately the same length as video. Approximately, because as a last step of creating audio you will do a "Time Strech" of your clip to the EXACT length of your video clip. I used CoolEdit, but you can also do minor streches with DOS tool called wla that is a part of DVD2SVCD package. This last step is crucial in the process, if you fail here there is no workaround.

3. Encode video to elementary stream using standard DVD settings and not too large bitrate - that will help keeping track buffer at low usage. I use around 5 Mbps and it works for me.

4. Encode audio ONLY IF YOU MUST! Better skip this step, since you will probably find that encoded stream is somewhat shorter than the original. I did succeed in making one AC3 loop with ffmpeg, although I don't know how exactly, because all other attempts resulted with shorter and unusable audio clips. I believe this has to be related to finite AC3/MP2 packet size. In any case you will spare yourself any trouble by just using original PCM.

Creating menus

5. Import your video and audio to menu designer of your choice, add buttons and commands you want and compile your menus. You do not need your video (movie) part at this stage, just make menus. Also make sure that your application doesn't trim or change video and audio timing in any way. If you just use image editor then you just need to design button overlays and feed them together with mplexed video/audio to spumux and author it separately with dvdauthor. If you are making several menus, make sure that they have different vob/cell IDs.

6. Depending on the way you made menus you might have to split them to single files. Use VobEdit and split to cell level. Make a note about vob/cell IDs. We will need to preserve that order in dvdauthor xml file.

Author DVD

7. Make dvdauthor xml file such that your menu vob file tag is repeated for whatever number of times up to 255. Here's the example:

<menus>
<pgc>
<vob="my_looping_menu.vob"/>
<vob="my_looping_menu.vob"/>
<vob="my_looping_menu.vob"/>
...
<vob="my_looping_menu.vob"/>
<post>jump cell 1;</post>
</pgc>
</menus>

This is also a branch point. If you used spumux in step 5 then you would need to supply mplexed vob (from the step before you muxed subpictures with spumux) instead of final menu here and you'd also need to perform "mock" strip in step 9. This is not dvdauthor tutorial, so I won't explain other options. In this step you will also need to include everything else you want to be on your final DVD. For every menu you will need to enter <pgc> tag and include your menu cell with <vob=.../>. Keep in mind that you will need the same order of vob/cell IDs in your newly created menus as in the original. Dvdauthor does this sequentially, so 1st vob will get vob/cell 1/1, 2nd vob/cell 2/1, etc.

Using this file dvdauthor will create this kind of PGC structure in IFO file for our menu loop (viewed with IfoEdit):


Cell Position in VOB:
Cell_1: has VOB_ID 1
Cell_2: has VOB_ID 1
Cell_3: has VOB_ID 1
Cell_4: has VOB_ID 1
Cell_5: has VOB_ID 1
...

Our menu is copied only once and PGC has X cell entries all pointing to a single vob cell on the disc. The beauty is that dvdauthor also automatically set "seamless" flag:


Cell_2: Cell Type (Angle) 10
type normal
Block type normal
seamless playback linked in PCI: yes
...

so with just 1 step we prepared everything we would need for seamless playback.

8. There might be a situation where dvdauthor complains about vob file you included in xml file. In that case simply include BLANK vob with the same vob/cell id instead.

9. Now simply replace dvdauthor created menu vob file with your original. In case you had to go through 8 you would need one "mock" strip of menu vob file, and of course Get VTS Sectors.

10. Test your results before burning. IfoEdit will complain about PCM audio so use software players like PowerDVD and WinDVD. I found that both work smoothly through seamless transitions, but PowerDVD has problems jumping with jump cell 1; post command. I believe this is how standalone should work. It probably clears all buffers when it encounters non-seamless flag in order to prepare it's resources for next seamless playback which is perfectly OK. After all this is the purpose of non-seamless flag - to tell the player that it does not have to play seamlessly.

Hopefully everything will be fine and you'll be able to play seamless loops in your standalone. If you are not, please try to experiment and post your findings here. Also if you can do the same with other authoring tools please post your guides here.

Have fun with this guide.
violao

DaRat
21st March 2004, 13:45
Why do you add a cell command? It takes time to execute it and who knows what else does the plaer do when it encounters one. I tried the following: I made my root menu, made 99 cells containingthe very same menu (same asset), of course Scenarist wouldn't let me set the seamless flag so I compiled the project, opened the ifo in IFOEdit, set the cell types to 9, burnt the stuff to cd and voila! It worked flawlessly with my H+ on a 16x cd drive so I guess it would work just fine on a standalone. (Unfortunately my standalone won't play mini-dvds and I don'T have blank dvds right now.)


BTW, does setting DSI helps there or is that totaly irrelevant?

violao
21st March 2004, 20:26
Originally posted by DaRat
Why do you add a cell command?

"jump cell 1" in dvdauthor post tag is compiled as "Link Cell 1" in post-command chain of particular PGC, so it isn't a cell command, but a PGC command. This is just to provide for looping when player reaches the end of PGC. At this point some dicontinuity might be expected.

Glad to hear that this works with Scenarist too. Hope to see more examples.

violao
25th March 2004, 11:44
Originally posted by DaRat
BTW, does setting DSI helps there or is that totaly irrelevant?
I think DSI is being used in multi-angle and what we have here is a case of seamless branching, so DSI is probably irrelevant. I believe dvdauthor correctly interprets this while setting 10 for cell angle type.