Have these scripts been written?

NickHope wrote on 4/9/2008, 9:17 AM
I prefer to archive raw HDV footage and correct/adjust again later in future projects. So before I archive footage from a project I use Edward Troxel's "RemoveAllEffects" script which is a great productivity aid.

I was wondering if there is a script to remove all gain event envelopes and/or event opacity envelopes. At the moment I do this manually, event by event.

Similarly is there a script to remove all overlaps between events. Basically shuffling all the events out along the timeline so there are no overlaps. I remember there being a script to "close all gaps" and I basically mean the reverse of this.

If they don't exist and if one of you coding types needs a break from your editing, a "RemoveEventEnvelopes" and "RemoveEventOverlaps" scripts would be more than welcome!

Comments

baysidebas wrote on 4/9/2008, 11:04 AM
Pardon me if I appear dense but, since Vegas doesn't in any way change the raw footage, isn't that the "archive" you're seeking? Or are you looking to archive edited footage, even though you clearly specified "raw HDV footage?"
JohnnyRoy wrote on 4/9/2008, 12:41 PM
> I was wondering if there is a script to remove all gain event envelopes and/or event opacity envelopes. At the moment I do this manually, event by event.

Ultimate S3 has a Force Opacity option on the Audit tab. It will set all event opacities to 100%. I'm not sure what you mean by gain. Do you mean audio event volume? I don't believe that is scriptable.

> Similarly is there a script to remove all overlaps between events.

In Ultimate S3 the Audit for Gaps has a tolerance and an option to remove them. Just make the tolerance large (like 1 hr) and it will align all of the events without any gaps (unless there is a gap longer than 1 hr) ;-)

BTW, Ultimate S3 also has tools to remove all Audio and Video FX.

~jr
johnmeyer wrote on 4/9/2008, 1:55 PM
I have an audit script, posted over at VASST, that will flag any event whose opacity or volume (depending on whether it is video or audio) has been accidentally "nudged" to something slightly below 100%. I just did a quick mod on that, and it now sets all events in the entire project to 100%.

To be consistent with the Forum layout, I posted the actual script in the Vegas Script section here:

Script to set all events to 100%
johnmeyer wrote on 4/9/2008, 2:16 PM
Here is a link to another script that removes all gaps and overlaps and also removes any resulting fades. Note that running this script may result in audio and video events becoming unsynced, depending on how they are lined up in the original project.

Script to remove all gaps and overlaps
jetdv wrote on 4/9/2008, 8:05 PM
Excalibur also has tools that do all of the above.
NickHope wrote on 4/9/2008, 11:49 PM
Thanks for all the replies and John, you are amazingly helpful. Thanks very much indeed!

>> Pardon me if I appear dense but, since Vegas doesn't in any way change the raw footage, isn't that the "archive" you're seeking? Or are you looking to archive edited footage, even though you clearly specified "raw HDV footage?" <<

baysidebas, sorry it wasn't clear. I dump all my scene-analysed events on the timeline then cut them to length and put effects etc on to make DVDs. Then later I want to smart-render the events to my archive at the edited lengths but without the effects, envelopes etc..

>> I'm not sure what you mean by gain. Do you mean audio event volume? I don't believe that is scriptable. <<

JohnnyRoy, I meant the dark blue line that can be dragged up and down on an audio event, and/or faded at the ends of the audio event. I was just trying to use the same terminology that I think the manual uses.

I've now combined Ed and John's scripts into one script that I call "PrepareForArchiving.js". I removed the need to select events in Ed's RemoveAllEffects.js. No doubt my hacked-together script could be a little more elegant but it's working perfectly for me in Vegas Pro 8.0b. Thanks again everyone. Not sure where to post this now so I'll just post it here:

/**
* This script removes all effects from video events, sets all events to 100%,
* deletes empty space between events, removes all overlaps between events,
* and removes all event fades on all tracks.
* No attempt is made to synchronize audio and video events.
*
* Written by Nick Hope based on RemoveAllEffects.js by Edward Troxel
* www.jetdv.com/tts and scripts written by John H. Meyer
*
* Date: April 10, 2008
*
**/

import System;
import System.Collections;
import System.Text;
import System.IO;
import System.Drawing;
import System.Windows.Forms;
import Sony.Vegas;

try {

//Go through the list of Tracks
var trackEnum = new Enumerator(Vegas.Project.Tracks);

while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());

//Go through the list of Events
var eventEnum = new Enumerator(track.Events);

while (!eventEnum.atEnd()) {
var evnt : TrackEvent = TrackEvent(eventEnum.item());

if (evnt.IsVideo()) {
var videoEvent = VideoEvent(evnt);
var i;
for (i=videoEvent.Effects.Count - 1; i >= 0; i--) {
var effect = videoEvent.Effects[i];
videoEvent.Effects.Remove(effect);
}
}

evnt.FadeIn.Gain = 1; // Correct the problem

eventEnum.moveNext();

} // End While eventEnum

trackEnum.moveNext();

} // End While trackEnum

// step through all selected video events:
for (var track in Vegas.Project.Tracks) {

var tracktime = track.Events.Item(0).Start;
var Fadelength : Timecode = new Timecode("00:00:00.00");

for (var evnt in track.Events) {

evnt.AdjustStartLength(tracktime,evnt.Length,false);
evnt.FadeIn.Length = new Timecode(Fadelength);
evnt.FadeOut.Length = new Timecode(Fadelength);

// Take currTake = evnt.ActiveTake;
// Timecode currOffset = currTake.Offset;
// evnt.Start = tracktime;
// currTake.Offset = currOffset;

tracktime = tracktime + evnt.Length;

}
}

}

catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
johnmeyer wrote on 4/10/2008, 12:04 AM
If it is working, don't fix it. However, FWIW, I did eventually figure out how to get the code from Ed (which is commented out above) to work. I forgot that he doesn't use jscript anymore, so the declarations have to be different. You can go back to the script forum and use the "newer" code, but if the above works in your version of Vegas, you should probably just leave it alone.
NickHope wrote on 4/10/2008, 12:12 AM
Thanks John I used the new code and it works fine. Why is it "better"? Script now looks like this:

/**
* This script removes all effects from video events, sets all events to 100%,
* deletes empty space between events, removes all overlaps between events,
* and removes all event fades on all tracks.
* No attempt is made to synchronize audio and video events.
*
* Written by Nick Hope based on RemoveAllEffects.js by Edward Troxel
* www.jetdv.com/tts and scripts written by John H. Meyer
*
* Date: April 10, 2008
*
**/

import System;
import System.Collections;
import System.Text;
import System.IO;
import System.Drawing;
import System.Windows.Forms;
import Sony.Vegas;

try {

//Go through the list of Tracks
var trackEnum = new Enumerator(Vegas.Project.Tracks);

while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());

//Go through the list of Events
var eventEnum = new Enumerator(track.Events);

while (!eventEnum.atEnd()) {
var evnt : TrackEvent = TrackEvent(eventEnum.item());

if (evnt.IsVideo()) {
var videoEvent = VideoEvent(evnt);
var i;
for (i=videoEvent.Effects.Count - 1; i >= 0; i--) {
var effect = videoEvent.Effects[i];
videoEvent.Effects.Remove(effect);
}
}

evnt.FadeIn.Gain = 1; // Correct the problem

eventEnum.moveNext();

} // End While eventEnum

trackEnum.moveNext();

} // End While trackEnum

// step through all selected video events:
for (var track in Vegas.Project.Tracks) {

var tracktime = track.Events.Item(0).Start;
var Fadelength : Timecode = new Timecode("00:00:00.00");

for (var evnt in track.Events) {

var currTake : Take = evnt.ActiveTake;
var currOffset : Timecode = evnt.ActiveTake.Offset;
evnt.Start = tracktime;
currTake.Offset = currOffset;

evnt.FadeIn.Length = new Timecode(Fadelength);
evnt.FadeOut.Length = new Timecode(Fadelength);

tracktime = tracktime + evnt.Length;

}
}

}

catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
johnmeyer wrote on 4/10/2008, 1:27 AM
It is not really better, except that it avoids incompatibilities between various versions of Vegas. The single line I originally used is much simpler, but the results you get are different from one version of Vegas to the next. Since it was working (and you would instantly know if it wasn't because the events wouldn't go to the right places), you didn't really need to change it.
jetdv wrote on 4/10/2008, 6:14 AM
You should also be able to combine them both to a single loop so you don't have to go through all tracks and events twice. Here's a combined version (BUT I DID NOT TEST IT).


/**
* This script removes all effects from video events, sets all events to 100%,
* deletes empty space between events, removes all overlaps between events,
* and removes all event fades on all tracks.
* No attempt is made to synchronize audio and video events.
*
* Written by Nick Hope based on RemoveAllEffects.js by Edward Troxel
* www.jetdv.com/tts and scripts written by John H. Meyer
*
* Date: April 10, 2008
*
**/

import System;
import System.Collections;
import System.Text;
import System.IO;
import System.Drawing;
import System.Windows.Forms;
import Sony.Vegas;

try {
var Fadelength : Timecode = new Timecode("00:00:00.00");

//Go through the list of Tracks
for (var track in Vegas.Project.Tracks) {
var tracktime = track.Events.Item(0).Start;

//Go through the list of Events
for (var evnt in track.Events) {

if (evnt.IsVideo()) {
var videoEvent = VideoEvent(evnt);
var i;
for (i=videoEvent.Effects.Count - 1; i >= 0; i--) {
var effect = videoEvent.Effects;
videoEvent.Effects.Remove(effect);
}
}

evnt.FadeIn.Gain = 1; // Correct the problem
evnt.FadeIn.Length = new Timecode(Fadelength);
evnt.FadeOut.Length = new Timecode(Fadelength);

var currTake : Take = evnt.ActiveTake;
var currOffset : Timecode = evnt.ActiveTake.Offset;
evnt.Start = tracktime;
currTake.Offset = currOffset;


tracktime = tracktime + evnt.Length;

} // End event loop


} // End track loop


}

catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
NickHope wrote on 4/10/2008, 7:14 AM
Thanks Edward but that version doesn't remove the effects. Not sure why. Tested in 8.0b.
jetdv wrote on 4/10/2008, 11:09 AM
Looking at the code, I can't see why it wouldn't remove them exactly the same way the other one did.
NickHope wrote on 4/10/2008, 12:51 PM
The opacity/gain/gaps/overlaps/fades all go but color balance effects I put on a couple of events still remain whether I selet the events before running the script or not.

Anyway this is not likely to be a hugely used script so don't worry about it. I'll just use the longer one that worked. Thanks for looking at it and for the original script.
johnmeyer wrote on 4/10/2008, 2:48 PM
Nick & Ed,

The script Ed provided has one problem in that he forgot the index in the remove effects line.

var effect = videoEvent.Effects[ i ];

rather than this:

var effect = videoEvent.Effects;

[Edit] Oh, wait a second, I see the problem. Ed used the letter "i" as the index (which is a normal programming convention), but when put in between brackets [ i ], the Sony Vegas forum software thinks that you want to create italics, and the index disappears !!

So, I am sure that Ed posted the correct code, but then the forum software screwed it up.

So, I have edited the above (and below) and put spaces between the brackets and the letter "i". I just checked, and the script runs just fine with the extra spaces, so if you want to use it, you don't need to edit anything.

Also, either he or Nick didn't get the order correct when combining the scripts and as a result, the fades are not removed from the audio events that previously had been cross-faded. The script below solves those problems:


/**
* This script removes all effects from video events, sets all events to 100%,
* deletes empty space between events, removes all overlaps between events,
* and removes all event fades on all tracks.
* No attempt is made to synchronize audio and video events.
*
* Written by Nick Hope based on RemoveAllEffects.js by Edward Troxel
* www.jetdv.com/tts and scripts written by John H. Meyer
*
* Date: April 10, 2008
*
**/

import System;
import System.Collections;
import System.Text;
import System.IO;
import System.Drawing;
import System.Windows.Forms;
import Sony.Vegas;

try {
var Fadelength : Timecode = new Timecode("00:00:00.00");

//Go through the list of Tracks
for (var track in Vegas.Project.Tracks) {
var tracktime = track.Events.Item(0).Start;

//Go through the list of Events
for (var evnt in track.Events) {

if (evnt.IsVideo()) {
var videoEvent = VideoEvent(evnt);
var i;
for (i=videoEvent.Effects.Count - 1; i >= 0; i--) {
var effect = videoEvent.Effects[ i ];
videoEvent.Effects.Remove(effect);
}
}

var currTake : Take = evnt.ActiveTake;
var currOffset : Timecode = evnt.ActiveTake.Offset;
evnt.Start = tracktime;
currTake.Offset = currOffset;

evnt.FadeIn.Gain = 1; // Correct the problem
evnt.FadeIn.Length = new Timecode(Fadelength);
evnt.FadeOut.Length = new Timecode(Fadelength);

tracktime = tracktime + evnt.Length;

} // End event loop


} // End track loop


}

catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
jetdv wrote on 4/10/2008, 8:01 PM
Thanks for actually testing it and working out the details, John. I just hated to see it go through every event on the timeline twice when once was sufficient.

Since the extra codes aren't recognized inside a "code" block, perhaps they should be ignored!
johnmeyer wrote on 4/10/2008, 9:58 PM
Yeah, I think that is a forum bug. The whole idea of having a code block, other than getting rid of word-wrap and using mono-spaced fonts, is that it ought to display and copy exactly like the original.
NickHope wrote on 4/10/2008, 10:20 PM
Great. That works fine now. Ed I realised it was going through all the events twice but the syntax was different enough on each pass that it was too much for me to handle with basically zero knowledge. Thanks very much for your help guys.

A couple of things like that need fixing on the forum. Another one is allowing bigger pics, say up to 700px, so that text in screen grabs can be read.
NickHope wrote on 4/11/2008, 9:16 AM
Just before we let this one die, there is something bugging me on a related note.

Somewhere, sometime there was a script or plugin or technique or something in Vegas that was useful for finding accidental gaps in your tracks. But I can't remember what it was. It was something along the lines of "This is also useful for finding gaps in your timeline because it stops when it reaches a gap". I had a wasted encode the other day because there was a little 2 or 3 frame gap in my video track so this would have been useful and is something I would like to include in my future workflow, whatever it is.

A beer to the first person that can recall what am I thinking of. Anybody?
johnmeyer wrote on 4/11/2008, 9:29 AM
Somewhere, sometime there was a script or plugin or technique or something in Vegas that was useful for finding accidental gaps in your tracks ... A beer to the first person that can recall what am I thinking of. Anybody?

Wow, that's the easiest beer I've ever earned.

I wrote that script, and quite a few other scripts that "audit" your project for common mistakes. They save a HUGE number of headaches.

You can search for my scripts at VASST by typing my user name in the search box. The one you want is here:

http://www.vasst.com/resource.aspx?id=5a3b502a-db9d-435e-b8e1-bf66152c5161Audit for short blank gaps[/link]

This script finds short blank gaps or overlaps between events on the first selected track. The intent is to find those 1–2 frame gaps or overlaps that are all too easy to create in Vegas. You can change the script to increase or decrease the threshold used to detect gaps/overlaps.

You might also be interested in these additional audit scripts:

http://www.vasst.com/resource.aspx?id=b39f91c3-3c7a-4aa3-9fba-9240ac1d4631Audit for completely overlapped events[/link]

This Vegas 6 script finds all events on the selected track which completely overlap another event. This is almost never something you really want. Often, small event “slivers” get left behind during the editing process, some of them only one or two frames long. These are very difficult to find. This script will put a marker at each such event so you can delete or move them.

http://www.vasst.com/resource.aspx?id=26abf02b-ba1e-4f20-94d5-686b9530a30fAudit for event levels[/link]

This script finds all events where the opacity level has been set to a level only slightly less than 100%, or the audio level set to slightly less than 0dB. This usually is not intentional and results from accidentally moving the opacity or volume line while moving an event. Without this script, such an accident is very difficult to detect, and can result in long rendering times.


[Edit] I have other scripts that audit projects:

Audit Highlight events that contain duplicate fx
* This script will find and highlight all video events
* that contain more than one instance of the same fX.
* It also puts a marker at the start of each such event.
* You can then remove the duplicate fX if you did not intend
* to apply the same fX to the same event more than once.

It is very easy to accidentally duplicate fX if you use the "Paste Attributes" feature.

Audit (for no final keyframe)
* When placing stills on the video track in Vegas, most users
* want to animate those stills using keyframes in the pan/crop dialog for
* that event. Normally, there should be a keyframe at the beginning
* and at the end of such an event (there can be additional keyframes
* in the middle for more complicated moves). Unfortunately, Vegas contains
* a bug whereby when you change the length of such a still event after
* you have already added keyframes to the beginning and the end of the
* event, the keyframe at the start of the event stays at the start (as
* it should), but the keyframe at the end of the event does not stay
* at the end. This results in still picture animations that suddenly
* appear to freeze at the end of the event. These are sometimes
* difficult to spot, especially if the end of the event overlaps the
* next event.
*
* This script looks at each event on all video tracks.
* The script looks to see if there is a keyframe at the exact end
* of the event. If there is not, the script flags that event by placing
* a marker at its start.


jetdv wrote on 4/11/2008, 2:09 PM
Another auditor you might want to look at is the Project Inspector custom command (only for Vegas Pro 8) which looks for many common errors in your project. You can find more info about it on my website in the "Custom Commands" section.
johnmeyer wrote on 4/11/2008, 2:44 PM
Ed it too modest. Excalibur is a wonderful product that I use regularly, and it has sooo many useful functions, including auditing, many of which are more professional versions of my sorry hacks. I recommend it highly.
NickHope wrote on 4/12/2008, 12:06 AM
John, I think I owe you a whole crate by now.

Testing John's scripts and Ed's command now and they're looking very useful.

By the way Ed, your tooltips are wrong for "Short Gap Length".
jetdv wrote on 4/12/2008, 1:45 PM
I'll look into that. I bet I copied a tool and forgot to change the tip.