Animated Button Overlays in Menus with DVDAfterEdit

by Uli Plank
Requires DVDAfterEdit Standard

This article is based on Trai's article about the subject he started in a recent thread (and that one was based on a brilliant idea from Larry Applegate). We've successfully completed the process during NAB (and demoed it there) and I'm going to explain it step by step here.

First of all: why can't we do this in DVDSP (not even in version 3)?

Well, you can make an animated overlay with the help of subtitles (i.e. subpictures) for a track, which is the first process I'm going to explain here. Unfortunately we can't add several subpictures to motion menus, only a single static overlay. But you are clever: you want to try and use buttons on video to make it happen! That would be a very tedious work, since you can't import them easily with the help of a text file. Plus: you can only change frames on every I-frame, making the animation very jumpy. Oh, I forgot, if you are a very experienced DVDSP user, hanging around here at DVDAfterEdit.com: What about importing the subpictures first and then adding the buttons? Sorry, as soon as we try to turn a track with animated subpictures into a kind of menu by adding buttons, only the first subpicture will be displayed and all subsequent pictures will be lost.

Now: What's the Trick?

It's pretty simple (like most great ideas): we construct a motion menu of the right length without the animation and an identical track with the animated subpictures (but no buttons) in DVDSP and let it do it's work (i.e. let it multiplex the files). Later we move the right VOB (a Track we've constructed for the purpose, in the same project, which we'll delete later) over into the menu domain and reconstruct the buttons and their navigation with DVDAfterEdit - which is not so hard to do and will teach you a lot about the use of this program at the same time.

Part I: Preparing the Animation

You'll need a row of single black and white pictures for your animation, and they'll be reduced to only 4 different shades between black and white, just like any other subpicture. You may generate them in any 2D-animation program. I actually used a few very old black and white photographs, actually the oldest effort to record motion that we know of, photographed by Eadweard Muybridge about 125 years ago. I arranged them, together with my static elements for the button overlays, in After Effects, then I rendered and saved them as numbered PICT files.

To import them into DVDSP, you'll want to generate a command file instead of positioning them in the track manually. It's mentioned in Apple's manual at page 382. This can be done by a STL file, and it's format is described in the manual, starting at page 386.

It should look more or less like this:

$SetFilePathToken = <<Image>>
// Tell the program when to expect an image file instead of text
$ForceDisplay = True
// Make it always visible
$TapeOffset = False
// Put it relative to the timecode of the track, not the video
// Here come the frames
00:00:07:00 , 00:00:07:02 , <<Image>>Animated_Overlay_00001.pct
00:00:07:02 , 00:00:07:04 , <<Image>>Animated_Overlay_00002.pct
00:00:07:04 , 00:00:07:06 , <<Image>>Animated_Overlay_00003.pct
00:00:07:06 , 00:00:07:08 , <<Image>>Animated_Overlay_00004.pct
00:00:07:08 , 00:00:07:10 , <<Image>>Animated_Overlay_00005.pct
00:00:07:10 , 00:00:07:12 , <<Image>>Animated_Overlay_00006.pct
00:00:07:12 , 00:00:07:14 , <<Image>>Animated_Overlay_00007.pct
00:00:07:14 , 00:00:07:16 , <<Image>>Animated_Overlay_00008.pct
00:00:07:16 , 00:00:07:18 , <<Image>>Animated_Overlay_00009.pct
00:00:07:18 , 00:00:07:20 , <<Image>>Animated_Overlay_00010.pct
// and so on...

Be careful where to type spaces: they should appear before and after the comma, but not between the FilePathToken and the filename (this one has caused me quite a headache for a while, not having looked at page 389 close enough to notice - it's there). You can generate that file in any old text program as long as you save it as plain ASCII text, and it should reside in the same folder as the images. Of course you could generate the file with an Apple Script or an Excel spreadsheet to avoid typing, but some copying, pasting or search and replace will get you going as well.

I have used an animation that changes every two frames here, which works very well on most players. There's a common misconception about overlay animations, they are not limited to GOP boundaries, they may even change on every frame. But the limits are not directly dictated by the number of frames per change, but the amount of data changed. If you change large areas of the screen, you will need to reduce to about 2-3 frames of video per frame of animation. If only small areas change, all players I've tested handle single frame animation pretty well. A speed of 15 fps (for NTSC) should work well in most cases, or 12 fps - like in my example - for PAL.

Building the Project in DVDSP

[inline:1=center,Position in Outline]

In my very basic example we'll use one single motion menu and three connnected tracks. I'm going to use a motion menu containing an intro of seven seconds with the buttons flying into place and 12 seconds with static buttons and moving background.

[inline:2=center,Original Motion Menu]

Notice that the loop point is set to 7 seconds. Generate the buttons you need here and link them to their target tracks. Let the end jumps of those tracks point to this menu (and the respective buttons), just set up everything as you'd normally do it.

Now generate an extra track (for a total of 4 Tracks in the project), which should be positioned after all the other tracks in the outline window, here I called it "Animated_Track".

[inline:3=left,Cell Marker]
[inline:4=left,Track with Marker]

Import the same video (and audio, if needed) you used for the motion menu into this track. Add a marker at precisely the same time as the loop point in the menu. You may de-activate all "types" for this marker in the marker's properties, so it'll be just a cell marker, showing in green.

[inline:5=left,Import Subtitle]
[inline:6=left,Imported]

Now click into the first subtitle track with the right mouse button (or CTRL-click) and select "Import Subtitle File..." from the contextual menu. Open the STL file you created for your animated subpictures. It may take a while, but finally you should see a message like mine (with your number of subtitles, of course).

[inline:7=center,Animated Subpictures CU]

They won't be visible as single subpictures without zooming in a bit on the timeline.

You can have a look at the subpicture animation with the Simulator, if your computer is fast enough. But there's one more thing you need to consider: if you don't want your animated button overlays to show in the ���normal' state, you'll need to change that here. The information for the visibility of this state is contained in the multiplexed subpicture, so we can't change that with DVDAfterEdit (the selected and activated state can be changed). So select one of your subpictures, turn the opacity down to zero for all values and click "Apply to Stream" - this will change all subpictures to the same settings.

[inline:8=center,Normal State Zeroed]

Don't connect any button or anything else to this track, since we want to get rid of it later. Now you are ready to multiplex the project - "Build" in Apple-speak. You'll notice that it takes DVDSP quite some time to multiplex the track with the animated subpictures. The log file will show which VTS number was the last one generated. Please note: any slideshows you have in the project will be put last in the row, behind the track with the animation.

[inline:9=left,Muxing]
[inline:10=left,Log Window]

You can't look at your animation now with any DVD player - remember, you can't even access that track now. So let's go for the next step.

Part II: Moving your Animation into the Menu Domain with DVDAfterEdit

Make a duplicate of your project on harddisk. Remember: "With great power comes great responsibility" as one of the characters on the DVD with animated button overlays said - seen "Spiderman" ? Since DVDAfterEdit will give us full power over the VIDEO_TS folder, we better work on a copy - and having both the original and the copy open makes a few operations easier.

What do we have now?

Open your VIDEO_TS folder in DVDAfterEdit and have a closer look at the structure of our simple project. The first VTSM will contain the PGC for our current menu (without the animation). After a few dummy PGCs DVDSP created for it's abstraction layer you'll see PGC 7 with two cells in it. This is our menu with it's intro and the part with the buttons in place.

[inline:11=center,Output DVDSP]

The video title sets are our four tracks, VTS 4 being the one with the animated overlays. Since we created a cell marker there, we can already see a similar structure like the one for PGC 7 in the VTSM, but the whole bunch of dummies is missing here. If you don't plan to destroy DVDSP's commands and do your own programming (as described in a recent article by Alex Alexzander), you'll need to reproduce the original structure to retain the abstraction layer programming.

Duplicating the PGC Structure

[inline:12=center,Add Dummy PGC]

By right-clicking on VTS 4 we'll acces the command "Add Dummy PGC" and repeat this six times to get the same number of dummies in VTS 4 that are in VTSM 1 (remember, we're about to move VTS 4 into VTSM 1 with a replace menu VOB operation, and we want the PGC structure of the Abstraction layer to match).

[inline:13=center,Drag Cell Out]

These empty PGCs will be generated after the existing one, so we don't yet have the same arrangement as in the existing menu. Not a big problem: click on the first one (the one with programs in it) and you'll see the the two cells in the Program map an the right hand side. Just drag both them out of that box and the first PGC will become a dummy too.

Now select the last dummy PGC in VTS 4 and drag the two cells from the box named "Available Cells" to the left into the Program Map (in correct order, for sure). The sequence of PGCs should look exactly like the one in VTSM 1 now, and the content of the two non-dummy PGCs should be identical too (which can be checked in preview, of course). Save this version to write the new structure into the VIDEO_TS folder.

Saving the Commands

When we replace the VOB connected to a VTS or VTSM - which is our next step - we loose all the commands attached to it. This is why we need to copy all the commands from the project's VTSM domain to put them back again later. DVDAfterEdit has a very efficient feature for this, copying all commands from the project (or from all PGCs) into the clipboard as a text file.

[inline:14=center,Copy Commands]

To retain this information paste it into a text editor like Apple's TextEdit, where you can look at all the information as readable (and editable!) text. The comment lines will tell you where every chain of commands belongs in the project.

Replacing Video, Sound and Subtitles

Now we are ready to replace the content (VOB) of VTSM 1 with our animated version sitting in the Track. Just right-click (or CTRL-click) on VTSM 1 and you'll see a smalll menu with the command "Replace Menu VOB". Select this and you get a file chooser window. Go for the VIDEO_TS folder of your project and scroll down to the last VOB, which is VTS_04_1.VOB in our case. It doesn't matter if you have "Import Commands With VOB" activated or not - we are going to replace them anyway. You'll get a warning telling you that we may produce an out of spec DVD if the contained subpicture information is meant to be subtitles instead of animated overlays. In our case, we can safely ignore this.

[inline:15=center,Warning]

Attention: if you have any slideshows in your project, the last track will not be your last VOB. Better check them in preview and take a note in such cases.

[inline:16=center,Replace VOB]

Now we need to paste those commands in again. Actually, we only need the ones for VTSM 1, which you can identify by comment lines in the Text file. Select them, copy, and paste them into your project, the entry under "Project-wide Edits" is "Paste Commands from Text".

It's a good idea to open your original version side-by-side now (remember, we are working on a copy, right?) so you can compare those commands we pasted back again. You may delete your dummy track - VTS 4 in my example - now, since it's nood needed any more. The command is "Delete Video Title Set" in the contextual menu (right/CTRL-click).

Replacing Navigation

Let's have a look at our VTSM 1 now at the lowest level of content, the "Nav Pack" level. If you twirl open PGC 7 in VTSM 1 you see the two cells it contains. The first one is our intro without any navigation, so let's look at the second one. You'll see 25 nav packs here, since my video is 12 seconds long, with GOPs about half a second apart (I'm in PAL).

[inline:17=center,Nav Packs]

When you activate cell 2 itself (not one of the nav packs), you'll notice one important difference from our original when looking at the right side of DVDAfterEdit's window: the original cell command is "Link TopC", while our copy has none. Let's fix this by clicking on that entry and choosing "Link TopC" from the menu for our copy too.

[inline:18=center,Link TopC]

Go over to the window of your original version and select the first nav pack, then select "Button Highlights" on the right side. This entry is different from the rest, so we need to change it separately. Type Apple+C (Copy Button Highlights), move over to the copied version and paste that over the same nav pack with Apple+V (Paste Button Highlights Into). Now go back to the original, activate the next nav pack and copy it's Button Highlights. Don't worry, we don't need to do this for every single nav pack one-by-one! Activate all the nav packs in your copy EXCEPT the first one by shift-clicking and use Alt+Apple+V, the command has now changed to "Paste Button Highlights Repeated". We could do this to thousands of nav packs in one single step - nice feature, ain't it?

[inline:19=center,Paste Highlights Repeated]

Select all the nav packs in cell 2 of our copied project now, since the next two actions will deal with all of them at the same time.

Another thing to copy is button navigation: go to the original version, select that position on the right while one nav pack is still selected and touch Apple+V (Copy Button Navigations). Get our new project to the front (see why it's useful to have both of them open?) and do another Alt+Apple+V (Paste Button Navigations Repeated).

Go back to the original, select any nav pack in cell 2, select "Color Schemes" and type Apple+C (Copy Color Schemes). Move to our new version and touch Alt+Apple+V (Paste Color Scheme Repeated).

If you want to have a look at them, twirl one open. BTW, the three color schemes here are the same as those "Color Sets" in Apple's DVDSP. You'll notice that we have settings for color and contrast only for "selection" and "action" at nav pack level. This is why we had to decide visibility or color for the normal state of our buttons before multplexing, since they are not easily accessible for DVDAfterEdit.

And why don't we see those colors here? Well, at nav pack level you may only choose entries from an existing palette - that's what these numbers are standing for. The palette itself is defined per PGC, and DVDAfterEdit will let you change colors at that level to your heart's delight (look at the last position in the right side of it's window while a PGC is selected). Select the PGC and "Color Palette", copy it from your original and paste it into the PGC of our animated project.

[inline:20=center,Copying Colors]

Correcting Button Navigation

Well, that would be it - if I had not made a little mistake! To be honest, it was for educational purposes this time ;-)

If you twirl navigation open for button 3, you'll notice it: pressing "left" should get us to button 2, not 1 as is indicated here. Just select any single nav pack, type in number 2 and copy button navigation from this one. Select all others, paste repeated and it's fixed. See how fast you can correct a little error in DVDAfterEdit without even touching DVDSP again? BTW, you may have noticed here that many other arrow keys will get us to the button itself. This is the equivalent of "Not Set" in DVDSP - there is nothing like ���not set' on this level in the DVD specs, it needs to be defined.

[inline:21=center,Fixing Button Nav]

We should improve on our viewers experience by skipping the intro when coming back from a track in this project as well, but I'd like to point you to Ian's excellent tutorial on the subject here at our site, called "Messages From Beyond The Build File".

For animated button highlights, you should be fine by now. Save and enjoy!

One final note: this project was simplified by having only one menu. If you have more than one, you got to check which ones reside in the same VTSM and build another dummy track with buttons on video for all of them, since you'll need to reconstruct the whole VOB together. Remember: still menus without sound will just be one GOP in length, those with sound will have as many nav packs as needed for the duration of the sound.

Uli Plank