aspect ratio stupidity with images vegas 7 and 8

dirtynbl wrote on 4/24/2008, 1:41 PM
One of the things that I loathe about Vegas is using images in video.

Why in the world when I throw an image in Vegas doesn't the image conform to the project aspect ratio? ie, if I'm working in SD and I drop in an image that 900x300 and I drop an image into the project over some video I should be able to use Event Pan/Crop to zoom and move that image as I please.

But Vegas sticks to the image's aspect ratio so that if I zoom with the intention of having the image cover the entire screen it has invisible bars that the image disappears behind when it should be covering the whole screen.

The only way I've found to do complex image keyframing and zooming (Ken Burns style sort of) is to open the Event Pan/Crop, turn off "Lock Aspect Ratio" then zoom in on the image and when the invisible bars appear I am forced to slowly pull up until I get them to disappear. Except half the time I over-move my mouse and now the bars appear horizontally if I'm working verticall or vertically if I'm working horizontally. Once my image covers the screen I enable "Lock Aspect Ratio" and I can zoom as I please and Vegas behaves as it should.

How can I set Vegas to behave like After Effects where if you zoom out on an image and have a video layer below it, it will show the video on top of it, BUT without messing with aspect ratios it will let you zoom and keyframe and cover the whole screen with an image.

This would be extremely helpful.

Comments

Former user wrote on 4/24/2008, 1:45 PM
While you are in the CROP window, right click on the image and Select MATCH OUTPUT ASPECT>

see if that helps.

Dave T2
johnmeyer wrote on 4/24/2008, 1:51 PM
Well, I wouldn't get too worked up about Vegas being the culprit here because this is one of those "square peg in a round hole" issues. Vegas actually is pretty darned smart with how it handles photos.

You obviously understand that a picture can be rectangular and video can be square. Or, the other way around. So, if you want to put a 35mm aspect ratio still photo into a 4:3 SD video, or if you want to put a near-square digital camera pic into a 16:9 HD video, something has to change.

Fortunately, Vegas can make this pretty simple, certainly simpler than what you are doing.

In the future, try this:

Drop the photo onto the timeline. Open Pan/Crop for that photo event. Now, right-click on the photo from within the Pan/Crop dialog and from the pop-up choose "Match Output Aspect."

Voilà !

Your picture now exactly fills the video window. Of course you can't display the entire picture at once (see round peg/square hole definition), but you can certainly display any portion you wish simply by moving the pan/crop box around or by zooming (make sure lock aspect is turned on).
busterkeaton wrote on 4/24/2008, 1:51 PM
I suspect it's because if you let the image conform to the project ratio, people would be complaining about that approach, that Vegas was stretching and distorting their images.

I don't fully understand what you are getting at here as I have no problems doing complexing zooming and keyframing of images in Vegas. However, I suspect some of what you are trying to do should be in track motion. You can lock aspect ratio or change it there too. Your workflow sounds like you should be using track motion keyframes with pan/crop keyframes. Also in Pan/Crop you can select "Stretch to Fill Frame."
johnmeyer wrote on 4/24/2008, 1:53 PM
No, don't use track motion with still photos, especially for zooming. This is a disaster. The reason is that the zoom is done AFTER the photo is re-sized to project resolution and as a result, even if you start with a 3000x2000 photo, if your project settings are 720x480 and you zoom in by a factor of two, you will end up with a horrible pixellated 320x240 image!!

ALWAYS zoom still photos using pan/crop and never use track motion for this.
busterkeaton wrote on 4/24/2008, 2:01 PM
John's correct about that.

My suggestion for using track motion was because I wasn't clear on exactly the problem he iss having. It's been a long time since I have issues panning and zooming and I thought he might be trying to do things in Pan/Crop that weren't part of that tool

I agree that Match Output Aspect is the very step to take.
ScorpioProd wrote on 4/24/2008, 2:22 PM
Is there any script that can do the "match output aspect ratio" for you, if you have a large number of stills to work with?
farss wrote on 4/24/2008, 2:27 PM
You don't need a script.
Assuming all your images are on the one track get the first one right. R Click it, select Copy. Goto second image on T/L. R Click it and Select Events to End. RClick it again. Select Paste Event Attributes. Job Done.

Bob.
Chienworks wrote on 4/24/2008, 3:10 PM
That only works if all the images are the same size & shape. Vegas copies the existing numerical values to the other images, not the concept "match output aspect". If you paste the attributes onto an image of a different size or shape then it won't work as expected.
dirtynbl wrote on 4/24/2008, 3:19 PM
haha! match output is the ticket for sure. damn, i knew that was simple.

@johnmeyer

its not a square peg round hole problem, i'm not trying to display the whole picture at once and fully understand the concepts involved here. match output is really simple, but I've been doing post in Vegas and AE for years and even now knowing that Vegas has this option it ought to be the default option.

If you have a square picture and you are panning and cropping and zooming in what in the world is the possible advantage of allowing the picture to simply disappear off of the screen. Its pointless.
Widetrack wrote on 4/24/2008, 3:49 PM
John:
"No, don't use track motion with still photos, especially for zooming"

That being said, and correctly so: Track motion is downright useful for moving an image off the screen or zooming it out into infinity. Making it smaller does not create pixellation problem and you can get it smaller and farther off-stage with TM than with pan/crop.

Now if there were only an easier way to Restore the track to project size before and after the moved image, and to move the keyframes with the image....
busterkeaton wrote on 4/24/2008, 6:13 PM
How long have you been having a problem with this stupidity?

Because if you go to help and search on Aspect Ratio, one of the choices is Crop or Zoom a video event. When you read that you will find

Right-click the workspace to display a shortcut menu that displays commands to restore, center, or flip the selection box. You can also force the box to match the source media's aspect ratio or your project's output aspect ratio. Matching the output aspect ratio can prevent black bars from appearing when you use source media (such as photographs) that does not match your project's aspect ratio.
TheHappyFriar wrote on 4/24/2008, 7:01 PM
the issue here is you don't know the difference between the pan/crop tool & track motion. Everybody gets them confused & then the lightbulb blinks & you say "wow, it's so simple!"

The tools do EXACTLY what the name says: the pan/crop is used for panning & cropping. NOT moving, rotating, etc.
The track motion is used for moving the track around, like moving layers in photoshop. It's NOT for panning, cropping, etc.

So just from what you say you want to do, you want to zoom in to the photo with the pan/crop tool & move it around the screen with the track motion tool.

You're saying that vegas doesn't auto-crop. 9 times outta 10, you don't want auto-crop, you want to be able to pan. How would vegas know where to crop anyway? It defaults to the center but again, that's not always the case.

Anyway... the right click thinggy people suggested works great. Just don't keep alternating between "match project aspect" & "match original aspect". It keeps shrinking. :D

BTW, I consider the Vegas way the RIGHT way (it's just how you would handle a real photograph) & everybody else does it the wrong way.
Chienworks wrote on 4/24/2008, 7:36 PM
I think it would be nice if Vegas had a preference or option somewhere for whether non-matching media would be fit inside the frame or have it's aspect ratio matched when added. It would fit very nicely along with the other settings on Options / Preferences / Editing. At least 98% of the time i want the aspect ratio matched so that the picture fills the frame. I wouldn't be surprised if that percentage is even higher for a lot of other users.
TheHappyFriar wrote on 4/24/2008, 8:30 PM
really? I've honestly never wanted the image to fill the screen. for photo images I almost always want black borders & for non-photo's I set them up ahead of time to the correct aspect ratio.

But it would be handy to have in a menu the default still length, fade length, etc.
johnmeyer wrote on 4/24/2008, 9:56 PM
BTW, we had exactly this same discussion exactly one month ago (March 22). I provided an old script that does exactly what the original poster wants, and will work AFTER the fact, and will work on every image regardless of its original size, aspect ratio, or resolution. If you select events, it will work on only those events; if you don't select any events, then it works on ALL events. Just copy the code below into Notepad, save it with the extension ".js" and then run it as a script from within Vegas.

In that other thread, the original poster had trouble getting this script to work under Vegas 8. I can tell you that it works under Vegas 7.0d and that it worked on all earlier versions. Sony keeps insisting on breaking old scripts, and they have done it with every new release. They shouldn't do this, but they keep doing it anyway. So, if it doesn't work in Vegas 8, I can't help it.


// "Match Output Aspect" on all selected video events.
// No selection = ALL

import System.Windows.Forms;
import Sony.Vegas;

var zero : int = 0;

function GetSelectionCount (mediaType)
{
var cTracks = Vegas.Project.Tracks.Count;
var cSelected = zero;
var ii;

for (ii = zero; ii < cTracks; ii ++)
{
var track = Vegas.Project.Tracks[ii];

if (track.MediaType == mediaType)
{
var eventEnum : Enumerator = new Enumerator(track.Events);

while ( ! eventEnum.atEnd() )
{
if (eventEnum.item().Selected)
{
cSelected ++;
}

eventEnum.moveNext();
}
}
}

return cSelected;
}

function GetActiveMediaStream (trackEvent : TrackEvent)
{
try
{
if ( ! trackEvent.ActiveTake.IsValid())
{
throw "empty or invalid take";
}

var media = Vegas.Project.MediaPool.Find (trackEvent.ActiveTake.MediaPath);

if (null == media)
{
throw "missing media";
}

var mediaStream = media.Streams.GetItemByMediaType (MediaType.Video, trackEvent.ActiveTake.StreamIndex);

return mediaStream;
}
catch (e)
{
//MessageBox.Show(e);
return null;
}
}

function MatchOutputAspect (keyframe : VideoMotionKeyframe, dMediaPixelAspect : double, dAspectOut : double)
{
var keyframeSave = keyframe;

try
{
var rotation = keyframe.Rotation;

// undo rotation so that we can get at correct aspect ratio.
//
keyframe.RotateBy (-rotation);

var dWidth = Math.abs(keyframe.TopRight.X - keyframe.TopLeft.X);
var dHeight = Math.abs(keyframe.BottomLeft.Y - keyframe.TopLeft.Y);
var dCurrentAspect = dMediaPixelAspect * dWidth / dHeight;
var centerY = keyframe.Center.Y;
var centerX = keyframe.Center.X;

var dFactor;

var bounds = new VideoMotionBounds(keyframe.TopLeft, keyframe.TopRight, keyframe.BottomRight, keyframe.BottomLeft);

if (dCurrentAspect < dAspectOut)
{
// alter y coords
dFactor = dCurrentAspect / dAspectOut;

bounds.TopLeft.Y = (bounds.TopLeft.Y - centerY) * dFactor + centerY;
bounds.TopRight.Y = (bounds.TopRight.Y - centerY) * dFactor + centerY;
bounds.BottomLeft.Y = (bounds.BottomLeft.Y - centerY) * dFactor + centerY;
bounds.BottomRight.Y = (bounds.BottomRight.Y - centerY) * dFactor + centerY;
}
else
{
// alter x coords
dFactor = dAspectOut / dCurrentAspect;

bounds.TopLeft.X = (bounds.TopLeft.X - centerX) * dFactor + centerX;
bounds.TopRight.X = (bounds.TopRight.X - centerX) * dFactor + centerX;
bounds.BottomLeft.X = (bounds.BottomLeft.X - centerX) * dFactor + centerX;
bounds.BottomRight.X = (bounds.BottomRight.X - centerX) * dFactor + centerX;
}

// set it to new bounds
keyframe.Bounds = bounds;

// restore rotation.
keyframe.RotateBy (rotation);

}
catch (e)
{
// restore original settings on error
keyframe = keyframeSave;
MessageBox.Show("MatchOuput: " + e);
}
}


var dWidthProject = Vegas.Project.Video.Width;
var dHeightProject = Vegas.Project.Video.Height;
var dPixelAspect = Vegas.Project.Video.PixelAspectRatio;
var dAspect = dPixelAspect * dWidthProject / dHeightProject;
var cSelected = GetSelectionCount (MediaType.Video);


var cTracks = Vegas.Project.Tracks.Count;
var ii;

for (ii = zero; ii < cTracks; ii ++)
{
var track = Vegas.Project.Tracks[ii];

if (! track.IsVideo())
{
continue;
}

var eventEnum : Enumerator = new Enumerator(track.Events);

while ( ! eventEnum.atEnd() )
{
var trackEvent : TrackEvent = eventEnum.item();

if ( !cSelected || trackEvent.Selected )
{
var mediaStream = GetActiveMediaStream (trackEvent);

if (mediaStream)
{
var videoStream = VideoStream (mediaStream);

var dMediaPixelAspect = videoStream.PixelAspectRatio;
var videoEvent = VideoEvent(eventEnum.item());
var keyframes = videoEvent.VideoMotion.Keyframes;

var cKeyframes = keyframes.Count;
var jj;

for (jj = zero; jj < cKeyframes; jj ++)
{
MatchOutputAspect (keyframes[jj], dMediaPixelAspect, dAspect);
}
}
}

eventEnum.moveNext();
}
}


Vegas.UpdateUI();