Compensate for rolling shutter wobble using motion tracking and shear

Hello,

I have been using a Telezoom Lens without tripod to make some videos of far away objects.

I had great success using the Motion Tracking feature to stabilize the objects.
But after stabilizing the object and scaling it up a bit i noticed that it has some wobble that looks like shearing (the actual tracked point is stable).
I assume this comes from using rolling shutter (sure looks like rolling shutter distortions).

I tryed using quicker rolling shutter to reduce the distortions but even at 1/2000s shutter speed the are still there and i cant make the shutter any quicker without having to pump the ISO up to a point where the noise gets problematic.

So i thought that i could maybe track the edges of the object and then map the tracking points onto the shear effect to “eliminate” the shearing that comes from the rolling shutter.

I managed to track the edges of the already stabilized object, but applying the tracking data onto the shear effect seams to be problematic.
The shear effect only allows values from -2 to +2, but the values of my x tracked shear are 260 to 296.

I thought about exporting the tracking values to a text file and then using a shell command or script of sorts to remap the values to the right range, but maybe there is a function in Kdenlive that does such thing and i just dont find it.

Here are some pictures to to explain my problem:

Hi, and welcome to the forum and community.

I’m afraid you need to go the script route or have a spreadsheet convert the numbers, as there is no such function within Kdenlive.

If your camera has sensor data, maybe have a look at Gyroflow - both for the stabilisation and tracking control and for rolling shutter correction.

My camera sadly is to old to have a gyroscope in body. But i tryed to strap a smartphone on it, record gyrodata and then sync that in Gyroflow.
Sadly without much success.
My lens is a 2000mm, that makes it kinda difficult to create a calibrated lens profile in Gyroflow.
I wish Gyroflow would work but i think it just cant handle such long lenses, i suspect that at that distances the gyrodata just isnt precise enough, at 700m distance a shift of only 1 degree already results in a massive shift in picture.

Not having the gyro/intertial data precisely synchronised to the camera frames would be enough, even with high resolution sensing. Especially if it’s hand held movement and not very precise and linear mechanical tracking of the shot. I’d expect that to have much the same effect as you’d see if you offset the motion tracking keyframes by +/- 1 frame from their actual recorded time (or interpolated them to have a fractional frame offset). You’d probably even see something similar if you had two cameras on a frame shooting ‘exactly’ the same scene but not genlocked, and then tried to use motion tracking data from analysing one camera’s footage to stabilise the other. At least for footage where small errors in time can translate to large differences in the image like you have here to be getting such extreme shear.

Those sort of focal lengths / distances are always going to be challenging - and my experience with gyroflow is more with wide angle / underwater (where most image based stabilisation tends to fall apart pretty quickly) - but I was really surprised at how well it could cope with even violent camera shake, and without the kind of lagging, then rushed, pan effect that image based stabilisation can introduce to deliberate changes of angle. If you can get some similar footage from a camera with modern internal motion sensors the results might be interesting even if the number of zeros needed to own one is somewhat daunting still.

There are other research tools like GitHub - SpectacularAI/3dgs-deblur: [ECCV2024] Gaussian Splatting on the Move: Blur and Rolling Shutter Compensation for Natural Camera Motion which might be able to help without precise gyro data - but I haven’t used them to personally recommend any.