Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums VEGAS Pro Set Alpha Channel Script

  • Set Alpha Channel Script

    Posted by Frankie Jones on November 17, 2014 at 4:12 pm

    Hey,
    Does anybody know of a script that just changes the Alpha channel to straight. I need to do a lot of clips at once, so just want to select all then run a script. I can’t seem to find any scripts on google, but read a while ago on here that there was a script to do this, but cant find that post either 😀
    Any help much appreciated.
    Frankie

    Steve Rhoden
    replied 11 years, 6 months ago
    4 Members · 5 Replies
  • 5 Replies
  • Graham Bernard

    November 17, 2014 at 5:39 pm

    [Frankie Jones] “but read a while ago on here that there was a script to do this, but cant find that post either :D”

    Well, I use Excalibur. It sets the ALPHA nicely with one click. As to the historical reference, “Roger_64”, back in 2/13/2004, on the OFFICIAL Vegas Scripting Forum, maybe do a search for that? ……

    Grazie

    Video Content Creator and Potter
    PC 7 64-bit 16gb * Intel® Core™i7-2600k Quad Core 3.40GHz * 2GB NVIDIA GEFORCE GTX 560 Ti
    Cameras: Canon XF300 + PowerShot SX50HS Bridge

  • Mike Kujbida

    November 17, 2014 at 5:42 pm

    Hopefully this works and the formatting doesn’t get messed up.
    If it does, I’ve attached the script.
    8197_changealphachannel.js.zip

    //ChangeAlphaChannel.js by Roger Magnusson (roger_74 at home dot se)
    import Sony.Vegas;

    var ChangeAlphaTo : VideoAlphaType = VideoAlphaType.Premultiplied; //Set this to the type you want
    /*
    VideoAlphaType.Undefined
    VideoAlphaType.None
    VideoAlphaType.Straight
    VideoAlphaType.Premultiplied
    VideoAlphaType.PremultipliedDirty
    */

    for (var currentTrack : Track in Vegas.Project.Tracks)
    {
    if (currentTrack.IsVideo() == true)
    {
    for (var currentEvent : VideoEvent in currentTrack.Events)
    {
    if (currentEvent.Selected == true)
    {
    VideoStream(new Media(currentEvent.ActiveTake.MediaPath).Streams.GetItemByMediaType(currentEvent.MediaType, currentEvent.ActiveTake.StreamIndex)).AlphaChannel = ChangeAlphaTo;
    }
    }
    }
    }

  • Graham Bernard

    November 17, 2014 at 5:49 pm

    [Mike Kujbida] “Hopefully this works”

    Nice one Mike! I read the earlier Vegas Scripting Forum post . . . I’d forgotten I’d been part of the much later Vegas Forum 2013 thread!

    Grazie

    Video Content Creator and Potter
    PC 7 64-bit 16gb * Intel® Core™i7-2600k Quad Core 3.40GHz * 2GB NVIDIA GEFORCE GTX 560 Ti
    Cameras: Canon XF300 + PowerShot SX50HS Bridge

  • Mike Kujbida

    November 17, 2014 at 5:52 pm

    My pleasure Grazie 🙂
    I collect scripts and found it in my collection of useful tools to be shared!!

  • Steve Rhoden

    November 18, 2014 at 9:36 am

    This .cs for changing to Premultiply:

    //* Description: This script sets the alpha channel for selected events

    using System;
    using System.Collections;
    using System.Windows.Forms;
    using Sony.Vegas;

    class EntryPoint
    {
    public void FromVegas(Vegas vegas)
    {
    try
    {
    foreach (Track track in vegas.Project.Tracks)
    {
    if (!track.IsVideo()) continue; // only process video tracks
    foreach (TrackEvent trackEvent in track.Events)
    {
    if (trackEvent.Selected && trackEvent.ActiveTake != null)
    {
    VideoStream videoStream = trackEvent.ActiveTake.MediaStream as VideoStream;
    videoStream.AlphaChannel = VideoAlphaType.Premultiplied;
    }
    }
    }
    }
    catch (Exception e)
    {
    MessageBox.Show(e.Message, “Set Alpha Channel Error”, MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    }
    }

    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

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