Delete n frames at event boundaries

johnmeyer wrote on 5/29/2003, 12:15 PM
I have hundreds of hours of VHS video taken with first-generation VHS recorders. Each time the camera was started, the AGC on the audio would take about six frames to come up to normal, and the video would rainbow (no flying erase heads).

I can capture this video, using SCLive's optical scene detection, into separate video files. What I would like to do is use a script to select and delete the first n frames of each event (where n will usually be 5 or 6) in order to get beyond the audio and video glitching. Since the optical scene detection is not perfect, some "scenes" aren't really new scenes. Therefore, I have to look at each scene and then decide whether to run this script. Thus, the script doesn't need to find the next event; it merely needs to select a few frames and then delete them.

Is there such a script, or does anyone know of a script that includes frame selection and deletion? It is within my abilities to modify such a script, but I just don't have the time to start from scratch given the large number of API calls that I'd have to wade through, and the syntax I'd have to master.

Thanks!

Comments

jetdv wrote on 5/29/2003, 1:56 PM
Try this one. It ONLY chops the FRONT of selected clips. NOTE: To trim both the audio and video, they must BOTH be selected.

If you don't want to copy the script from below, it has been submitted and will, hopefully, be posted shortly at:

http://www.creativecow.net/articles/vegas_scripts.html


It is called: ChopOffFront.js




/**
* This script will chop off the front of a clip by the specified number of frames
*
* Written By: Edward Troxel
* www.jetdv.com/tts
* Modified: 05-29-2003
**/

import System;
import System.IO;
import System.Windows.Forms;
import SonicFoundry.Vegas;


try {
//Change this line to change the number of frames to chop!
var ChopDist : Timecode = new Timecode("00:00:00:06"); //This is 6 frames
var mtc : Double;

//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.Selected) {

mtc = ChopDist.ToMilliseconds();
var dStart : Double = evnt.Start.ToMilliseconds();
var dLength : Double = evnt.Length.ToMilliseconds();
var dStart = dStart + mtc;
var dLength = dLength - mtc;

evnt.AdjustStartLength(new Timecode(dStart), new Timecode(dLength), false);

}
eventEnum.moveNext();
}
trackEnum.moveNext();
}


} catch (e) {
MessageBox.Show(e);
}
johnmeyer wrote on 5/30/2003, 12:04 AM
I don't know how to thank you enough. This is close enough to what I'm looking for that I can take it from here. I'll add some lines to make sure that all tracks are selected and that ripple edit is turned on, and I'll have it.

Again, thank you!

John
jetdv wrote on 5/30/2003, 9:12 AM
You're welcome. Let us see your final result :-)

It currently works with all selected EVENTS (you mentioned that some events would not need to be adjusted). It doesn't matter what tracks are selected as long as you select both audio and video for all CLIPS to be adjusted.

Ripple Edit will make no difference. To get the clips to move, you will have to programatically tell them where to move.

Edward
johnmeyer wrote on 5/31/2003, 7:00 PM
Edward,

Thanks for the additional tips. I'm working on a track meet project that needs to be done quickly, and I have "social engagements" to attend to. I should be able to do the script on Monday, and when I'm satisfied it works, I'll post the result here.

John