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)
More elaborately, is there a better function or way to convert all time values to frames when working in extendscript?
Help!
Stephan