Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums VEGAS Pro Your assistance John, with one of your previous written scripts?

  • John Rofrano

    February 3, 2016 at 2:03 pm

    [Steve Rhoden] “Currently its set to adjust everything on the timeline, would want for it to adjust only the ones i select. Thanks again!”

    Sure, no problem. Here is the new script:
    //****************************************************************************
    //* 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
    //* Feb 3, 2016 (JR) Changed to only process selected events
    //*
    //* Copyright: (c) 2010, 2016 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)
    {
    // Only process selected events
    if (!videoEvent.Selected) continue;

    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);
    }
    }
    }

    Let me know how it works for you.

    ~jr

    http://www.johnrofrano.com
    http://www.vasst.com

  • Steve Rhoden

    February 3, 2016 at 4:05 pm

    Working great. Exactly how i needed it.
    Thanks a bunch.
    (This Vegas Scripting language is the only part of Vegas i’ve never
    dedicated my time in mastering, lol
    )

    Steve Rhoden (Cow Leader)
    Film Maker & VFX Artist.
    Owner of Filmex Creative Media.
    Samples of my Work and Company can be seen here:
    https://www.facebook.com/FilmexCreativeMedia

  • John Rofrano

    February 3, 2016 at 9:20 pm

    You’re welcome Steve. Glad that worked as you expected.

    ~jr

    http://www.johnrofrano.com
    http://www.vasst.com

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy