Add Time Code to All Media Script

PeterWright wrote on 3/30/2009, 10:37 PM
Strange - I have the PAL version of this script, and I have used it successfully before, but now, in 8.0c, It adds 30 fps T/C instead of 25 fps.

Any ideas why? - and whether I can correct this by altering the script - currently reads as below. In the absence of a solution, I shall have to add it separately to 60 clips in Media Pool.
_______________

edit - I've just done it the LONG way - took about 20 mins - I've got some more shoots coming up though, so I'd still very much like the solution!
_______________

/**
* This script will add an effect to each item in the current
* project's media pool.


*
* Revision Date: Jan. 2, 2007
**/

using System;
using Sony.Vegas;

class EntryPoint
{
// plugInClassID is the class id of the effect plug-in you want to
// add. The class id is used rather than the name so the script
// will still work in localized versions of Vegas.
Guid plugInClassID = new Guid("2869bb94-4971-4ccc-94ca-743666a85938"); // "Sony Timecode"

// presetName is the name of the preset you want to use. Set it to
// null if you want the default preset.
// String presetName = null;
String presetName = "PAL";

public void FromVegas(Vegas vegas)
{

PlugInNode plugIn = vegas.VideoFX.GetChildByClassID(plugInClassID);
if (null == plugIn)
{
throw new ApplicationException("Could not find video plug-in.");
}

foreach (Media media in vegas.Project.MediaPool)
{
// only add the effect if the media object has video
if (!media.HasVideo())
continue;
// and if it does not already have the effect
if (MediaHasEffect(media, plugIn))
continue;
Effect effect = new Effect(plugIn);
media.Effects.Add(effect);
if (null != presetName)
effect.Preset = presetName;
}
}

public bool MediaHasEffect(Media media, PlugInNode plugIn)
{
foreach (Effect effect in media.Effects)
{
if (effect.PlugIn == plugIn)
return true;
}
return false;
}

}

Comments

Andy E wrote on 3/31/2009, 12:32 AM
On my install of 8.0c there is no preset called "PAL".

In fact there are no 25fps presets at all. It looks like you'll have to create one yourself. Maybe someone who hasn't moved to 8.0c can confirm if this is a change.
farss wrote on 3/31/2009, 12:47 AM
None in V6.0 either. It's called "SMPTE EBU (25fps Video)"

Perhaps Peter had created one called "PAL" previously and it got lost in an upgrade.

Bob.
PeterWright wrote on 3/31/2009, 1:02 AM
Bob - I just checked back, and this script ("Add PAL Timecode to All Media.cs) is the one you kindly sent me last October.

I'm sure it worked ok at the time, but today it added 30fps T/C instead of 25

Peter
farss wrote on 3/31/2009, 1:21 AM
I just checked and it does the same thing on a least one of my Vegas systems.
Easily fixed, created a Preset called "PAL" that is 25fps and it works.

Bob.
Andy E wrote on 3/31/2009, 1:23 AM
The problem's not with the script but the fact that there is no preset defined for the Timecode plugin called "PAL"

The line that has presetName = "PAL" isn't going to work. If you open up the Video FX window and click on the Timecode plugin on the left-hand side, you will see a set of presets none of which are named "PAL".

Change the Timecode format (drop-down) against one of your clips via the Video Event FX window to SMPTE EBU (25fps, Video). You will now have "(untitled)" as the Preset name. Change that to PAL and click on the Save button. You will now have a preset called "PAL" and the script will work as expected.
PeterWright wrote on 3/31/2009, 1:34 AM
Fantastic - thanks Bob and Andy - that did it.

Now I know that the "preset" reference referred to a preset in an FX it all seems (fairly) obvious, but I must admit I had no idea that was what it meant.

Now, with this fixed and the discovery of "Quick Labels" in Excalibur, life just got a lot easier - my client can tell me exactly which clip and which in/out points. Thanks again.

Peter