These two scripts are designed to let you complete a "cuts-only" editing project as quickly as possible. I usually do my rough cuts with these script by putting the video on tack one, and the audio below, and then start the edits, with no other tracks. However, the scripts work just fine if you have lots of tracks. Just make sure you select the video track you want to work on, and make sure the audio for that track is on the track directly below. Also, if you have a multi-track project, these scripts will not ripple the other tracks.
So, here goes.
If you want to become a cuts-only editing speed demon, you need to:
1. Develop a rhythm.
2. Minimize your movements (keyboard and/or mouse).
3. Eliminate thinking.
Everyone develops a different editing style, so what I've developed here may or may not work for you. However, give it a try and see. Here is how I use these two scripts.
1. Put the scripts in the directory where you have your other scripts.
2. Use the Keyboard tab in the Options menu to assign keyboard shortcuts to these two scripts. I use Ctrl-1 for the script that deletes from the cursor to the beginning of the event, and Ctrl-2 for the script that deletes the event under the cursor.
3. Put your video on the timeline, and start at the beginning of the timeline.
4. Scrub through the video using the J-K-L keys. You can set the scrub speed range in the Edit tab of Options menu. I use the default (Medium). When you get to a point where you want to edit, you have three decisions to make:
a. You don't like anything you've seen in this event up to the current location, but you just reached the good stuff and want to keep everything from this point until some point later. In this case simply press Ctrl-1 (delete from cursor to beginning of event) and everything from the current cursor location to the beginning of the event is deleted; and the cursor is positioned at the beginning of the event (which is the same frame of video at which you were already located). All later events are rippled (it doesn’t matter if ripple edit is turned on or not — I usually keep it turned off when using these scripts). The event immediately following the new cursor location is selected, mostly to visually help you locate where you are.
b. The second scenario is where you like EVERYTHING up to this point, but now have come to a section you don't like. In this case, press the S key to split the event, and keep on scrubbing into the newly-created event. The S key automatically highlights the event I am moving into and de-selects the left side of the split. This is consistent with what happens in (a).
c. The final scenario is where you don't like anything in this event. I press Ctrl-2 and it deletes the event under the cursor, ripples all the subsequent events, moves the cursor to the beginning of what, prior to deleting the event, was the next event, and highlights that event to show you where you are.
Thus, to delete to the left of the cursor, you press the left-most key combination (Ctrl-1), and to delete under the cursor or to the right, you press the right-most key combination (Ctrl-2). To split the event, you simply press S. The whole left-right thing is also consistent with the J-K-L shuttle combination. I suppose to be totally consistent, you could assign the split function to Ctrl-2 and then assign the delete event under the cursor to Ctrl-3.
With these scripts you don't have to worry about what event is selected or not selected. All that matters is the cursor location and the track selection. This eliminates all sorts of errors that can happen if you accidentally have more than one event selected and press the delete key. Also, since the ripple is handled by the scripts, you don't get the surprises that Vegas' own ripple editing sometimes provides.
Here's the script that cuts from the current cursor location to the beginning of the event. I posted an earlier version of this a year ago, but this has been refined somewhat, and works with 5.0b.
Here's the script that deletes the event under the cursor:
So, here goes.
If you want to become a cuts-only editing speed demon, you need to:
1. Develop a rhythm.
2. Minimize your movements (keyboard and/or mouse).
3. Eliminate thinking.
Everyone develops a different editing style, so what I've developed here may or may not work for you. However, give it a try and see. Here is how I use these two scripts.
1. Put the scripts in the directory where you have your other scripts.
2. Use the Keyboard tab in the Options menu to assign keyboard shortcuts to these two scripts. I use Ctrl-1 for the script that deletes from the cursor to the beginning of the event, and Ctrl-2 for the script that deletes the event under the cursor.
3. Put your video on the timeline, and start at the beginning of the timeline.
4. Scrub through the video using the J-K-L keys. You can set the scrub speed range in the Edit tab of Options menu. I use the default (Medium). When you get to a point where you want to edit, you have three decisions to make:
a. You don't like anything you've seen in this event up to the current location, but you just reached the good stuff and want to keep everything from this point until some point later. In this case simply press Ctrl-1 (delete from cursor to beginning of event) and everything from the current cursor location to the beginning of the event is deleted; and the cursor is positioned at the beginning of the event (which is the same frame of video at which you were already located). All later events are rippled (it doesn’t matter if ripple edit is turned on or not — I usually keep it turned off when using these scripts). The event immediately following the new cursor location is selected, mostly to visually help you locate where you are.
b. The second scenario is where you like EVERYTHING up to this point, but now have come to a section you don't like. In this case, press the S key to split the event, and keep on scrubbing into the newly-created event. The S key automatically highlights the event I am moving into and de-selects the left side of the split. This is consistent with what happens in (a).
c. The final scenario is where you don't like anything in this event. I press Ctrl-2 and it deletes the event under the cursor, ripples all the subsequent events, moves the cursor to the beginning of what, prior to deleting the event, was the next event, and highlights that event to show you where you are.
Thus, to delete to the left of the cursor, you press the left-most key combination (Ctrl-1), and to delete under the cursor or to the right, you press the right-most key combination (Ctrl-2). To split the event, you simply press S. The whole left-right thing is also consistent with the J-K-L shuttle combination. I suppose to be totally consistent, you could assign the split function to Ctrl-2 and then assign the delete event under the cursor to Ctrl-3.
With these scripts you don't have to worry about what event is selected or not selected. All that matters is the cursor location and the track selection. This eliminates all sorts of errors that can happen if you accidentally have more than one event selected and press the delete key. Also, since the ripple is handled by the scripts, you don't get the surprises that Vegas' own ripple editing sometimes provides.
Here's the script that cuts from the current cursor location to the beginning of the event. I posted an earlier version of this a year ago, but this has been refined somewhat, and works with 5.0b.
/**
* PURPOSE OF THIS SCRIPT:
*
* Delete frames from cursor to start of event, and then move all events to the left by n frames.
*
*
* A video track must be selected. If an audio track is selected, nothing happens.
* The video event on the track that lies beneath the cursor
* will be shortened from the cursor to the start of the event.
* If the track beneath the video track contains audio, the audio event in that track
* that lies beneath the cursor will also be shortened by the same number of frames.
*
* Copyright © John Meyer 2004
* Written: June 4, 2003
* Updated: September 23, 2004
*
**/
import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;
try {
//Global declarations
var dStart : Double;
var dLength : Double;
var dCursor : Double;
var trackEnum : Enumerator;
var evnt : TrackEvent;
var EventBegin : Timecode = Vegas.Cursor; // Use this to move cursor position.
var track = FindSelectedTrack(); // Use this function to find the first selected track.
var eventEnum = new Enumerator(track.Events);
var BeyondCursor : boolean = false; // This flag used to notify if event is to right of cursor.
if (track.IsVideo()) { // Proceed only if selected track is video track.
if ( TrimEventAtCursor() ) { // Function that trims event and moves all remaining events on track left.
// Get set to look at track directly below the video track.
BeyondCursor = false;
trackEnum.moveNext(); // Go to next track.
if (!trackEnum.atEnd()) { // Only proceed if there is a track below the video track.
track = Track(trackEnum.item()); // When doing the first track (above), these two lines were executed
eventEnum = new Enumerator(track.Events); // in the FindSelectedTrack() function.
if (track.IsAudio()) { // Only trim the event if this is an audio track.
TrimEventAtCursor();
}
}
}
}
Vegas.UpdateUI();
// Move cursor to start of selected event (cursor stays at same media location).
Vegas.Cursor = EventBegin; // Remove this line to keep cursor in same location.
} catch (e) {
MessageBox.Show(e);
}
// End of main program
// Beginning of functions
function FindSelectedTrack() : Track {
trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());
if (track.Selected) {
return track;
}
trackEnum.moveNext();
}
return null;
}
/**
*
* The following function finds the event on the selected track
* that lies under the cursor. It also deselects all other events.
*
**/
function TrimEventAtCursor() {
var EventFound : boolean = false; // Function returns false if no video media under cursor.
var DeleteFrames : Timecode = new Timecode("00:00:00:00");
var DeleteTime : Double = DeleteFrames.ToMilliseconds();
dCursor = Vegas.Cursor.ToMilliseconds(); // Remember the cursor position.
//Go through each event on the track.
while (!eventEnum.atEnd()) {
evnt = TrackEvent(eventEnum.item());
evnt.Selected = false; // De-select the event
// Get the event's start and length timecode, in milliseconds.
dStart = evnt.Start.ToMilliseconds();
dLength = evnt.Length.ToMilliseconds();
if (BeyondCursor) { // Move, but don't truncate events to the right of the event under the cursor.
// evnt.Start=evnt.Start-DeleteFrames; // Use this line for versions of Vegas prior to 4.0d
evnt.AdjustStartLength(evnt.Start-DeleteFrames, evnt.Length, true); // Use this line with 4.0d and beyond.
}
/**
* If the cursor timecode is between the beginning and end of the
* event timecodes, then select the event, and trim start by n frames.
* Move selected event and all events to right of cursor to left by n frames.
**/
if ( (dCursor >= dStart) && ( dCursor < (dLength + dStart) ) ) {
evnt.Selected = true; // Select this event.
EventFound = true;
BeyondCursor = true; // Remaining events are to right of cursor.
DeleteFrames = Vegas.Cursor - Timecode(evnt.Start);
DeleteTime = DeleteFrames.ToMilliseconds();
EventBegin = evnt.Start;
dLength = dLength - DeleteTime;
// Next two lines truncate start of event, and then move it left
// by the same amount that it was truncated.
evnt.AdjustStartLength(new Timecode(dStart), new Timecode(dLength), false);
evnt.ActiveTake.Offset = DeleteFrames+evnt.ActiveTake.Offset;
}
eventEnum.moveNext(); // Go to next event on this timeline.
}
return EventFound;
}
Here's the script that deletes the event under the cursor:
/**
* PURPOSE OF THIS SCRIPT:
*
* Delete the event under the cursor, including the associated audio.
* Ripple remaining events on the video and associated audio tracks (but not on other tracks).
* Select the event that "ripples into" the space left by the deleted event,
* and then put the cursor at the beginning of this event.
*
* A video track must be selected. If an audio track is selected, nothing happens, and you get an error message.
* If the track beneath the video track contains audio, the audio event in that track
* that lies beneath the cursor will also be deleted, and subsequent events rippled.
*
* Since the audio for a video event is sometimes shorter, the length of the video event is used
* to ripple the audio event, to make sure everything lines up the same way as it did prior to the ripple.
*
* Also, Vegas has all sorts of crazy internal roundoff errors which cause problems when the cursor
* is on the event boundary, so a "slop" variable is used to "forgive" slight errors. If you set this
* variable to zero, you will get strange behavior -- but only sometimes -- when the cursor is at the event
* boundaries.
*
* (One side note: This roundoff can cause problems when using Vegas without scripts -- beware.)
*
* Copyright © John Meyer 2004
* Written: September 23, 2004
* Tested on Vegas 5.0b
*
**/
import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;
try {
//Global declarations
var dStart : Double; // Start of event
var dLength : Double; // Length of event
var dCursor : Double; // Current cursor position
var NewCursorPos : Timecode; // Used to position cursor at start of next event, after deletion
var RippleLength = new Timecode("00:00:00:00");
var dSlop : Double = 0.1; // Variable needed because Vegas is sloppy and doesn't
// make audio and video exactly the same length
var trackEnum : Enumerator;
var evnt : TrackEvent;
var track = FindSelectedTrack(); // Function to find the first selected track.
var eventEnum = new Enumerator(track.Events); // List of events on this track
if (track.IsVideo()) { // Proceed only if selected track is video track.
if ( SelectEventAtCursor() ) { // Function that selects and removes event under cursor.
trackEnum.moveNext(); // If success on video track, go to next track.
if (!trackEnum.atEnd()) { // Only proceed if there is a track below the video track.
track = Track(trackEnum.item());
if (track.IsAudio()) { // Only trim the event if this is an audio track.
eventEnum = new Enumerator(track.Events);
SelectEventAtCursor();
} // End If track.IsAudio()
} // End If !trackEnum.atEnd()
} // End If SelectEventAtCursor()
Vegas.Cursor = NewCursorPos ; // Before finishing, put cursor at beginning of event
} // immediately after deleted event.
else {
MessageBox.Show ("You need to select the video track, not the audio track", "Alert");
} // End track.IsVideo()
Vegas.UpdateUI(); // Update the UI.
} // End try
catch (e) {
MessageBox.Show(e);
}
// End of main program
// Beginning of functions
function FindSelectedTrack() : Track {
trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());
if (track.Selected) {
return track;
}
trackEnum.moveNext();
}
return null;
}
/**
*
* The following function finds, selects, then deletes the event on the selected track
* that lies under the cursor. It also deselects all other events on the selected track.
*
**/
function SelectEventAtCursor( ) {
var EventFound : boolean = false; // Function returns false if no video media under cursor.
dCursor = Vegas.Cursor.ToMilliseconds(); // Remember the cursor position.
while (!eventEnum.atEnd()) { // Go through each event on the track.
evnt = TrackEvent(eventEnum.item()); // Get next event
evnt.Selected = false; // De-select the event
dStart = evnt.Start.ToMilliseconds(); // Get the event's start and
dLength = evnt.Length.ToMilliseconds(); // length timecode, in milliseconds.
// If the cursor timecode is between the beginning and end of the
// event timecodes, then select and delete the event.
if ( (dCursor >= dStart) && ( dCursor < (dStart + dLength - dSlop) ) ) {
evnt.Selected = true; // Select this event.
EventFound = true; // Notify calling function that event was found
if (RippleLength.ToMilliseconds()<1) { // If ripple length was previously set to video length,
RippleLength = evnt.Length; // (i.e., it is non-zero) don't reset. Use video length
} // to ripple audio (because audio may not be same length as video)
NewCursorPos = evnt.Start; // At end of script, move cursor to where this event used to start
track.Events.Remove(evnt); // Remove the event
eventEnum = new Enumerator(track.Events); // Removing the event screws up enumeration, so start over
evnt = TrackEvent(eventEnum.item());
dStart = evnt.Start.ToMilliseconds(); // Recompute the event's start and
dLength = evnt.Length.ToMilliseconds(); // Recompute length timecode, in milliseconds.
} // End If dCursor (etc.)
if ( (dCursor < dStart) ) { // If cursor is to left of this event, then ripple.
evnt.AdjustStartLength(evnt.Start - RippleLength, evnt.Length, true);
dStart = evnt.Start.ToMilliseconds(); // Event has moved, so recompute the event's start and
dLength = evnt.Length.ToMilliseconds(); // length timecode, in milliseconds.
if ( (dCursor >= dStart) && ( dCursor < (dLength + dStart) ) ) {
evnt.Selected = true; // Select the event that "replaced" the removed event
}
} // End if ( (dCursor < dStart) )
eventEnum.moveNext(); // Go to next event on this timeline.
}
return EventFound;
}