New Scripts on the Sundance Media Group site

JohnnyRoy wrote on 3/27/2004, 8:42 AM
I just uploaded 3 new scripts to the Sundance site:

Add2SecondGap: This script will move all the events on the selected tracks so that they have a 2 second gap between them. This is very useful for making an audio CD that requires this gap to be there. To make a perfect Audio CD, just drop your media on a track, run this script to add the gap, then use Tools->Layout Out Audio CD From Events, and you’re all set to Burn CD.

RegionsToChapters: Sometimes you want to convert your Vegas regions into DVDA Chapter points. This script creates markers at all the region starts. It uses the region name if there is one, otherwise it uses the word “Chapter” + an incremental number. The numbers continue to increment so that if some of your regions are labeled and some are not, the chapter number will always be the Nth marker number.

SelectEventsFromCursor: This script will select all the events on all tracks that are under the current cursor position and to the right of it.

Hope you find them useful.

~jr

Comments

randy-stewart wrote on 3/27/2004, 8:46 AM
JohnnyRoy,
Thanks much! That select events from cursor is great! I'll use that often.
Randy
cheroxy wrote on 3/27/2004, 9:28 AM
Thanks for always being so willing to share your efforts with the group!
Carson
Spot|DSE wrote on 3/27/2004, 1:12 PM
Johnny, thanks for these! They are very useful!
epirb wrote on 3/27/2004, 5:46 PM
regions to chapters LOVE IT!
THANKS!!!
JohnnyRoy wrote on 3/28/2004, 11:36 AM
I’m glad others are finding these useful. If you ever need a script for a particular task just let me know. I’ll try and write you one. I just keep solving the things that I find tedious to do and hope others find it useful too.

~jr
aspenv wrote on 3/28/2004, 12:11 PM
What about a script for changing the aspect ratio of all the clips in the media pool or at least the ones on the timeline. It is a very tedious task when shooting anamorphic to have to change manually each one of them from 0.9091 to 1.2121.
And thanks for such great scripts that I will use for sure !
JohnnyRoy wrote on 3/28/2004, 12:47 PM
Fernando, This script should do what you want. I’ll try and make one that allows you to pick the aspect ratio from a menu and upload it to the Sundance site. For now anyone who wants to use t can just change the aspectRation variable to be the ratio they need. (I set it to 1.2121 for you) ;-)

EDITED: On second thought, I modified this script to get the aspect ratio from the project so that you can easily change the aspect ratio without having to modify the script. (it was a one line change) I assume the reason for matching the aspect ratio in the first place.

/**
* Program: ChangeMediaPoolAspectRatio.js
* Description: This script will change the aspect ratio of all the video media in
* the project's media pool to match that of the project.
* Author: Johnny (Roy) Rofrano john_rofano at hotmail dot com
*
* Date: March 28, 2004
**/
import System.Windows.Forms;
import SonicFoundry.Vegas;
// Get the aspect ratio of the project
var aspectRatio = Vegas.Project.Video.PixelAspectRatio;
var counter = 0;
try
{
for (var media in Vegas.Project.MediaPool)
{
// only add the effect if the media object has a video stream.
if (media.HasVideo())
{
// get the video stream
var video : VideoStream = media.Streams.GetItemByMediaType(MediaType.Video,0);
// Set the aspect ratio
video.PixelAspectRatio = aspectRatio;
counter++;
}
}
MessageBox.Show(counter + " Video stream(s) changed to " + aspectRatio);
}
catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
/** End of Program **/
Is this what you needed?

~jr
aspenv wrote on 3/28/2004, 1:03 PM
wow!!! I'm speechless, thanks so much, I have not try it yet, I'll post in a moment though! but..wow! thanks again Johnny!
aspenv wrote on 3/28/2004, 1:30 PM
I have just tested it !!!! wow! 21 clips in a fraction of a second, flawlessly, thanks thanks so much. It comes specially handy today since I'm digitizing 9+ hours of anamorphic footage, which means that tomorrow I would have spent a lot of time changing the aspect ratio...but that's not going to be the case... I have several friends who are going to be very happy with this. Thanks again!
fernando ;-)
epirb wrote on 3/28/2004, 2:16 PM
Is it possible to create a script that would say minimize all the audio tracks and leave the video tracks at thier preset size and visa versa? ya know what I mean or should I "splain" more.
JohnnyRoy wrote on 3/28/2004, 3:22 PM
Unfortunately the Script API doesn’t expose the Track height so it can’t control whether the track is minimized or maximized. It can hide them altogether (and unhide them) but it can minimize, restore, or maximize them. (sorry) Maybe in Vegas 5?

~jr
JohnnyRoy wrote on 3/28/2004, 3:25 PM
> which means that tomorrow I would have spent a lot of time changing the aspect ratio

So now you have to spend that time doing something nice for someone else. That’s my price. Pass it on its contagious. ;-) (glad I could help)

~jr
RichR wrote on 3/28/2004, 4:24 PM
How about a script to set the Snap Offset to a specific time. I think this would be a great timesaver when dragging clips to overlap .

thanks, Rich
JohnnyRoy wrote on 3/28/2004, 6:20 PM
I modified the ChangeMediaPoolAspectRatio script to get the aspect ratio from the project so that you can easily change the aspect ratio without having to modify the script. (it was a one line change) I assume this was the reason for wanting to match the aspect ratio in the first place.

If not you can just override it like before but I thought this one line change gave it more flexibility. If you don’t want the aspect to match the project you can change it in the project just to tell the script what to use, run this script, and then change it back in the project to what you wanted. I hope this makes it more useful.

~jr
JohnnyRoy wrote on 3/28/2004, 6:29 PM
Rich, Wow I didn’t even know what an event snap offset was until I looked it up. That would be a timesaver. Unfortunately, the events snap offset is not exposed in the scripting API. Darn, I would have liked that one myself.

~jr
Erk wrote on 3/28/2004, 9:09 PM
Johnny,

Great scripts, many thanks.

Question: I tried to modify the "find overlap and gaps" script to just find gaps. I see your comment about "use the first line instead" but I'm afraid I don't understand exactly which sections of the original script to cut out.

Thanks for your advice.

Greg
aspenv wrote on 3/28/2004, 11:16 PM
Johnny, I tested the last change on the script and, although useful, it does not serve to the original need anymore since sometimes I want my project to be regular 4x3 although my footage is 16x9. That is because I want to output a letterboxed version automatically. Having the clip set to 1.2121 gives me the option to go letterboxed or widescreen depending on the project's properties, whereas, if the clips match the project's properties I have no option. Thanks nevertheless for your willingness to improve what was already perfect...at least for me!
btw, your script changed the aspect ratio of 496 clips in less than a second.!!... and that was only footage from 2 tapes...I still have 7+ more to go!! Thanks!
JohnnyRoy wrote on 3/29/2004, 4:18 AM
You have the wrong Johnny. ;-) You’re referring to one of John Meyer’s scripts but I can help you with that as well. Here’s what John put in his script:
      // To only test for gaps only, use the first line below instead
// if ( ( (test1 - test2) > 0.05 ) && ( (test1 - test2) < Gap ) ) {

if ( ( Math.abs(test1 - test2) > 0.05 ) && (Math.abs(test1 - test2) < Gap) ) {
In order to only test for gaps, you must uncomment the first line by removing the "//" in front of it, and comment out the second line by adding a "//" in front of it so it looks like this:
      // To only test for gaps only, use the first line below instead
if ( ( (test1 - test2) > 0.05 ) && ( (test1 - test2) < Gap ) ) {

// if ( ( Math.abs(test1 - test2) > 0.05 ) && (Math.abs(test1 - test2) < Gap) ) {
Any time the JScript interpreter sees the double slash "//" in ignores everything after it for the remainder of the line. This is how you add comments to your code or even hide lines of code you don’t want to execute. John Meyer was doing the latter.

Does that make sense now? If not, I’ll try and explain it a different way. I know its hard for non-programmers to modify scripts. We who write them assume its obvious to everyone but its not. I’ve been programming for 20+ years so I’ve been quite conditioned to looking at code and figuring it out.

~jr
JohnnyRoy wrote on 3/29/2004, 4:23 AM
> …although useful, it does not serve to the original need anymore since sometimes I want my project to be regular 4x3 although my footage is 16x9.

That’s important for me to understand since I only shoot in 4:3 and never played with trying to make it look widescreen. I’ll continue to work on it then, to add a dialog box that allows you to select from a dropdown list. Thanks for the feedback.

~jr
cityanimal wrote on 3/29/2004, 9:55 AM
Is there a script for batch rendering a number of Vegas projects to avi? I work in long form documentary projects and often have to re-render short individual sections that are eventually assembled into the final film project. To date I have had to manually begin rendering each. I would love to be able to work on a number of sections, save them and then put then into a batch render queue. Any feedback would be greatly appreciated?

jetdv wrote on 3/29/2004, 10:50 AM
For multiple projects, take a look at BatchRender Pro.
JohnnyRoy wrote on 3/29/2004, 11:47 AM
Take a look at RenderQueue.js from the Vegas Scripts at Ayizwe.net web site. I’ve never used it but it looks like it should do the trick.

~jr
Erk wrote on 3/30/2004, 4:07 PM
Johnnyroy,

Thanks for the quick lesson on modifying that gaps/overlap script. Now I understand, and it works.

And thanks to John Meyer for the original script. Sorry to confuse you guys, but both of you are two extremely helpful Johns (uh, that didn't come out quite right....)

Greg
RichR wrote on 3/30/2004, 7:18 PM
yeah, a script for this would be a great timesaver. Too late for inclusion in V5 I suppose.