Log in

View Full Version : Smooth rotating from landscape to portrait and backwards (preferably in VD2)


nji
29th March 2025, 12:25
From time to time I get my hands on a video whose maker
was so clever to rotate the camera while recording
(as he gets more on the frame that way I guess :) ).

When this happens once I repair it by cutting the movie in two,
and rotate one of both. Mostly I left these two parts,
but they could be merged of course after enlarging boths' canvas.
The result is OK, although not very nice due to the beginning
rotation, hard switch, and again rotation.

But now I have a movie, where the maker seems to have lost all scrupels:
changing from landscape to portrait (sometimes to upside-down!)
all the time (probably he wasn't aware of the general directions himself :) ).

To improve this movie in the above way is not acceptable anymore.
So I wonder...

The best result would have an enlarged canvas,
where the inner content part is rotated (more or less smoothly)
to the right orientation.
(Of course this inner, content part will change from landscape
to portrait, but that doesn't matter.)

The simple question:
Is this possible with any kind of VD filters?
Some tricky splitting of filter chain and also "Master blend"
(for rotation).
Or DeShaker/ lenstransform with fixed camera (probably not).

If the question isn't completely stupid, and there should be
no way in VD2... ==> if anything else fails, use AVISynth" ?

wonkey_monkey
29th March 2025, 16:55
Or DeShaker/ lenstransform with fixed camera (probably not).

Why not? If the video averages out to zero rotation (turns left as oftens as it turns right) then Deshaker with a high rotation smoothing value should work (if the original doesn't have equal rotations then you could break into sections that do or append it to itself in reverse).

Otherwise, does the video have any fixed features that appear in every frame? Because then I might have an (unpublished) Avisynth solution.

nji
29th March 2025, 17:40
Why not? If the video averages out to zero rotation (turns left as oftens as it turns right) then Deshaker with a high rotation smoothing value should work (if the original doesn't have equal rotations then you could break into sections that do or append it to itself in reverse).

I didn't suspect this would do, but it does.
But not to enter a high value for rotation smoothing
(it takes an eternity then, and provides non-satisfactory results),
but to enter the special value "-1" (see Deshaker's doc).
With that the rotations are killed, but there is much cropping.
To solve that you have to enlarge canvas before DeShaker run
and set the added canvas area to ignore in Deshaker's 1st pass.
(Instead of ignoring the added canvas you could define
it as "color mask" for DeShaker.
This produces astonishingly good results... (at 0.2 fps for a 420p movie!!!)).

(DeShaker is of similar quality as AVS filters.
It would be perfect, if it would account to FoV.)

Otherwise, does the video have any fixed features that appear in every frame? Because then I might have an (unpublished) Avisynth solution.

There is no fixed feature for the movie at whole.
But in intervals.
May I ask for your AVS solution?