www.jetdv.com Forum Index Edward Troxel
Vegas Scripting and Newsletters
Home of Excalibur and Montage Magic
 
 FAQ   Search   Memberlist   Usergroups   Register   Profile 
 Log in to check your private messagesLog in to check your private messages   Log inLog in 

Set Alpha Channel mode for all media in the Media Pool

 
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Free Scripts
View previous topic :: View next topic  
Author Message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Fri Dec 16, 2005 3:15 pm    Post subject: Set Alpha Channel mode for all media in the Media Pool Reply with quote

This script will set the alpha channel mode as desired for all media in the Media Pool (Project Media). You can pick which alpha mode you wish to use by uncommenting the appropriate method and commenting out the selected method. By default, it will set all media to "Premultiplied".

http://www.jetdv.com/scripts/AlphaChannelAllMedia.js
Back to top
View user's profile Send private message Send e-mail
KeesDuif



Joined: 30 Nov 2005
Posts: 164
Location: Rotterdam, Netherlands

PostPosted: Thu Jun 15, 2006 10:18 am    Post subject: Reply with quote

Edward, what's the use of setting the alpha channel mode for all media in the Media Pool?
_________________
Greetings
Kees

http://www.cvd-video.nl
Back to top
View user's profile Send private message Send e-mail
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Thu Jun 15, 2006 1:15 pm    Post subject: Reply with quote

When bringing images/videos into Vegas, sometimes the alpha channel is not automatically recognized. Therefore, you typically would right-click the event, choose properties, and then pick the correct alpha mode.

What this script does is to do that for you for all media in the media pool. If you have a lot of clips that need the alpha channel set, this way you would not have to do them one at a time.
Back to top
View user's profile Send private message Send e-mail
KeesDuif



Joined: 30 Nov 2005
Posts: 164
Location: Rotterdam, Netherlands

PostPosted: Tue Jun 20, 2006 11:59 am    Post subject: Reply with quote

I actually was asking: Wat does alpha setting do to an image. How do I recognize the different modes for alpha channel settings.
The only thing I know about alpha is that it has something tot do with opacity? But what is the specific benefit?
_________________
Greetings
Kees

http://www.cvd-video.nl
Back to top
View user's profile Send private message Send e-mail
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Tue Jun 20, 2006 1:15 pm    Post subject: Reply with quote

Yes, some images have an "alpha channel" which, as you said, controls the opacity. This means you can have areas of the picture that are "invisible" and will allow the lower levels to show through. However, the fact that the alpha channel exists is not always known.

The two main settings I use for Alpha Channel are Premultiplied and Premultiplied Dirty. I've found that Premultiplied Dirty will usually give me the cleanest result. Here's the technical info:

Straight (unmatted)
Transparency information is maintained in only the alpha channel. Alpha information must be applied to the RGB channels before compositing.

Premultiplied
The standard method of handling alpha information. Transparency information is maintained in the alpha and RGB channels, and the image is ready for compositing. No RGB component exceeds the alpha value.

Premultiplied (dirty)
Similar to Premultiplied, but RGB components may exceed the alpha. This setting is used mainly for images created by 3D applications involving compositing of 3D images over a non-solid color image background.
Back to top
View user's profile Send private message Send e-mail
BScott



Joined: 24 Feb 2006
Posts: 40
Location: Charlotte, NC

PostPosted: Sat Oct 13, 2007 11:52 am    Post subject: Reply with quote

Could this be altered to only change the current folder of the project media? I guess I don't understand why selecting several clips and changing their properties doesn't change them all. I imagine that the script could be altered to change pixel aspect ratio as well?
_________________
Brian W. Scott
President
Image Design
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Sat Oct 13, 2007 2:10 pm    Post subject: Reply with quote

Yes, you should be able to modify it so that it only works on a specific folder in the project media and to set other properties as well.
Back to top
View user's profile Send private message Send e-mail
BScott



Joined: 24 Feb 2006
Posts: 40
Location: Charlotte, NC

PostPosted: Sun Oct 14, 2007 8:03 pm    Post subject: Reply with quote

I looked in the API, but can't find a variable for the current media bin, or a bin that the current clip is from. I'm a little new to scripting. What should I be looking for?
_________________
Brian W. Scott
President
Image Design
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Mon Oct 15, 2007 1:47 pm    Post subject: Reply with quote

You would use something like:

Code:
foreach (MediaBin bin in Vegas.Project.MediaPool.RootMediaBin)
{
   if (bin.Name == binName)
   {
      //do whatever you want to do with that particular bin
      break;
   }
}
Back to top
View user's profile Send private message Send e-mail
Baatfam



Joined: 03 Jul 2006
Posts: 17
Location: Carol Stream, IL

PostPosted: Mon Oct 15, 2007 6:55 pm    Post subject: Reply with quote

BScott wrote:
Could this be altered to only change the current folder of the project media? I guess I don't understand why selecting several clips and changing their properties doesn't change them all. I imagine that the script could be altered to change pixel aspect ratio as well?


I'd be very interested in a script that would change the pixel aspect ratio on a series of clips....
I just don't know enough, (read very, very little), to know what to change or how to change it....

Bob T.
Back to top
View user's profile Send private message Visit poster's website
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Mon Oct 15, 2007 7:38 pm    Post subject: Reply with quote

Excalibur already does this for you. You can change the properties on all selected events at once including the PAR.

Here's a quickie I wrote one time to change the PAR of all selected video events to a PAR of 1.21. You can modify it as needed.

Code:
//PixelAspect.js
import Sony.Vegas;

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)).PixelAspectRatio = 1.21;
      }
    }
  }
}
Back to top
View user's profile Send private message Send e-mail
Baatfam



Joined: 03 Jul 2006
Posts: 17
Location: Carol Stream, IL

PostPosted: Mon Oct 15, 2007 9:01 pm    Post subject: Reply with quote

Wow Ed, thanks!! That worked great!

I've got a large project with a couple of hundred clips that was shot in 4:3 with a 16:9 anamorphic adapter...

You just saved me a bunch of time Very Happy

Bob T.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Free Scripts All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.11 © 2001, 2002 phpBB Group