jetdv wrote on 8/30/2022, 4:39 PM

I don't know of one. And there's not a "pan/crop" flag that says it's been changed. I suppose you could take two points and see if the width and height match the video event media width and height and verify the rotation is zero.

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

@RedRob-CandlelightProdctns, I'll write up a tutorial on this to explain everything but this seems to work. I'll show all the test cases 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)

                        VideoEvent vevnt = (VideoEvent)evnt;
                        VideoStream vs = (VideoStream)vevnt.ActiveTake.Media.Streams.GetItemByMediaType(MediaType.Video, vevnt.ActiveTake.StreamIndex);
                        int mHeight = vs.Height;
                        int mWidth = vs.Width;

                        VideoMotionKeyframes vKeyframes = vevnt.VideoMotion.Keyframes;
                        int vKFCount = vKeyframes.Count;
                        bool pcChanged = false;
                        foreach (VideoMotionKeyframe vKF in vKeyframes)
                            float pcwidth = vKF.BottomRight.X - vKF.BottomLeft.X;
                            float pcheight = vKF.BottomRight.Y - vKF.TopRight.Y;

                            if ((pcwidth != mWidth) || (pcheight != mHeight) || (vKF.Rotation != 0.0))
                                pcChanged = true;
                        evnt.Selected = pcChanged;

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();


RedRob-CandlelightProdctns wrote on 8/31/2022, 12:09 PM

Ed -- as always, you're an amazing human being.

Thank You

Possibly could have simplified to see if any events have more than one keyframe on them, but yours is much more precise in what it's looking for, and actually checking to see if those changes occurred.. love it!

jetdv wrote on 8/31/2022, 12:17 PM

@RedRob-CandlelightProdctns I did notice that if it has more than one keyframe and none of the keyframes have been changed, the icon on the event will be lit up but the script will not select it. So change:

if ((pcwidth != mWidth) || (pcheight != mHeight) || (vKF.Rotation != 0.0))


if ((pcwidth != mWidth) || (pcheight != mHeight) || (vKF.Rotation != 0.0) || (vKFCount > 1))


RedRob-CandlelightProdctns wrote on 8/31/2022, 4:33 PM

Spectacular! No need for a more robust write-up (for me), but if you're so inclined and think it will help others, go for it! :-) :-)

With your script in my back pocket I quickly solved a subsequent problem; I needed to rotate all my media from a camera by -.6 degrees.

Vegasaur has nifty tool to change the rotation on all selected clips, but it only permits whole numbers, not very helpful here. So I used Vegasaur to change the rotation on all my events for this one media to 1 degree, then used the framework of your script (above) to say "for all events with a keyframe of 1 degree rotation, set the rotation to -.6. In the process I realize I had to convert degrees to radians (the API does mention radians) and it worked like a charm!

jetdv wrote on 9/1/2022, 8:49 AM

That's great! Another area is changing the audio volume. You have to convert to/from DB.

jetdv wrote on 9/19/2022, 8:45 AM

@RedRob-CandlelightProdctns, this tutorial just went live this morning!