Finding audio events associated with video

johnmeyer wrote on 6/3/2003, 4:00 PM
I have a script that selects a video event that is under the cursor. My goal is to cut a few frame from this event. With the help of jetdv, I have this script working.

However, I want to also cut the same number of frames from the audio associated with the video event. I can do this by assuming that the track below contains the audio and then trimming the event that starts at the same place as the video event. Perhaps this is good enough. However, I was hoping to have some way to check whether this audio is associated with the video event. I assume I have to find the media associated with the video event, and then check whether this is the same media associated with the audio event, but I can't find a way to get the media name for a selected event. It's probably right in front of my eyes, but I'm not seeing it ...

Thanks!

Comments

jetdv wrote on 6/3/2003, 4:23 PM
Yep, that's what you need to do.

You can do it like this:

(assuming ievnt and FEvent are your two events - one video and one audio)


FTake = ievnt.ActiveTake;
FTake2 = FEvent.ActiveTake;
if (FTake.MediaPath == FTake2.MediaPath) {
//They are from the same file
}



Edward
johnmeyer wrote on 6/3/2003, 10:55 PM
Bingo.

Understanding ActiveTake let me solve all sorts of other problems. In particular, I wasn't able to truncate and then subsequently move truncated events to the left. Every time I moved them left, the media "slipstreamed" and I ended up truncating the end of the event. Using ActiveTake and the Offset parameter solved everything. I'll post the results in a few minutes in a fresh post.

I actually decided not to worry about whether the audio event is associated with the video event, because the way I use Vegas, the audio and video will almost always be on adjacent tracks. However, you solved my main problem, which was, as it turns out, far more important.

THANKS!

John
cacher wrote on 1/12/2004, 9:17 AM
John: I'm interested in this topic as I think I'm trying to do the same thing you already acomplished. Did you ever posted the complete script? I tried searching for it but couldn't find it. What I'm trying to do is trimming off the last frame from the video event and then setting the audio part to be the same length as the video (after trimming). I already managed to chop off the last video and audio frames but it isn't working since they are different sizes to begin with (that's what I need the script for).
Your script would be a great starting point to reach my goal.

Thanks in advance.
jetdv wrote on 1/12/2004, 12:35 PM
To adjust the end of the clip, use:

evnt.AdjustStartLength(dStart, dLength, true);

To adjust the beginning of the clip, use:

evnt.AdjustStartLength(dStart, dLength, false);

dStart and dLength are Timecodes.
johnmeyer wrote on 1/12/2004, 9:10 PM
The script that I was working on when I posted this question can be found here:

Trim n frames from event
cacher wrote on 1/13/2004, 9:25 AM
John and jetdv: Thanks, I did find the scripts on the COW website after my last post, but it's somewhat different from what I'm trying to do. Here's my idea (in p-code):

// Start
With all selected events {
   event.trimLastFrame(); // no prob. with this
   eLength = evnt.Length();
   with evnt.AudioPart() { // this I cant' figure out
      set evnt.AudioPart.length = eLength;
   }
   Move next event right so that the 1 frame gap disappears (how ?)
   NextEvent();
}
// End

Any help will be greatly appreciated.
jetdv wrote on 1/13/2004, 2:04 PM
You have to actually search the audio timelines to find the matching event. Even then, It may be hard to find the "matching" event because there is no guarantee they will start at the same timecode or be the noly audio event in the same file, etc....

However, to get the actual event, you have to go through the events on the audio timeline. One thing you could do is only work on SELECTED events and only select one audio and one video segment (or just blindly process all selected events).