This is a script that will be useful to only a few people, but since I've seen a few requests for it, I'm posting it here.
I use Excalibur for multicam. I am currently doing a shoot where some of the cameras are SD 4:3 and some are HDV. The whole thing will be rendered to MPEG-2 4:3. So, I want to crop the HDV prior to rendering. Problem is, Excalibur puts all the cuts from all the cameras on one timeline, and you can't do the pan/crop on the original footage and have it copied to the final edit.
So, with this script, you first have Excalibur create the multicam edit. Once all the events are on the same timeline, and before you do any further editing (because you may want to do other pan/cropping on some of the events), find any event that needs to be cropped (in my case, one of the HDV events) and apply the proper crop. Then, with this event still selected, run this script. It will apply the pan/crop from the first selected event on the selected timeline to every other event on that timeline that comes from the same media, while ignoring all other events. If you have multiple tapes, or tapes from other cameras that also require this treatment, you will have to select an event from each of those tapes and run the script for each one of those. However, in my case I seldom have more than three cameras, and at this point only one or two them are HDV, and I usually only have one or two tapes, so I can be finished with the pan/crop -- even when I have hundreds of cuts in my project -- in less than a minute.
Here's the script:
I use Excalibur for multicam. I am currently doing a shoot where some of the cameras are SD 4:3 and some are HDV. The whole thing will be rendered to MPEG-2 4:3. So, I want to crop the HDV prior to rendering. Problem is, Excalibur puts all the cuts from all the cameras on one timeline, and you can't do the pan/crop on the original footage and have it copied to the final edit.
So, with this script, you first have Excalibur create the multicam edit. Once all the events are on the same timeline, and before you do any further editing (because you may want to do other pan/cropping on some of the events), find any event that needs to be cropped (in my case, one of the HDV events) and apply the proper crop. Then, with this event still selected, run this script. It will apply the pan/crop from the first selected event on the selected timeline to every other event on that timeline that comes from the same media, while ignoring all other events. If you have multiple tapes, or tapes from other cameras that also require this treatment, you will have to select an event from each of those tapes and run the script for each one of those. However, in my case I seldom have more than three cameras, and at this point only one or two them are HDV, and I usually only have one or two tapes, so I can be finished with the pan/crop -- even when I have hundreds of cuts in my project -- in less than a minute.
Here's the script:
/**
* This script finds the first selected event on the selected timeline
* and copies its pan/crop settings (but NOT fX settings) to all other
* events on the timeline which come from the same media (file).
*
* Copyright 2008 - John H. Meyer
* Last revision, May 1, 2008
*
**/
import System;
import System.Collections;
import System.Text;
import System.IO;
import System.Drawing;
import System.Windows.Forms;
import Sony.Vegas;
var evnt : TrackEvent;
try {
//Find the selected event
var track = FindSelectedTrack();
if (null == track) // Must select a track
throw "no selected track";
var eventEnum = new Enumerator(track.Events);
if (track.IsVideo()) { // Track must be a video track
while (!eventEnum.atEnd()) { // Find selected event
evnt = TrackEvent(eventEnum.item());
if (evnt.Selected) {
var selectedevnt = VideoEvent(evnt);
var keyframes = selectedevnt.VideoMotion.Keyframes;
var keyframe = keyframes[0]; // First keyframe
// myKeyframe stores pan/crop info
var myKeyframe = new VideoMotionBounds(keyframe.TopLeft,
keyframe.TopRight, keyframe.BottomRight,
keyframe.BottomLeft);
// variable "media" remembers media for this event
var media = Vegas.Project.MediaPool.Find (evnt.ActiveTake.MediaPath);
break; // Found first selected event on timeline, so quit looking on timeline.
} //End if
eventEnum.moveNext();
} // End while eventEnum
eventEnum = new Enumerator(track.Events);
while (!eventEnum.atEnd()) { // Find selected event
evnt = TrackEvent(eventEnum.item());
var vevnt = VideoEvent(evnt);
keyframes = vevnt.VideoMotion.Keyframes; // Get keyframe list for this event
keyframe = keyframes[0]; // First keyframe
// Actually make the change to set the keyframe to SD cropping
if (media == Vegas.Project.MediaPool.Find (evnt.ActiveTake.MediaPath) ) {
keyframe.Bounds = myKeyframe;
}
eventEnum.moveNext();
} // End While eventEnum
} // End If track.IsVideo
else {
MessageBox.Show("You must select a video track");
}
} catch (e) {
MessageBox.Show(e);
}
function FindSelectedTrack() : Track {
var trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());
if (track.Selected) {
return track;
}
trackEnum.moveNext();
}
return null;
}