How Do I Add Markers To The Timeline Using A Script In VEGAS?

In this script we will look at Markers once again. First of all, we discuss the various types of markers allowed in Premiere. Then this script will look at markers in three different ways starting by adding a comment marker to every event on the timeline. After that, we will then add regions around every event on the timeline and show how to name those regions. This is a very quick way of adding new markers and regions to the timeline and could be used to render multiple regions into multiple files.

Markers can also be placed inside clips on the timeline as well as on the timeline itself. Finally, this script will look at the markers placed inside a clip on the timeline and then will put the exact same type of marker on the timeline in the exact same location. All of the details will be copied from the clip markers and added to the timeline markers.

Join us as we learn how to access all of the various details of each marker and add markers of all types to the timeline.

For the following code segments, please add them to the “Main” routine on the base test script after “myVegas = vegas;

Add a Marker to every clip on the timeline:

Track myTrack = myVegas.Project.Tracks[0];
foreach (TrackEvent evnt in myTrack.Events)
{
    Marker myMarker = new Marker(evnt.Start);
    myVegas.Project.Markers.Add(myMarker);
}

Add a Region to every clip on the timeline and name the region with the name of the clip.

Track myTrack = myVegas.Project.Tracks[0];
foreach (TrackEvent evnt in myTrack.Events)
{
    Region myRegion = new Region(evnt.Start, evnt.Length);
    myVegas.Project.Regions.Add(myRegion);
    myRegion.Label = evnt.ActiveTake.Name;
}

Promote all markers of all types from a clip to the main timeline.

Track myTrack = myVegas.Project.Tracks[0];
foreach (TrackEvent evnt in myTrack.Events)
{
    Media myMedia = evnt.ActiveTake.Media;
    foreach (MediaMarker mMarker in myMedia.Markers)
    {
        Marker myMarker = new Marker(evnt.Start + mMarker.Position);
        myVegas.Project.Markers.Add(myMarker);
        myMarker.Label = mMarker.Label;
    }
    foreach (MediaMarker mMarker in myMedia.Markers)
    {
        Region myRegion = new Region(evnt.Start + mRegion.Position, mRegion.Length);
        myVegas.Project.Regions.Add(myRegion);
        myRegion.Label = mRegion.Label;
    }
}

Please sign up here and leave comments with suggestions of tasks you would like to see automated. You can help guide the direction of these videos. Also, please subscribe to my YouTube channel.

Leave a Reply