View Full Version : Putting Videos on the timeline at correct TC


Garrett Low
March 20th, 2010, 11:34 AM
Is there a way to automate putting videos on a timeline at the correct TC? I'm looking for something similar to the way Vegas can import a Broadcast Wave File where it puts it at the TC of the starting point if the BWF.

Thanks,
Garrett

Edward Troxel
March 20th, 2010, 05:55 PM
Here's a script I wrote you should try out. Just take the script text, paste it into notepad, and save it as "MoveClipToTimestamp.cs". Then go to Tools - Scripting in Vegas and run it:


/**
* This script will move events to start at their timecode.
*
* Written By: Edward Troxel
* Modified: 07-04-2007
**/

using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Reflection;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;

public void FromVegas(Vegas vegas)
{
myVegas = vegas;

foreach (Track track in myVegas.Project.Tracks)
{
foreach(TrackEvent evnt in track.Events)
{
Media media = vegas.Project.MediaPool.Find(evnt.ActiveTake.MediaPath);
if (null == media)
{
MessageBox.Show("missing media");
throw new ArgumentException("missing media");
}

evnt.Start = media.TimecodeIn;
}
}

}



}

Garrett Low
March 21st, 2010, 11:56 AM
Hi Ed,

Thanks for the script. It works great. I'm not sure if it's because I have so many clips but it take me running it a few time before all of the clips get moved to the correct TC.

In the end it put all of them in the correct place though.

Thanks again,
Garrett

Edward Troxel
March 21st, 2010, 12:50 PM
It may be that it's placing events after other events on the track so that the ones it's missing come BEFORE the new location of the event being processed. So I can see how that might happen. It could be written in a more complicated method to avoid that but it's probably just as easy to run it multiple times. Glad to hear it properly works for you (even if after running multiple times).