Is it possible to synchronize already cut clips with the original clip

andy-0 wrote on 4/28/2024, 2:15 PM

I have a project but I want to synchronize the clips that were cut with their respective places in the original uncut clips. Is there any way to do this? example: I have a small 5 second clip of a cut from a long clip of a 2 hour video and I want to find its original position in this video without having to search for it manually. Is there a function that does this in Vegas Pro 17?

Comments

jetdv wrote on 4/29/2024, 7:46 AM

I'm going to say yes but I'm sure it would require a script and I'd need to play with it a bit to see how to do this.

NoKi wrote on 4/29/2024, 9:04 AM

Does the media file has timecode? If not, you have to set the "Timecode Start" to 00:00:00:00 manually (maybe not even needed) for the 2h source file in the media window. Then, this script might work, if the long and the short events are on different tracks.

It moves the long event to position "00:00:00:00" and the short event(s) to "00:00:00:00 + whatever has been cut off at the event start".

Nils

using System;
using ScriptPortal.Vegas;

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Timecode minPosition = vegas.Project.Ruler.StartTime;
        
        foreach (Track theTrack in vegas.Project.Tracks)
        {
            foreach (TrackEvent ev in theTrack.Events)
            {
                // if (!ev.Selected) continue;

                Timecode position = ev.ActiveTake.Media.TimecodeIn + ev.ActiveTake.Offset - minPosition;
                ev.Start = position;

                if (ev.Group != null)
                {
                    foreach (TrackEvent groupevent in ev.Group)
                    {
                    groupevent.Start = position;
                    }
                }
            }
            foreach (TrackEvent ev in theTrack.Events)
            {
                // if (!ev.Selected) continue;

                Timecode position = ev.ActiveTake.Media.TimecodeIn + ev.ActiveTake.Offset - minPosition;
                ev.Start = position;

                if (ev.Group != null)
                {
                    foreach (TrackEvent groupevent in ev.Group)
                    {
                    groupevent.Start = position;
                    }
                }
            }
        }
    }
}
Robert Johnston wrote on 4/29/2024, 11:19 AM

There's a complicated method by using the Multicamera options. But there's a zero "offset" bug to overcome if you use timecode instead of date/stamp. When done, the individual events are lined up okay, but they are placed on individual tracks. So, if you have 100 events including the original, you end up with 100 tracks. Oh, and you would probably have to create subclips to make things easier.

Intel Core i7 10700K CPU @ 3.80GHz (to 4.65GHz), NVIDIA GeForce RTX 2060 SUPER 8GBytes. Memory 32 GBytes DDR4. Also Intel UHD Graphics 630. Mainboard: Dell Inc. PCI-Express 3.0 (8.0 GT/s) Comet Lake. Bench CPU Multi Thread: 5500.5 per CPU-Z.

Vegas Pro 21.0 (Build 108) with Mocha Vegas

Windows 11 not pro

jetdv wrote on 4/29/2024, 11:44 AM

Ok, assuming the first selected event is the one you want to move and the second selected event is the one you want to match (i.e. the matching event has to be below the moving event), this will adjust it properly. So the steps are:

  1. The moving event has to be above the matching event.
  2. Select both the event to be moved and the event it matches
  3. Then run this script
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

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

            TrackEvent FirstEvent = null;
            TrackEvent SecondEvent = null;

            foreach(Track myTrack in myVegas.Project.Tracks)
            {
                foreach (TrackEvent evnt in myTrack.Events)
                {
                    if (evnt.Selected)
                    {
                        if (FirstEvent == null)
                        {
                            FirstEvent = evnt;
                        }
                        else
                        {
                            if (SecondEvent == null)
                            {
                                SecondEvent = evnt;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
            }

            FirstEvent.Start = SecondEvent.Start - SecondEvent.ActiveTake.Offset + FirstEvent.ActiveTake.Offset;
        }
    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

Before

After