Time stretch a script?

Let’s say I want to take a video that has a script and using a video editor, slow down the play speed of the video. Is there a way to stretch the script to match the new video speed? I realize the script will need to be moved around there will be some trial and error.

Funscript.io has a couple of simple tools to modify your funscripts.
In this case you could use the “Custom” function, and paste in the following script:

As long as you simply speed up or slow down the video, you could apply a simple scaling effect to the timing of your funscript.

actions => {
	let speed = 1.5; // speed up factor of the video. e.g. 2.0 means twice as fast.
	return actions.map((action) => { 
		action.at = action.at / speed;
		return action;

Alternatively, you could also remap the whole timeframe of your script if you need some more control over the exact start and end times.

actions => {
	let start = 0; // desired time for first action of the script, in milliseconds.
	let end = 180384; // desired time for last action of the script, in milliseconds.

	let currentStart = actions[0].at;
	let currentEnd = actions[actions.length - 1].at;
	return actions.map((action) => { 
		let t = (action.at - currentStart) / (currentEnd - currentStart);
		action.at = start + t * (end - start);
		return action;

Replace ‘start’ and ‘end’ values with the times (in ms) that you would like your funscript file to be, and voila.
Hope this helps.


This totally worked :+1:
Thanks for posting the coding. A little math, some cut and paste and I was in action.

Hey, sorry to bother but I tried using this code to fix a timing issue I had and it worked for the most part. The beginning of the script is synced fine and the end is synced fine, but the middle of the script is out of sync. I was thinking that possibly the timing issue is exponential and this fix is linear or vice-versa. Not sure and I don’t know how to code but any help would be appreciated! Thanks!

This code works for the most part, I have found that the script will still need some fine tuning after being time stretched.
What I have been doing after stretching the script is load it back into OFS, then hit play and watch the timing. When I see the timing getting off (giggidy) special select all to the right and bring the script back into sync. Be sure to watch the change ups. I’ve noticed that when the action changes from slow to fast it can throw off the sync.

1 Like

Thank you very much for the reply! I will try this!

Edit: This worked great! Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.