Copy link to clipboard
Copied
Guys, I am trying to slow down/speed up the duration of clips via setspeed method, the thing is the code works perfectly for cut clips, eg footage duration is 10 sec, but clip uses only 5 secs of the footage, so If what to set need duration of 8 seconds it will work, but if I set 11 it would slow down the clip by 5/11 = 45,45% and stretch the duration until original duration - until 10, and one last seconds won't be visible. What could be problem here?
var dur = clip.duration
//get current clip duration in secs
var secs = timecodeToSeconds(dur, fps)
var newDur = toExtend ? secs + Math.abs(diffPerClip) : secs - Math.abs(diffPerClip)
// add all floating frames from previous cycle
newDur += framesFractals;
//get whole frames number
var Separated = separateFloatingPart(newDur * fps) //returns frames obj
// convert frames back to secs
var sec2 = Separated.integer / fps
framesFractals = Separated.floating
var timecode = secondsToTimecode(sec2, fps)
var newSpeed = secs / sec2
clip.setSpeed(newSpeed, timecode, false , false, false);
There is no setSpeed() function, in PPro's supported API.
There is one in PPro's QE DOM, but that DOM is not supported, and not at all recommended.
I'm not sure why frame numbers would have anything to do with speed changes...?
Copy link to clipboard
Copied
There is no setSpeed() function, in PPro's supported API.
There is one in PPro's QE DOM, but that DOM is not supported, and not at all recommended.
I'm not sure why frame numbers would have anything to do with speed changes...?