Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 Doom9's Forum Deshaker by Gunnar Thalin
 Register FAQ Calendar Search Today's Posts Mark Forums Read

 27th September 2009, 07:41 #181  |  Link guth Registered User   Join Date: Apr 2003 Location: Uppsala, Sweden Posts: 152 Version 2.4 uses different zoom values for each individual detected scene. Older versions use the same zoom value for the entire clip.
 27th September 2009, 19:02 #182  |  Link wonkey_monkey Formerly davidh*****     Join Date: Jan 2004 Posts: 2,025 Hi Gunnar, Something I noticed a long time ago is that Deshaker takes longer and longer to do the actual "Deshaking..." part with higher values of motion smoothness. For example (10000 frames): Motion smoothness=100, <1s Motion smoothness=1000, 11s Motion smoothness=10000, >200s I assume these values decide how many frames' worth of parameters either side are averaged to decide how to move that frame, and that it might be a Gaussian distribution to give a smooth effect. Have you considered optimizing this step? For instance, you can approximate a Gaussian "blur" of parameters like this with multiple simple box blurs, which will only take longer as the number of frames increases, not (or not much) with the width of the "blur". I know most people won't find this a problem but if you do want to use a high value of motion smoothness, it can take a while. David
 27th September 2009, 21:27 #183  |  Link guth Registered User   Join Date: Apr 2003 Location: Uppsala, Sweden Posts: 152 To generate the smooth paths I solve some large equation systems numerically, and they converge slower with higher smoothness values. I haven't gotten many complaints about it, but maybe I can do it some other way. We'll see...
 28th September 2009, 15:35 #184  |  Link guth Registered User   Join Date: Apr 2003 Location: Uppsala, Sweden Posts: 152 Actually, your times seem a lot higher than what's normal. Maybe you're using too low max. correction limit values? They can have a huge effect on deshaking times.
 29th September 2009, 00:32 #185  |  Link wonkey_monkey Formerly davidh*****     Join Date: Jan 2004 Posts: 2,025 I ran a default first pass (with a 1% search range), then I altered all four of the motion smoothness parameters (horizontal, vertical, rotation, zoom) to 100, 1000, or 10000 in turn. If you remember, a long time ago I was playing around with writing a perspective-correcting deshaker, which used deshaker.log as it's input. For each frame, all I did was average the values for a number of frames on either side, then subtract that from the original value for that frame to get the parameter for adjusting the image. It seemed to come out pretty similar to Deshaker (although I should say it was a bit of a guess, I didn't know if it would work), but I didn't take it very far. The beauty of it is that a) if the average of a parameter for frame x is calculated from by the total from p[x-w] to p[x+w], divided by 2w+1, the next average (for x+1) can be calculated by taking that total (pre-division), and subtracting p[x-w] and adding p[x+w+1]. Only the calculation for the first frame is dependent on the size of w - all other frames only need one subtraction and one addition. And b) if you perform this averaging 3 or more times, you have a good approximation to a Gaussian distribution, which makes for a nice smooth curve. As I said, I don't doubt that no-one else has been bothered by this, because who really needs to smooth over 10000 frames (except me )? David
 29th September 2009, 17:26 #186  |  Link guth Registered User   Join Date: Apr 2003 Location: Uppsala, Sweden Posts: 152 Did the video come out looking ok with the 10000 smoothness? Cause using adaptive zoom with that high smoothness, usually doesn't look good at all. If you turn off the adaptive zoom it should be faster. I just ran a test with 10000 frames and 10000 smoothness, and it took 10 seconds to deshake. But I don't doubt it can take very long with certain clips/settings. As for your smoothing idea, I do remember it, and I'm still not sure I like it. I don't think I want a Gaussian distribution. My algorithm tries to minimize the squared corrections (ie tries extra hard to minimize the biggest corrections) in order to minimize the ugly borders. Your algorithm doesn't even bother looking at how big the corrections become. Maybe the difference in practice is small, but still...
 29th September 2009, 18:27 #187  |  Link wonkey_monkey Formerly davidh*****     Join Date: Jan 2004 Posts: 2,025 I didn't actually watch the video, I was just watching how look it took to deshake Deshaker is obviously more sophisticated than I assumed - not that I thought it was unsophisticated! - my averaging looked enough like Deshaker's output on my test video that I assumed it was similar. That project wasn't about the smoothing anyway, but about the correction of wide-angle frames, which benefit from being rotated in three dimensions rather than panned in two. David
 30th September 2009, 21:42 #188  |  Link WarpEnterprises C64     Join Date: Apr 2002 Location: Austria Posts: 830 It's not so easy to use the adaptive zoom correctly. I can't think of many situations where you have to "deshake" the real zoom, so although "edge compensation adaptive zoom" is the default, maybe "adaptive zoom only" will be the more likely choice. Then the motion smoothness for zoom must indeed be quite high (~5000) because it should resemble a slow real zoom. But the motion smoothness for panning and rotation can be much lower (~500), only those do the real deshaking. The lowest "nice" values can be found by leaving the zoom value 0 and using "edge compensation none", then increasing the pan/rot values until the shake is gone. Then use the high zoom value and "adaptive zoom only". That way only ONE of the four values is high, which makes it much faster and leaves more "space" for soft zooming. Maybe the caption is a little bit misleading, too: It looks like the difference between "Adaptive zoom (some borders)" and "Adaptive zoom only" is only how much borders are in the result which in fact is NOT the difference (as the manual correctly tells).
 1st October 2009, 18:26 #189  |  Link guth Registered User   Join Date: Apr 2003 Location: Uppsala, Sweden Posts: 152 David... I was just trying (hard) to come up with a reason for using my algorithm instead of yours Warp... "Adaptive zoom only (some borders)" is too long, it doesn't fit. And anyway, I never meant for Deshaker to be user friendly I'll think about it, though... As for "nice" settings, what's nice for one person might not be nice for another. I, for example, almost always use "edge compensation: none", but do use zoom smoothing (unless there's no zooming in the clip). Almost the exact opposite of you
 2nd October 2009, 13:23 #190  |  Link WarpEnterprises C64     Join Date: Apr 2002 Location: Austria Posts: 830 guth, I have one more question: is your internal timescale/unit for motion smoothness the same for pan and zoom? I mean, if there is a clip which shakes in X-direction with the same frequency as another clip which "shakes" in the zoom-value would I have to apply the same motion smoothness values to get similar results?
 2nd October 2009, 17:33 #191  |  Link guth Registered User   Join Date: Apr 2003 Location: Uppsala, Sweden Posts: 152 Panning and zooming don't share the same unit, so you can't really compare them. It's like asking if a minute is longer than a meter. Another answer is that the numbers I use internally during smoothing to represent panning is 'number of pixels', and for zoom 'the natural logarithm of the zoom factor'. Based on this, I'd say that a zoom unit would "seem" quite a lot bigger than a pixel unit, but how much depends on the size (in pixels) of a frame. That is, if they were comparable at all I haven't really thought much about this. It's an interesting question... sort of...
2nd October 2009, 19:10   #192  |  Link
loekverhees
Registered User

Join Date: Sep 2005
Location: Holland
Posts: 86
Quote:
 Originally Posted by guth Version 2.4 uses different zoom values for each individual detected scene. Older versions use the same zoom value for the entire clip.

 2nd October 2009, 19:45 #193  |  Link WarpEnterprises C64     Join Date: Apr 2002 Location: Austria Posts: 830 @guth: interesting! But I was concerned of the time dimension - if I understand correctly higher smoothness values make the resulting video shake less AND shake slower (make the resulting amplitude smaller AND the frequency lower). That way pan and zoom would be more comparable, at least the frequency. But maybe I'm simplifying things the wrong way...
 2nd October 2009, 21:04 #194  |  Link guth Registered User   Join Date: Apr 2003 Location: Uppsala, Sweden Posts: 152 I'm not sure I understand what you're asking. Yes, higher smoothness values makes the video shake less and slower. But you can't really separate the frequency from the amount during the smoothing. And since it's hard to compare the amount, it's hard to compare the overall effect (including frequency). My algorithm doesn't really correspond to a lowpass filter thingy with a certain cutoff frequency, or at least I don't think so.
 21st January 2010, 21:35 #195  |  Link BabaG Registered User   Join Date: Dec 2003 Posts: 169 just tried the deshaker on some old digitized film i have and it worked great! i'd like to try running it as a batch. i know it's not the recommended procedure but i think i could narrow down my tasks that way since the default setting worked so well on my first jitter test. being new to this, i'm very much unclear on how to set up a batch test using the jobs function. could someone post a step-by-step on how to use jobs to execute deshaker on several files? i'd very much appreciate it. the thing that has me most confused is how i'd run the first pass since this seems very much a manual operation the way i tested it. thanks, BabaG
22nd January 2010, 01:03   #196  |  Link
shindou
Registered User

Join Date: Jul 2009
Posts: 4
Quote:
 Originally Posted by BabaG just tried the deshaker on some old digitized film i have and it worked great! i'd like to try running it as a batch. i know it's not the recommended procedure but i think i could narrow down my tasks that way since the default setting worked so well on my first jitter test. being new to this, i'm very much unclear on how to set up a batch test using the jobs function. could someone post a step-by-step on how to use jobs to execute deshaker on several files? i'd very much appreciate it. the thing that has me most confused is how i'd run the first pass since this seems very much a manual operation the way i tested it. thanks, BabaG
First of all, welcome to the wonderful world of Deshaker!

Second, and sadly, I have never heard of any practical way of queueing up Deshaker jobs in batch. I've made my own scripts which would, in fact, generate the VirtualDubMod job file directly. Writing them was a trial and error job. They surely won't work for any video - just for those I take with my cam, a Canon PowerShot 720 IS. I also needed to make a variety of similar scripts just to handle slightly different movie formats. Mine will probably not work for you unmodified, unless you have the same camera. Moreover, it makes some assumptions on file naming which may add to the hassle and solve nothing for you after all.

Third, and contrary to what I did (I just needed a quick fix for 270 files), applying Deshaker in batch might not be a good idea. Several of my movies did not deshake well, even after I carefully adjusted "my own default parameters".

If you have the time, I suggest you read up the whole thread to grab a few ideas on how to find the best parameters for each of your movies, manually. If you have even more time and expertise, or a nice programmer friend with plenty of time (not the case usually), make your own scripts.

Currently I think the problem of batch deshaking is just one of several deficiencies in Deshaker (e.g. an easy, intuitive way of telling it to disconsider a specific object or other part of the image). Nonetheless, Deshaker is the best and we'd love an open-source version, which could then prompt a solution more quickly.

22nd January 2010, 18:02   #197  |  Link
guth
Registered User

Join Date: Apr 2003
Location: Uppsala, Sweden
Posts: 152
Quote:
 Originally Posted by BabaG could someone post a step-by-step on how to use jobs to execute deshaker on several files? i'd very much appreciate it.
Well, it's not super convenient (and not really recommended), but you can do it like this:
1. Setup everything as you usually do for pass 1 processing.
2. In the job control window, use "Edit/Process directory" to add your clips.
3. Setup everything as you usually do for pass 2 processing.
4. In the job control window, use "Edit/Process directory" to add your clips again.
5. In the job control window, move the clips so that you have order: clip1pass1, clip1pass2, clip2pass1, clip2pass2 etc. You need to do this since the log files will be overwritten at each pass1.

 24th January 2010, 06:46 #198  |  Link BabaG Registered User   Join Date: Dec 2003 Posts: 169 thanks guth! i'll have a look at this. BabaG
 1st March 2010, 06:18 #199  |  Link Diamenz Registered User   Join Date: Jan 2006 Posts: 9 hey all. first of all guth i'd like to say how great of a plug in this is for shaky video. it really works wonders for me. i own a flip hd mino which is really bad for moving around while recording, especially when walking. unfortunately i don't know the exact rolling shutter %. the default 89% seems to work pretty well, but i emailed flip and asked so hopefully they'll reply with an answer. if they do, i'll be sure to post it here for everyone. i have a few questions for you guth... i'm not very educated on video like a lot of the people here, but i also don't consider myself a complete newbie. for motion smoothness, what would be general ideal settings for someone that wants to stabilize, but at the same time not lose sharpness. i don't know if it's me, but it seems the higher i set smoothness the blurrier my video becomes. or perhaps it's another setting that's causing blurriness? it's not too bad, but i'm a quality nut and it's bugging me. is the cost of stabilizing video slight loss of quality? actually that's my only question now that i think about it. thanks! i guess i should also mention i use no edge compensation and uncheck "ignore pixels darker that 15% brightness". everything else is left at default besides a full scale and using 'all pixels' under first pass. my source video is 1280 x 720 29.97 progressive.
1st March 2010, 18:52   #200  |  Link
guth
Registered User

Join Date: Apr 2003
Location: Uppsala, Sweden
Posts: 152
Quote:
 Originally Posted by Diamenz for motion smoothness, what would be general ideal settings for someone that wants to stabilize, but at the same time not lose sharpness. i don't know if it's me, but it seems the higher i set smoothness the blurrier my video becomes.
There's always a slight loss of sharpness due to the resampling process, but that's unavoidable and not dependent on the smoothness settings.

But I suspect that what you're seeing is motion blur in the frames. Deshaker can only remove unwanted motion between frames, not within frames. So if you have a slow shutter speed (slower than around 1/300 sec) there's a high risk you'll get motion blur. When you have motion both within and between frames, motion blur often looks nice, but when you remove the motion between frames, it looks bad. And in a way it might look slightly worse with higher smoothness settings.