[Edit] I added a line (which you can comment out) that actually automatically fixes the problem. It still adds the "***" markers so you can go through the project and check the events that have been changed.
I finally got sick and tired of the bug that has long been in Vegas that moves the final keyframe in the pan/crop dialog whenever you lengthen an event. Specifically, if you place two keyframes in the pan/crop dialog, one at the beginning of the event and one at the end of the event, the keyframe at the beginning always stays at the beginning, regardless of whether you later shorten or lengthen the event. The keyframe at the end will stay at the end if you shorten the event, but if you lengthen it, that final keyframe stays at the same time location, and as a result, there is no longer a keyframe at the end of the event.
When you are using the pan/crop keyframes to animate a still photo, this bug completely ruins the effect. Sometimes you can catch the problem, but often -- if you lengthen the event only slightly, or if the end of the event dissolves into the next event, it is very difficult to catch the problem until the entire project has been rendered. This is especially true because high resolution still photos don't playback at 30 fps on the timeline, and therefore the jerkiness from normal playback and the jerkiness from a mis-placed keyframe cannot be easily distinguished.
The script below simply puts markers on the timeline at the beginning of each video event where the final keyframe is not exactly at the end of the event. It also highlights each problem event. I could easily modify the script to actually move the final keyframe to the end of the event, and I may do that someday. However, I wanted to use this script on a few dozen projects to see if there are any instances where such an automatic fixup might cause more problems than it cures.
Here's the script. Like most of my scripts, it is patched together and therefore not particularly elegant.
=====================
I finally got sick and tired of the bug that has long been in Vegas that moves the final keyframe in the pan/crop dialog whenever you lengthen an event. Specifically, if you place two keyframes in the pan/crop dialog, one at the beginning of the event and one at the end of the event, the keyframe at the beginning always stays at the beginning, regardless of whether you later shorten or lengthen the event. The keyframe at the end will stay at the end if you shorten the event, but if you lengthen it, that final keyframe stays at the same time location, and as a result, there is no longer a keyframe at the end of the event.
When you are using the pan/crop keyframes to animate a still photo, this bug completely ruins the effect. Sometimes you can catch the problem, but often -- if you lengthen the event only slightly, or if the end of the event dissolves into the next event, it is very difficult to catch the problem until the entire project has been rendered. This is especially true because high resolution still photos don't playback at 30 fps on the timeline, and therefore the jerkiness from normal playback and the jerkiness from a mis-placed keyframe cannot be easily distinguished.
The script below simply puts markers on the timeline at the beginning of each video event where the final keyframe is not exactly at the end of the event. It also highlights each problem event. I could easily modify the script to actually move the final keyframe to the end of the event, and I may do that someday. However, I wanted to use this script on a few dozen projects to see if there are any instances where such an automatic fixup might cause more problems than it cures.
Here's the script. Like most of my scripts, it is patched together and therefore not particularly elegant.
=====================
/**
* When placing stills on the video track in Vegas, most users
* want to animate those stills using keyframes in the pan/crop dialog for
* that event. Normally, there should be a keyframe at the beginning
* and at the end of such an event (there can be additional keyframes
* in the middle for more complicated moves). Unfortunately, Vegas contains
* a bug whereby when you change the length of such a still event after
* you have already added keyframes to the beginning and the end of the
* event, the keyframe at the start of the event stays at the start (as
* it should), but the keyframe at the end of the event does not stay
* at the end. This results in still picture animations that suddenly
* appear to freeze at the end of the event. These are sometimes
* difficult to spot, especially if the end of the event overlaps the
* next event.
*
* This script looks at each event on all video tracks.
* The script looks to see if there is a keyframe at the exact end
* of the event. If there is not, the script flags that event by placing
* a marker at its start.
*
* Written By: John H. Meyer
* Date: July 7, 2005
*
**/
import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;
var myMarker : Marker;
try {
//Go through the list of Tracks
var trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());
// Only look at video tracks
if (track.IsVideo()) {
//Go through the list of events on this track
var eventEnum = new Enumerator(track.Events);
while (!eventEnum.atEnd()) {
var evnt : TrackEvent = TrackEvent(eventEnum.item());
evnt.Selected = false; // De-select events in order to make problem events stand out
var MyFilePath = evnt.ActiveTake.MediaPath;
var extFileName = Path.GetFileName(MyFilePath);
var baseFileName = Path.GetFileNameWithoutExtension(extFileName); // Media file name for this event
var EventLength = evnt.Length;
var videoEvent = VideoEvent(eventEnum.item());
var keyframes = videoEvent.VideoMotion.Keyframes;
var cKeyframes = keyframes.Count;
// Only look at events that have more than one keyframe
if (cKeyframes > 1 ) {
var KeyLength = keyframes[cKeyframes-1].Position;
if (KeyLength < EventLength) {
evnt.Selected = true;
myMarker = new Marker(evnt.Start);
Vegas.Project.Markers.Add(myMarker);
myMarker.Label = "*** "+baseFileName;
keyframes[cKeyframes-1].Position = EventLength; // Optional line to actually move last keyframe
} // End If KeyLength
} // End If cKeyframes
eventEnum.moveNext();
} // End While !eventEnum
} // End if track.IsVideo
trackEnum.moveNext();
} // End While trackEnum
} catch (e) {
MessageBox.Show(e);
} // End try