Script to remove all gaps and overlaps

johnmeyer wrote on 4/9/2008, 2:15 PM
This script was requested here:

Have these scripts been written?

It removes all gaps and overlaps from all events, and also removes all resulting fades. However, there is no attempt to keep video and audio events synced up, so this may not be useful on all projects.

Copy the code below, paste it into Notepad, and save it with the extension "js".


/**
* Program:
* Description: This script deletes empty space between events,
* and removes all overlaps between events, and removes all event fades
* on all tracks.
* No attempt is made to synchronize audio and video events.
* Author: John Meyer
* April 9, 2007
*
**/

import Sony.Vegas;
import System.Windows.Forms;

try
{

// 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);
}

Comments

relaxvideo wrote on 6/21/2020, 3:24 AM

Hi

is it possible to remove all events which are covered by the topmost event?
I don't use any compositing, alpha channels, etc. just simple multicam hard cuts on my timeline.
But as soon as some event has an fx on it, Vegas renders all the below events too, which are not visible at all on the final render, just made my rendertime 2-3x longer.

many thanks!

#1 Ryzen 5-1600, 16GB DDR4, Nvidia 1660 Super, M2-SSD, Acer freesync monitor

#2 i7-2600, 32GB, Nvidia 1660Ti, SSD for system, M2-SSD for work, 2x4TB hdd, LG 3D monitor +3DTV +3D projectors

Win10 x64, Vegas22 latest