De-freeze at cursor?

Mykee wrote on 8/31/2022, 8:33 AM

I like the Velocity feature, I use the Freeze Frame at Cursor option daily. I make presentation videos where I need to freeze the frame from time to time and I use this feature for that.

 
Will there be the opposite of this? So the De-Freeze Frame at Cursor? In this case, a Velocity 0% would be the lower key, and above that, Normal Velocity.

Comments

Steve_Rhoden wrote on 8/31/2022, 9:10 AM

Sorry, Cant be sure on that one...

jetdv wrote on 8/31/2022, 9:44 AM

It appears to me like you would need to manually add two keyframes at the "de-freeze" point and manually set the second one to the new velocity. Or you could write a script that will do this for you. The example timecodes are just entered values so you'd need to get the timecode from the cursor position instead. You can see here for guidance:

I will also write this up as a tutorial.

jetdv wrote on 8/31/2022, 10:28 AM

In the meantime, here's the script that will do this but will give a full explanation in the tutorial:
 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

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

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (TrackEvent evnt in myTrack.Events)
                    {
                        if (evnt.Selected)
                        {
                            VideoEvent vevnt = (VideoEvent)evnt;
                            Envelope vEnv = null;
                            foreach (Envelope env in vevnt.Envelopes)
                            {
                                if (env.Type == EnvelopeType.Velocity)
                                {
                                    vEnv = env;
                                }
                            }
                            if (vEnv == null)
                            {
                                vEnv = new Envelope(EnvelopeType.Velocity);
                                vevnt.Envelopes.Add(vEnv);
                            }
                            Timecode cursorloc = myVegas.Transport.CursorPosition;
                            if (cursorloc >= vevnt.Start && cursorloc < vevnt.End)
                            {
                                Timecode newPoint = cursorloc - vevnt.Start;
                                AddVelocityPoint(vEnv, newPoint, 0.0);
                                newPoint = newPoint + Timecode.FromMilliseconds(1);
                                AddVelocityPoint(vEnv, newPoint, 1.0);
                            }
                        }
                    }
                }
            }
        }

        public void AddVelocityPoint(Envelope VelEnv, Timecode PointLoc, double PointSpeed)
        {
            EnvelopePoint a = VelEnv.Points.GetPointAtX(PointLoc);
            if (a == null)
            {
                a = new EnvelopePoint(PointLoc, PointSpeed);
                VelEnv.Points.Add(a);
            }
            else
            {
                a.Y = PointSpeed;
            }
        }

    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    //public void FromVegas(Vegas vegas, String scriptFile, XmlDocument scriptSettings, ScriptArgs args)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

Mykee wrote on 8/31/2022, 1:43 PM

I will also write this up as a tutorial.

Thank you very much for the guidance! I haven't scripted in Vegas yet, but it's time to start. I used to do it manually by adding a point, then a point a little further back, dragging it over and setting it to normal, but after a while it became very problematic and sometimes slipped. With a script (or a function like this), the end result will still be more accurate.

I will try the script, or is there a script manual or tutorials for Vegas somewhere? I subscribed to your channel.

 

Update 1: I used your scripted and it works great! Thank you very much!

jetdv wrote on 8/31/2022, 2:04 PM

@Mykee, I believe my channel is the most comprehensive scripting resource available.

You can also download the scripting API and FAQ here:

https://www.vegascreativesoftware.com/us/downloads/

Glad to hear it worked for you. The full tutorial will be out in about 4 weeks.

Mykee wrote on 8/31/2022, 2:12 PM

@jetdv I will be very curious to see the tutorial, because I have some more ideas, like exporting Project Notes to SRT file, or creating velocity curves, or maybe mirroring velocity to soundtrack.

jetdv wrote on 8/31/2022, 2:26 PM

@Mykee, I'm not sure where they're storing the notes. It's not part of the API. The curves on the velocity points can definitely be changed. You might also look at the "easing" 8 part series - looks at positioning instead of velocity but the same principles could be applied.

Mykee wrote on 8/31/2022, 2:34 PM

@jetdv I would start with the audio velocity by setting the points in the video, then mirroring them to the audio track, and then adjusting the velocity speeds to the audio somehow, but that may be a pipe dream.

Project Notes would be good because
- it has the timings by default, where they start,
- I would set the end of the caption to the next starting point -0.5 seconds by default, so there would be no overlap
- the last, subtitle would last until the end of the video
- SRT would then include the times and notes (without the label and date)

 

jetdv wrote on 8/31/2022, 5:32 PM

Notes are not accessible through the scripting api. Markers might be a better option for that.

How are you wanting to change the speed of the audio?

Mykee wrote on 9/1/2022, 12:11 AM

I was thinking of slicing it up at the velocity points using a slice tool, and then modifying it on a time strech basis. Where the velocity is not constant, I would average it over the two velocity points.

jetdv wrote on 9/1/2022, 9:29 AM

@Mykee, so, basically, adjust the "playback rate" to "sort of" match the speed? It would be problematic because you really don't know where that velocity point is anymore on the audio side to match. You could make an intelligent guess by calculating the average velocity over that time between the points but it would still just be a guess.

Mykee wrote on 9/2/2022, 12:15 AM

Yes, you would not follow the curves exactly, but you would get a linear acceleration in slow motion, like in stretching

jetdv wrote on 9/2/2022, 8:52 AM

The video velocity changes would be smooth. The audio velocity changes would be very jerky as you can only go from one speed to another speed. And adjusting to the right place would be difficult.