//**************************************************************************** //* Program: Fix30pMedia.cs //* Author: John Rofrano //* Description: This script changes the playback rate of 30p media to 29.97 //* Created: July 25, 2010 //* Updated: Jul 28, 2010 (JR) Added Disable Resample //* Aug 4, 2010 (JR) Changed audio to match video //* //* Copyright: (c) 2010, Sundance Media Group / VASST. All Rights Reserved //**************************************************************************** using System; using System.Collections; using System.Windows.Forms; using Sony.Vegas; class EntryPoint { public void FromVegas(Vegas vegas) { int counter = 0; try { foreach (Track track in vegas.Project.Tracks) { if (!track.IsVideo()) continue; foreach (VideoEvent videoEvent in track.Events) { VideoStream videoStream = videoEvent.ActiveTake.MediaStream as VideoStream; decimal frameRate = Math.Round((decimal)videoStream.FrameRate, 2); // only affect 30fps media if (frameRate == 30.00m) { videoEvent.AdjustPlaybackRate(0.999, true); videoEvent.ResampleMode = VideoResampleMode.Disable; counter++; // check for audio in the same file and change it too if (videoEvent.IsGrouped) { foreach (TrackEvent trackEvent in videoEvent.Group) { if (!trackEvent.IsAudio()) continue; // see if they are from the same file if (trackEvent.ActiveTake != null && trackEvent.ActiveTake.MediaPath.Equals(videoEvent.ActiveTake.MediaPath)) { AudioEvent audioEvent = trackEvent as AudioEvent; audioEvent.AdjustPlaybackRate(0.999, true); } } } } } } // let the user know we are done MessageBox.Show(String.Format("{0} events changed", counter), "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception e) { MessageBox.Show(e.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } }