Cut clip every x seconds.

lenox-b wrote on 3/1/2021, 4:01 AM

Is there any way to split the clips at given intervals (I would prefer a range. ie: every 20 to 40 seconds) I'm a software developer, so if there is a 192.168.1.254 script available I could adjust it. 10.0.0.0.1

 

Thanks.

Comments

Marco. wrote on 3/1/2021, 5:50 AM

Try this:

import ScriptPortal.Vegas; 
import System.Windows.Forms;
import Microsoft.Win32;

var Interval = "00:20:00";

try
{

var IncTime : Timecode = new Timecode(Interval);

for (var track in Vegas.Project.Tracks) {
for (var evnt in track.Events) {
if (!evnt.Selected || evnt.MediaType != MediaType.Video) continue;

evnt.Split(IncTime);

}
}

}

catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}

 

jetdv wrote on 3/1/2021, 11:32 AM

While that should work, it's kind of an accident that it does. While going through the events, it will continue to split that original event at interval simply because it's creating new events in the process and you're always moving "to that next event" which is now a new event. Also, it doesn't check to see if the event is long enough for the split to work. When using the "split" command, "evnt" would still be the left side of the split so simply because it's going through all events on the track and a new event was created is why it will work.

TrackEvent rightEvent = evnt.Split(splitamt);

evnt is left of the split (i.e. the original event), rightEvent is right of the split.