Post processing for OFS MTFG (lua script)

When using motion tracking, the range of motion changes when the camera zooms or moves. I modified the MTFG “main.lua” script to add some extra post processing options. The “normalize_8” and “normalize_16” calculate the 8 or 16 points moving average of the selection, and calculate the range from the absolute difference from this moving average. The poins are then scaled and moved to center the action, and normalize the range. The “gain +” and “gain -” options can be used to increase or decrease the range.

Intallation is simply by replacing the “main.lua” file in the MTFG folder. The MTFG folder is in the “extensions” folder and can be found in OFS via “Extensions->Extension directory”

There must be only one continuous selection range, otherwise the results are unpredictable.
@roa please try if this works for you


Testing this, thank you

Yes much better than the original result. I wonder if you could take the some points before the result and force the result into that.
The guy is working a constant 2-8-2 2-9-2 after normalize-8 I get this. Endpoints are correct of course.
What would be needed is continue 2-8-2 mainly. Can you get last upper and lower points?

This of course is as you can not choose the 0 and 100 frame I guess.

“normalize -8” last 8 uppers and lowers. Would that be possible?

That would no be too difficult I think. Have you tried “align upper” and “align lower”?

Yes + and - help but not smoothing it out. Have to mark all, then upper, move them up full then back to 2, then mark all again as you cant go directly to lower,mark lower, move down fully and then to 8 to smooth out. Minor corrections to endpoints only.

So normalize -2 and normalize -4 where 4 or 8 points are taken before the processed part would be cool.

As it is now it helps alot already!

Updated the lua script with a “continue minmax” button. This reads min and max pos of the four actions preceding the selection, and adjusts the peaks and valleys of the selection to these max and min respectively. Intermediate points are not moved, and can lead to funny results.

1 Like

This looks very useful! I will try next time I make a script.

Awesome can only test later this week.

This is very useful, thank you for making this!

Pinging @mchyxnaaiorxfwrivv in case they missed it.

1 Like

Glad it is useful. There is a newer version that aligns everything to the last actions just before the selection. (As suggested by @roa). You may want to check that out too.

1 Like

Yeah test the new one please, you manually script 2 or 4 waves and if motion stays constant you just shoot that template over the motion detected part like a pipe. Well that’s the idea. If yo then find no robotic parts you just alter them. Should be extremely fast editing. Would test myself but cant access my PC atm.

May I know where is the updated link? :thinking:

Hmm… I deleted the old version and uploaded the new one, but the link still gives the old (deleted) version. I will create a new link to the updated file. Unfortunately I cannot login to mega at the moment.

its small you may be able to just post it here in a message.

see top of this post for the latest main.lua file


Wow “Continue minmax” is great, makes things usable with a click!


Continue minmax actually levels out moving cameras. The only error you can make is use vertical instead horizontal movement in the first screen. But that’s a general fault when starting MTFG I guess.

Updated the main.lua file. Key mappings are now possible for the post processing functions (in options->keys->dynamic)
Normalization is now using 3,7 or 15 point averaging.
Added two new “deTrend” buttons that look at the minmax of the start en end of the selections, and center and/or normalize using linear interpolation. This removes camera movement, but does a better job at maintaining the shape.


Can this benefit VR stuff? Camera is generally fixed but the actors can shift around.

Yes, if the other actor takes over there is a shift that makes the curves unusable without editing.