Page 1 of 1

Trouble moving something forward one frame

Posted: July 20th, 2010, 1:46 pm
by z00story
I feel lame, but I just can't figure it out.

So I am trying to pre-comps some footage and then move it forward one frame in the comp.

I get how to do that, but I'm having an issue with time vs frames conversion.

We're working in frames, but extendscript is all ms based. So first I simply divided 1 by the timebase (1/23.976) and thought that would be the right value.

The problem is it's float number, and I have discovered that it actually puts the footage a few ms offset to the frame, this causes some weird jerking stuttering upon render or ram preview.

I then discovered currentFormatToTime and used that, with my timebase. Same issue.

I then realized that maybe the real time isn't 23.976, but some longer float value, so instead of hardcoding in that fps, I pulled the fps from the active item for that value (app.project.activeItem.frameRate). Which is, indeed, a longer float value. Same problem.

I've now scripted a quick little ditty, using the footage frame rate and both dividing and the currentFormatToTime function sent to an alert. Lo and behold, two different values.

here's my test script:

Code: Select all

//make sure to select a piece of footage set to 23.976 for test to be proper
fps = app.project.activeItem.frameRate
alert("actual frame rate: "+fps)
alert(currentFormatToTime(1,fps)+" "+1/fps)
So, in short, how can I move a piece of footage forward EXACTLY one frame in a pre-comp?

More elaborately, is there a better function or way to convert all time values to frames when working in extendscript?

Help!

Stephan

Re: Trouble moving something forward one frame

Posted: July 21st, 2010, 3:44 pm
by lloydalvarez

Code: Select all

myLayer.startTime = myLayer.startTime + (1/myComp.frameRate); 
-Lloyd