georgmartius / vid.stab

Video stabilization library
http://public.hronopik.de/vid.stab/
Other
850 stars 109 forks source link

[Question] Fixed zoom (crop) #83

Closed fu-hsi closed 4 years ago

fu-hsi commented 4 years ago

Hi. I discovered this library and it is great. I have one simple question. I stabilized multiple files and some of them was too many zoomed in and video quality degraded. How can I set fixed zoom (crop)? Zoom probably doesn't work.

georgmartius commented 4 years ago

There is a way: put zoom to a fixed value and put optzoom=0 in the second phase. Here are the docs: zoom Set percentage to zoom. A positive value will result in a zoom-in effect, a negative value in a zoom-out effect. Default value is 0 (no zoom).

optzoom Set optimal zooming to avoid borders. Accepted values are: 0 disabled 1 optimal static zoom value is determined (only very strong movements will lead to visible borders) (default) 2 optimal adaptive zoom value is determined (no borders will be visible), see zoomspeed Note that the value given at zoom is added to the one calculated here.

fu-hsi commented 4 years ago

I will try. Only one clip was broken with that way, so this is not a big problem, but I think I know where the problem is. I have a camera on my chest when I'm riding a bicycle. The filter behaves strangely when a hand approaches an object and covers it to turn off the camera. Then the horizon also jumps strongly. I cut this fragment (few last seconds) and everything is OK now, but I prefer to automate it with some parameter. knowing this, I will avoid it :) One more thing. I can't change stepsize parameter for vidstabdetect. In trf (first pass) files I have always stepsize=6:

VID.STAB 1 accuracy = 15 shakiness = 10 stepsize = 6 mincontrast = 0.250000

fu-hsi commented 4 years ago

Works! Many thanks :) Is there a way to display average zoom from first pass to apply them to all clips without guessing? It can be from one clip only.

georgmartius commented 4 years ago

Great that it worked!The zoom value is displayed on the console. if you have optzoom=1.

fu-hsi commented 3 years ago

Hi. Can you consider implementing medium zoom getting from one clip and apply only to that clip? Now you calculate optimal == max zoom, or I am wrong? This is not the best in my opinion. For that reason I use fixed zoom calculated from my all clips. I just calculate average zoom and set it as a fixed zoom. Only then do the clips look similar.