Forum Index

Support myDVDEdit

Register Register
Log in Log in

Search Search

--- Links ---
Forum Mac-Video
Targeting the Loop Point
By Hal MacLean
For myDVDEdit version 0.9.5
Last updated: Sat 22 Oct 2005, 01:19

Forum Index -> Documentation/Tutorials


The concepts brought forth in this tutorial by Hal MacLean were first developed by Ian Shepherd and Jake Russell using DVDAfterEdit.


Making DVDs has gradually become more straightforward over the last few years, thanks largely to the investment by companies such as Apple in good quality software marketed at an affordable price. Such software includes DVD Studio Pro, which brings a great deal of power to the DVD author as well as providing a flexible and fully featured authoring system for professional DVD production.

The intuitive interface and feature set of DVD Studio Pro comes at a low price financially; however, there are some trade-offs in the functionality versus features. One such trade-off might be considered the fact that some of the full DVD commands are not available to the user, as some parts are used by the application to provide the ease of use. This is not without its merits, of course, but there are some who now want to be able to access the higher-end features and create DVDs beyond the normal scope of DVD Studio Pro, but without investing a small fortune in a fully featured editor application such as Sonic Scenarist.

Fortunately, much work and research has been done in the field of post-build editors -- software that lets you open up the folders and files on your DVDs after you have built them and make changes to improve the features on your final disc. For this article I will look at one such editor, the donationware myDVDEdit, created by Jérôme Cabanis.

I should just add that this software is not actually licensed by the DVD Forum and that using it is done entirely at your own risk. Neither Jerome nor I can take any responsibility for any damage you inflict on your DVDs by using this software, so always work on a copy of your VIDEO_TS folder!

The Problem

When you make a DVD using DVD Studio Pro you can add some very cool features, including a menu which has an introductory animation before the buttons appear. This provides a polished and professional function your clients will appreciate. However, when you then want your viewer to return to the menu after watching some footage you can't go directly to the place where the buttons appear. You either have to make them sit and watch the entire opening animation again, or create a second menu which looks identical but doesn't have the animation.

In this project, the animated intro menu is the "first play" item for the disc. It includes a short animation and then has a marker set. A button overlay appears at the marker and the menu then continues to the end with the buttons showing. At the end, the menu loops back to the marker and continues from there.

Here you can see the issue. I need two menus to make sure that I don't make the viewer sit through the animated sequence all over again. The animated intro menu has buttons which link to the track, but the track jumps to the "buttons only" menu when it finishes. From there the buttons only menu links back to the track and is the menu that the viewers will see from then on until they restart the disc.

I can't make use of that Loop point marker in any other way and can't use it as a target for the end jump of the track. Instead, I have to add a second menu which looks identical but is a static menu with just the buttons.

This method is pretty good, but what if you have very little space left in your project and can't afford to add another menu? You can now use the one menu and still send your viewer back to the place where the buttons appeared.

The Solution

In DVD Studio Pro the point at which the buttons appear can be set to loop over and over so that they stay on screen long enough for the viewers to make their choice. This is called the loop point. In normal authoring you cannot use this point as a target when leaving other menus or tracks, but in post-build editing you can.

The actual looping menu itself is made up of two parts (called programs) which are set to play one after the other. With some cunning scripting all done for you in the background, DVD Studio Pro sets the second program to play over and over. The result is that program 1 plays the intro animation and jumps to program 2, which shows the menu buttons.

What you will be doing is using myDVDEdit to find the actual pair of programs and set up some special flags which allow your DVD player to see if the first program has played before, and if it has, to jump right away to the second program. This is a small line of script which you can add easily in myDVDEdit, and it will ensure that when you go back to the menu you don't have to see the first part all over again.

The Procedure

Firstly, you need to author your disc as usual, with the one menu -- make sure it all works as you want and build it to your hard drive. You will get two folders, an AUDIO_TS folder and a VIDEO_TS folder. The latter is what you will be working on...make a copy of it now.

Open up myDVDEdit and use the File menu to open up your copy VIDEO_TS folder.

You will then get the main window for myDVDEdit.

On the left-hand side you will see the elements that make up your DVD and on the right the main control areas. The DVD I have chosen to edit here is very simple: it has a main menu (which has the animated intro) and a submenu to select chapters. The submenu is a simple static menu, but the main menu is the one we want to change.

Look at the top of the left-hand side. There are the four main domains of my disc: the First Play item is listed, followed by the Video Manager Menu (VMGM) , then the Video Title Set Menu (VTSM -- aha! That should be where we go next), and the Video Title Set itself (VTS).

Look at the "tiles" underneath that lot -- each holds a lot of information which is well worth understanding:

This one (from the First Play item) shows me that there is no footage in there, no audio, no subtitles, and no angles but there are four "pre" commands (no "post" or "cell" commands). When the First Play item runs, these four commands will be executed before anything else. They are used to set up parameters and jump the player to the correct place for the next steps it has to take. As you can imagine, post commands take place immediately after the item has played. This First Play item is an example of what DVD Studio Pro does for you... In my project I had set First Play to be the animated menu, and yet here we see that it isn't. This is completely normal, and you will find the same on your VTS folder.

If you look at the right-hand side you will see the main text area has some codes in it:

The R6, R5 and R1 command lines refer to different registers in your DVD player. In DVD Studio Pro the registers are called GPRMs and are numbered 0 through to 7. In fact GPRM 0 is equivalent to R8 -- DVD Studio Pro uses the first of the sixteen available registers for itself and allows you to use the higher-numbered ones, but renames them for you. GPRM 0 = R8 and GPRM 7 = R15, and so on.

Values are being set in this first play item which can be used later on when things are playing back to see where to go to next. The small triangle to the left of these is clickable. When you click it the settings area will be revealed.

Now, what we want to do is find the place where the main menu is kept, and in DVD Studio Pro these are always placed in the VTS Menu space, so click on that.

You'll see a whole bunch of tiles appear on the left. Most of them contain only scripts and codes, but somewhere around about the seventh one (PGC 7) you will see one that contains two programs (a small number 2 underneath the left-most mini icon on the tile itself). This is a two-program PGC inside the Video Title Set Menu space. We have found the one we need to edit.

Now look at all those lines of code on the right. This is where we do the editing, and you need to be clear about what you will do and why it works.

Firstly, when the menu is called you need to check to see if it has played before. We can add a small section of code to do that easily enough. In this case I am going to make it look for a value in a register (one which hasn't been used yet). When the menu plays that search must take place before anything else, so I am going to make this the very first thing that happens. You can see that there are lots of empty lines of code ('Nop' statements). I am going to use one of those, but you could just as easily add a new line by clicking on the big [+] sign at the bottom and drag the new line to the top of the list. Make sure Goto Adjusted is checked too -- it helps ensure all the links between the lines of code are retained. I'll click on the triangle next to line 1's Nop statement:

Now we can get to adding those commands! Click on the Type dropdown and select Link. Then click on the If box and the whole window will alter:

From the Nop dropdown still showing, select Link Pgrm (which means we will go to a different program) and then look at the options under If.

We need to set a condition which will say "Jump to program 2 IF there is a value in a register we set". In this case we will use register 15, or R15. Of course, if you have used GPRM 7 in your DVD Studio Pro project then you will not be able to use R15, you will have to use a different register that you know is free to use. To make sure this line of code will look for the correct value, we'll ask it to see if there is a 1 in R15 by clicking on the Direct box and typing the number 1 right in. When you are done, the window should look like this:

That's the first part done. You can click on the triangle again to close that editing window, and the first line of the code should now have the commands in place.

What we have to do now is go and make that value be set after the menu has played. Remember, the post commands take place once a PGC has been finished with and the player moves on. Before it goes anywhere the post commands are read. We now go and set that to show the value. At the top of the editing window, click on Post cmds:

A very similar window opens with a new set of scripting in there. If you look through it, toward the bottom you will see a Link command (line 10 here), which is when the player will leave that PGC and go to the next one. We need to make sure that our value is set before the player leaves the PGC, otherwise this won't work. You may find some Nop statements at the bottom, after the Link, and you can use one of those as long as you remember to move it up the list before you finish. Open up a Nop statement and this time set it so that R15 has a value of 1, like this:

Again, you have to type the number in the box. Now, close that line of code by clicking on the triangle once more, and move it up the list:

Make sure that Goto Adjusted is checked before you move it!

And that is all there is to do. You can now save this work and test it to see if it does what you want. Open up this version of your VIDEO_TS folder in DVD Player and play it. You will see that the first time the menu runs you get the animation. But when you click on a button the second line of code sets the R15 value, and so when you return to the menu the pre-command, which is looking for that value, jumps you over to the second program in the menu -- the bit where the buttons appear.


There are many other things that you can do with this kind of editing. This is a simple example of post-build editing, which adds extra functionality to the DVDs you author with DVD Studio Pro. Please remember that you should always work on a backup copy of your work and check it thoroughly before using it. I can say that I have used this editing technique with great success. Once you get into doing this kind of work you will not have to worry about the limits that DVD Studio Pro has. You can always find ways around it with a tool such as myDVDEdit.

I would like to point out that this article has only been written because of the extensive work done by many people in the field of post build editing. I would like to thank Jake Russell in particular, and Ian Shepherd as well as many other folk who have pioneered such techniques. My work here reflects their advances, and is only possible because of the developments they have done.

© Copyright 2020 Hal MacLean
All rights Reserved

Forum Index -> Documentation/Tutorials