stamp filename and frame counter into rendered video

What type of scripts do you need?

Moderator: byronnash

Post Reply
Paulchen
Posts: 2
Joined: October 7th, 2009, 4:03 am

Hi everyone,
I´m new here and to the world of scripting., so please forgive me if I sound like a newbie... I am. ;-)
This is my problem: I´m sure you can help me on this.
I´m trying to stamp the clipname and a frame counter to the rendered video of multiple comps. So that on frame 1 it stamps 0001 on frame 50 it stamps 0050. (doesn´t have to be 4 digits though)
I already have an expression that does this to single comps, but I need this done on multiple comps. (and I mean hundreds, so no way I can do this manually. It has to be done with a script)
The expression was created from an existing script I found on the net. (Thanx to the unknown author)
I just had to add the source.name function to it:

{frames = (1 / thisComp.frameDuration) * time+1;}
{txt = "";
for (j = 1; j <= thisComp.numLayers; j++){
if (j == index) continue;
L = thisComp.layer(j);
if (! (L.hasVideo && L.active)) continue;
if (time >= L.inPoint && time < L.outPoint){
try{
txt = L.source.name + " \r \r \r \r \r \r \r \r \r \r \r \r \r \r " +frames;
}catch(err1){
txt = L.name
}
break;
}
}
txt}

I tried playing around with an existing script from Lloyd Alvarez called "stamp info on frame" and ended up with something that actually stamps the compname to the video and the frame on which the cursor is when I run the script.
(It´s close but not quite what I wanted)

clearOutput();

var selItems = app.project.selection;
if (selItems.length > 0){
app.beginUndoGroup("Project Info Stamp");
for (var a = 0; a < app.project.selection.length; ++a) {
var myComp = app.project.selection[a];
if (myComp instanceof CompItem){
var framecounter = myComp.frames;
var stamp = myComp.name + "\r \r \r \r \r \r \r \r" +
frames = (1.0/myComp.frameDuration) * myComp.time+1;

myLayer = myComp.layers.addText(stamp);
myLayer.position.setValue([20,40]);
app.endUndoGroup();
}else{
alert("Please select the Comp (or Comps) you'd like to stamp");
}
}
}else{
alert("Please select the Comp (or Comps) you'd like to stamp");
}

Now... how do I get the frame counter to work?
Is it a wrong function maybe the mycomp.time ?
Any help will be appreciated !!

Greets,

Paulo
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

Why not just have the script apply the expression to the new text layer?

Dan
Paulchen
Posts: 2
Joined: October 7th, 2009, 4:03 am

Hi Dan,
What is the scripting command to call an expression saved as animation preset?
I have no idea what syntax to use, and I already looked here in the forum to find a clue.

Greets,

Paulo
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

You could use:

myLayer.applyPreset(yourPresetFileObject)

but first you'll have to create a file object that represents the preset. Or, you could just apply the expression directly from the script.

Dan
Post Reply