Horizont line correction in Shotcut

Hello!

There are different video types that need detailed editing and effects. One of these types are “simple” travel videos, where clips are stiched together. Such clips, however, often have problems with the horizon. If you do not care about flat horizons, no problem, but I do: I want that the horizon is horizontal in the whole video. Such errors can occur due to incorrect holding or sudden blows or pushes.

I do not know what you do in such situations, but I find the point where the slight turn is, cut at that point, add to the right clip a rotation filter, rotate as much as necessary, and resize it with the same filter by zooming inside. There can be a lot of slices when proceeding in this way, and I do not know any better way to do it.

Here comes my proposal for a new extension. If you rotate the video by 0.5°, the video needs a zoom of +1,8%, a turn of 1° needs a zoom of 3.6% etc. So, each rotation needs a following zoom. Otherwise, the picture will not be a perfect rectangle anymore.

As you can see in the appended video, it is easy to calculate the appropriate zoom for each rotation step. So, this could be either (a) a new option so that the necessary zoom follows each rotation, or (b) this new auto-zoom rotation is the default and could be deactivated by each user over the settings, or (c) the new auto-zoom rotation replaces the current rotation in the filter. Please see the video for details…

Best regards!

Hi @Ahmet_Ekrem_Saban

I clicked the link, but the OneDrive page is empty

Sorry!

1 Like

Personnellement je cherche dans le clip le moment ou l’image est la plus inclinée.
Sur cette image je règle la rotation et le zoom correspondant pour la recadrer.
Ensuite, il ne me reste plus qu’à ajuster la rotation avec des images-clés tout au long du clip.

Personally I look for the moment in the clip where the image is the most tilted.
On this image I adjust the rotation and the corresponding zoom to crop it.
Then all I have to do is adjust the rotation with keyframes throughout the clip.

1 Like

You write that you “adjust the rotation AND the corresponding zoom”. If I understood you correctly, this is done in two steps: use the rotation bar or enter a number in degrees, see if the horizon is horizontal, THEN go to the line above and change the zoom. If this is exactly what you are writing, my proposal would ease the task: whenever you play with the zoom bar or enter a rotation degree, with this feature selected, the corresponding change will automatically occur in the zoom bar above.

If the user want to make this by hand or prefers tilted videos, they would disable or not enable the proposed option, and everything is as it is now.

Here’s a short video showing that I believe I understand what you are talking about. Might help others understand who need a visual.

There are times, with shaky action camera footage, where this function might produce odd results. The code could allow the option for a buffer region around the edges (some number of pixels of padding) where an algorithm could smooth the rotation within that padding area to produce less odd transitions between angles… much like how most Stabilization algorithms calculate, using a crop-in smoothing zone.

Other software like Hugin seems to be able to magically detect when an image is not straight and apply straightening automatically. When I’m stitching panoramas, Hugin always finds the horizon, even when it’s not straight and interrupted by mountains and trees. I have no clue how that works, but it almost always succeeds in straightening.

1 Like

Yes, you understood me correctly. But what Hugin is able to do exceeds my proposal, although it could be a nice extension to what I say later. What I propose is that each rotation angle is resulting in a zoom, as I stated above. This can be easily calculated and added as a further automatic step after each rotation.

hello.

i understand what you need and me too i sometimes wish shotcut could do this, (just like many photo apps in our smartphones).

I just want to say that the fomula is probably not as easy as you say (1.8% zoom per 0,5 degree) i guess it should involve some trigonometry. But nothing impossible :slight_smile:

johan

1 Like