Script that trims all selected events to X seconds?

dummo-h wrote on 7/20/2019, 3:43 PM

https://i.imgur.com/Rb0eUIf.png

All these events have different duration, how can I trim all of them to a same, certain length? I just need the first 10 or so seconds of it.

Vegasaur had a quick properties option, but my trial's run out.

Thanks.

Comments

Former user wrote on 7/20/2019, 7:51 PM

Besides Vegasaur, the only script I know of that can do this is VegasPython by @Harold-Linke. Use the LimitSelectedEventLength option.

Download link here:

https://www.vegascreativesoftware.info/us/forum/vegaspython-1-0-new-feature-vegasscenedetect--116131/#ca721369

wwaag wrote on 7/21/2019, 12:26 AM

I thought there would be an old script readily available, but I didn't find one in my collection. Here's a new script that should do what you want. You can change the duration by editing the script with any text editor including Notepad. Note that it does NOT auto-ripple after trimming, a feature that could be easily added. Just copy the code into any text editor and save the file with a .cs extension and copy to your script menu folder. Good luck

//Trims length of selected events
using System;
using ScriptPortal.Vegas;

class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        int seconds = 10; //Enter length in seconds
        Timecode length = Timecode.FromSeconds(seconds);
        foreach (Track track  in vegas.Project.Tracks)
        {
            foreach (TrackEvent te in track.Events)
            {
                if (te.Selected) te.Length = length;                
            }
        }
    }
}

 

Last changed by wwaag on 7/21/2019, 12:29 AM, changed a total of 2 times.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

dummo-h wrote on 7/21/2019, 12:23 PM

Besides Vegasaur, the only script I know of that can do this is VegasPython by @Harold-Linke. Use the LimitSelectedEventLength option.

Download link here:

https://www.vegascreativesoftware.info/us/forum/vegaspython-1-0-new-feature-vegasscenedetect--116131/#ca721369

I thought there would be an old script readily available, but I didn't find one in my collection. Here's a new script that should do what you want. You can change the duration by editing the script with any text editor including Notepad. Note that it does NOT auto-ripple after trimming, a feature that could be easily added. Just copy the code into any text editor and save the file with a .cs extension and copy to your script menu folder. Good luck

//Trims length of selected events
using System;
using ScriptPortal.Vegas;

class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        int seconds = 10; //Enter length in seconds
        Timecode length = Timecode.FromSeconds(seconds);
        foreach (Track track  in vegas.Project.Tracks)
        {
            foreach (TrackEvent te in track.Events)
            {
                if (te.Selected) te.Length = length;                
            }
        }
    }
}

 

Both options worked beautifully, thanks to you lot.

JohnnyRoy wrote on 7/21/2019, 2:45 PM

You can also accomplish this (and more) with VASST Event Tools. On the Adjustments tab use the Adjust Selected Event Length (w/Keyframes) option. The difference is that if the event has keyframed motion, Event Tools will adjust the duration of the motion so that it fits the new length. The other scripts do not take this into account. This is important when used with photo montages that might have motion applied to events. 😉

~jr

Former user wrote on 7/21/2019, 4:38 PM

@JohnnyRoy

I did not know about this peculiarity of Event Tools. It is certainly an important and useful differential. All your tools do a fantastic job!

Thank you!

wwaag wrote on 7/22/2019, 10:31 AM

Forgot that I already had written a head/tail trim script with a little GUI including an option for AutoRipple. Here's the link.https://tools4vegas.com/trim-frames/

Last changed by wwaag on 7/22/2019, 10:31 AM, changed a total of 1 times.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.