AE ENHANCERS

Expressions/Scripts/Presets
It is currently Thu May 23, 2013 8:31 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: stamp filename and frame counter into rendered video
PostPosted: Fri Oct 09, 2009 9:58 am 
Offline

Joined: Wed Oct 07, 2009 4:03 am
Posts: 2
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


Top
 Profile  
 
 Post subject: Re: stamp filename and frame counter into rendered video
PostPosted: Fri Oct 09, 2009 2:37 pm 
Offline

Joined: Sat Jun 26, 2004 10:01 am
Posts: 298
Location: Folsom, CA
Why not just have the script apply the expression to the new text layer?

Dan

_________________
http://www.motionscript.com


Top
 Profile  
 
 Post subject: Re: stamp filename and frame counter into rendered video
PostPosted: Sat Oct 10, 2009 1:42 pm 
Offline

Joined: Wed Oct 07, 2009 4:03 am
Posts: 2
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


Top
 Profile  
 
 Post subject: Re: stamp filename and frame counter into rendered video
PostPosted: Sat Oct 10, 2009 2:24 pm 
Offline

Joined: Sat Jun 26, 2004 10:01 am
Posts: 298
Location: Folsom, CA
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

_________________
http://www.motionscript.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group