How to script Event Pan/Crop 'Match Output Aspect'

Vince wrote on 2/13/2003, 9:22 PM
When making slide shows from large digital camera stills, each picture needs to have a 'Match Output Aspect' applied via the popup on the Pan/Crop screen.

It's a manual process, picture by picture.
For each picture in track
Open Pan/Crop, Right Click on image, Select Match Output Aspect

Would be great to automate via a script.

Couldn't see any reference to the popup options in the ScriptAPI?

Any suggestions...

Thanks!

Comments

jetdv wrote on 2/13/2003, 9:51 PM
That's a good question. I'd like to know the answer as well. In fact, it would be even better if there was an option that could be set so that the "Match Output Aspect" was automatically set when clicking on Pan/Crop on a still.
SonyPJM wrote on 2/14/2003, 10:15 AM
I don't know exactly what you mean by 'Match Output Aspect'. As far as
I know, there's only 'Maintain Aspect Ratio' and 'Stretch to fill
frame' check boxes.

The "Maintain Aspect Ratio" check box in the event Pan/Crop is the
same as the "Maintain Aspect Ratio" event switch (accessible in the
event's right-click pop-up menu). Through the scripting API, you can
get and set the VideoEvent.MaintainAspectRatio property.

The "Stretch to fill frame" check box in the GUI is the same as
VideoMotion.ScaleToFill.

Hope this helps.
Vince wrote on 2/14/2003, 10:39 AM
Sorry if I was not clear.

Place a photo on the time line that's aspect does not match the project.
Bring up the pan/crop window.
Right click on the photo in the pan/crop window.
The popup contains Restore, Center, ... ,Match Output Aspect, etc

It's the Match Output Aspect that is very useful to remove black bars in the image.

Can it be scripted?

Thanks again!
jetdv wrote on 2/14/2003, 11:26 AM
After bringing up the Pan/Crop screen, RIGHT-CLICK on the "F" window and you get a drop-down menu. The 5th item down is "Match Output Aspect". I believe you can simulate it by forcing the "size" to an initial size of 655 x 480.
SonyPJM wrote on 2/14/2003, 2:38 PM

Oh... there's no direct script equivalent for that but you can write a
function to do the same thing. This function should calculate the
scale factors (X and Y) needed and call the
VideoMotionKeyframe.ScaleBy method. The scale factors will come from
the following variables:

Vegas.Project.Video.Width
Vegas.Project.Video.Height
VideoStream.Width
VideoStream.Height

You can get the VideoStream by getting the appropriate Take for the
event. Then use its MediaPath property to get the Media object from
the MediaPool and its StreamIndex property to get the video stream.

... kind of a pain, I know, but once you write the function you won't
have to do it again.
prairiedogpics wrote on 2/14/2003, 3:05 PM
Funny, I just came here to post a request for a script that would make every every VIDEO clip on the timeline "Match Output Aspect" for a 16:9 Widescreen properties project. (I know squat about programming.)

As it stands, you have to select Event Pan/Crop for EACH event, right click on the image area and choose "Match Output Aspect".

It looks like you should be able to do this using Track Motion, but you can't. It would be nice to be able to crop on the track level. (Hint to So Fo.)

Dan
Vince wrote on 2/14/2003, 3:33 PM
Wow, thanks. This scripting is quite involved.
I think this one is over my head at this point!

This may be a great one to add to the FAQ as a demo, if someone gets a minute to write it. I know I would use it all the time, and it would save a lot of time.

Really wish scripting in Vegas was like VBA scripts on Excel, where you can record your actions, then see the script. Makes learning alot faster.

In any event thanks for the feedback, this board and Sonic's responses really set Vegas above other editors!

Vince wrote on 2/14/2003, 3:37 PM
For photos it needs to be at the event keyframe level,
as different photos may have different aspects within the same track.

We just need to automate it...

It would be great to have a script to take my existing 4:3 slide shows to 16:9 in one step, and keep the keyframes on pans and zooms.
SonyPJM wrote on 2/17/2003, 5:18 PM

Give this script a try:

matchaspect.js

It will apply the "Match Output Aspect" to all selected video events or all
video events if none are selected.
Vince wrote on 2/17/2003, 9:04 PM
Thanks, perfect!

prairiedogpics wrote on 2/18/2003, 12:48 PM
Thank you, SonicPJM. You just saved me tons of work!!

Dan
SonyPJM wrote on 2/18/2003, 1:07 PM
No problem... but I can't take credit, the script was written by another engineer here at Sonic.