VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or try DVDFab and copy, convert or make Blu-rays and DVDs! :)
+ Reply to Thread
Page 1 of 4
1 2 3 ... LastLast
Results 1 to 30 of 93
Thread


  1. Stabilization Tools Pack v2.1

    I developed a set of tools to work with common stabilization issues, mainly from telecine process.
    For aggressive handheld camera shaking I still recommend vdub's Deshaker.


    FilmGateFix()

    First there is FilmGateFix() which is very straight forward. It's somewhat conservative but it will find many matches, subtle wobbles will be missed though.
    I set defaults to my needs and although very conservative worked quite well. It's still open to suggestions and would like some feedback if you found it useful, as every source is a different world. This function does 2 assumptions. That after a scene change the worst film gate frame is the second, and the third frame is stable. And two, that the source is cel animation based since simple freezeframe() filters are being used.
    The function can be expanded in the future with frame interpolation for live footage. Test and share your experience, don't forget to upload a chunk of the source so I can check.


    FillBorders()

    The other two tools are related mainly to stab(). This is my main stabilization filter because it's very production friendly; works fine in one pass without too much parameter tweaking.
    As all deshakers go there is one main problem, mismatches. This generally creates black borders around the source frames to compensate for the stabilization, for that in stab() you can use the "mirror" parameter, something like mirror=15 will do the job, this can be called the "patchy" method. It won't fix the huge (over 5px) stabilization mismatches specially problematic in tilts and pans. This method requires you to go through the whole source and check carefully where stab() failed, sometimes not as evident as we used the mirror edge filling feature.

    A nicer more passive method was in need so I made the next two functions. After Stab() without the use of the mirror option I recommend to crop by at least 2 pixels on all sides, then we apply a pass of the new filter FillBorders(). This will fill dark borders with adjacent interpolated content, it uses AVSInpaint plugin hence results are much nicer than simple mirror filling. This filter will also work with retail sources that present random black borders, by using the "thr" setting you can tell how dark it must be to be validated as a border. Do tweaks while in debug mode.


    FindBlackBorders()

    The previous FillBorders() will work with black borders up to 3px, let's call this false positives because they are inherent stabilization borders we decided to fill rather than crop. After that threshold of 3px (plus 2px previously cropped) we are still left with some thick borders result of serious stab() mismatches, the better approach here is to trim out the whole scene. To avoid the tedious process of carefully rewatching the film/episode from start to finish, I created a second function, FindBlackBorders(). This will detect if any of the borders present a black or "thr" defined border and report to a statistics file. Meanwhile it will output the input clip untouched so you can do two things at the same time, render a preview clip to check stab() mismatches, and WriteFile border statistics to a file. This comes handy with very heavy filters or long episodic series.


    Stab2()

    Out of popular demand I created a small modification of this deshaker. It's not the best thing one could have but it's the best thing we have for avisynth, so I tried to make it a little bit better (more no-brainer). Tweaked defaults, prefilter clip parameter, increased contrast for motion analysis, and bug fixes for the hue shift and false positive thick borders. I didn't include the FillBorders() into the function because it is not perfect and I think you are better off cropping all borders 2px wide, thicker borders are dealt with FixFalPos.
    If you want more precision for the UVFix (HUE shift correction), disable the option and simply copy the code block on a 16-bit chain within your script, you might need some avisynth knowledge for this though.


    Examples (Outdated):

    So far our script looks like this:

    First/Debug Pass
    Code:
    # stabilization pass
    stab(ts=7,range=5,dxmax=15,dymax=15)
    
    # Crop some border garbage
    Crop(2, 2, -2, -2)
    
    # Clean stab() garbage a bit further (up to 3px)
    FillBorders(debug=false)
    
    # Now we have a clean slate to detect big stab() mismatches
    FindBlackBorders(path="C:\") # output statistics for ClipClop
    
    # For debug purposes you can test results of FilmGateFix() if you want
    FilmGateFix(debug=false)
    
    # Output to half the size for debugging doing trims with ClipClop
    RatioResize(0.5,"%")
    
    # Encode with x264 fast presets
    With the rendered output clip (now with most borders already cleaned) we load it in avspmod and load as well the statistics file using the Macro "Import Bookmarks from File".
    Now all we need to do is use F3 to jump through all bookmarks and manually trim out problematic scenes, hopefully saving us a few precious hours and eye health issues.

    For the trims I like using ClipClop() by StainlessS. After we finished, we replace our FindBlackBorders() line with the new ClipClop() one and render our main script.

    Second/Final Pass
    Code:
    unstab=Crop(2, 2, -2, -2)
    stab(ts=7,range=5,dxmax=15,dymax=15)
    Crop(2, 2, -2, -2)
    
    FillBorders(debug=false)
    FilmGateFix(debug=false)
    
    # recover problematic scenes from the unstab variable
    # also those from FilmGateFix(), although by default it's very conservative
    ClipClop(unstab,SCmd="1(20000,30000);1(80000,100000)")

    Stabilization Tools Pack v2.1 (16-09-2015)





    Changelog:
    Code:
    v2.1 - Fixed SC thr for Stab2()
         - Added FixFalPos and UVFix parameters to Stab2()
    v2.0 - Added Stab2()
         - Added Warning/Experimental notes
         - FilmGateFix bugfixes and changed thr default
    v1.9 - Added ternary to avoid checking for 4px borders in every frame
         - Swapped PadInwards() with internal function Letterbox()
         - Script cleanup
    v1.8 - Added thick border replacement in FillBorders() (no more need for FindBlackBorders() )
         - Greatly reduced false positives in FilmGateFix() and added detection of horizontal wobble
    v1.7 - Refactored FindBlackBorders() again for TRUE border detection
    v1.6 - Refactored FindBlackBorders() a bit and fixed some bugs along
         - Small ternary change in FillBorders()
    v1.5 - Documentation fix (InpaintLogo is spatial, Average.dll thread link)
         - Overall script cleaning and reformat
         - Fixed a mod crop issue in FilmGateFix()
         - In FilmGateFix() swapped mt_lutspa() with PadInwards() (custom helper function)
         - Huge overhaul and optimization of FillBorders()
    v1.0 - Initial release
    Last edited by Dogway; 16th Sep 2015 at 02:29.
    Quote Quote  
  2. I don't have time to play with this now, but I'm most interested in the FillBorders capability. I do a lot of stabilization, and neither Deshaker or Mercalli do a very good job with their fill border attempts. It will be interesting to see what sort of border this can create.
    Quote Quote  
  3. It's good for small borders because it tries to recreate content rather than plain mirroring, looks accurate. There are a few shortcomings, it only works up to 3px now although it can be expanded a bit more, and two, it assumes the border has a clean cut like those created from stab(). I need to work a bit more on it to expand the mask in case of analog inputs.

    Also when I tried it this morning for my current project it was a bit slow IMO, but more importantly it was unstable, I optimized the code a bit more but I think the one to blame is scriptclip(). I will do some more tests these days.
    Quote Quote  
  4. Thanks for these, Dogway. I've noticed occasional bad borders in my SD Simpsons encodes using Stab(Mirror=15)--I "fixed" them with the crop feature in MKVMerge--so I'm very curious to check these out.

    Edit: I was reading the .avsi and under requirements you list "average (version 2.00 or higher)" but the link opens the Doom9 thread for "SmoothAdjust". Don't know if this is intentional but I thought I'd point it out.
    Last edited by LouieChuckyMerry; 15th Apr 2015 at 03:25.
    Quote Quote  
  5. @LouieChuckyMerry: Thanks for the note. Redownload since I updated the whole thing.


    I want to stress that these solutions are mainly to film induced shaking, which is mild in comparison to handshaking. For that Gunnar's Deshaker is still the best option.

    As for the update details I almost completely rewrote the FillBorders() function. Now it's fast in a useable state.

    About the reported speed issues it happens to be that mt_lutspa() is actually very slow which caught me by surprise. Just replaced it with a combination of crop() and addborders() and did a few more optimizations. Among those I added a "pad" and "blur" setting clearly aimed at not clean cut (analog) borders. Pad extends the detected border by "n" pixels so more is filled. "blur" does the same but in a gradient fashion.
    Upon testing it looks like AVSInpaint doesn't make any distinction with greys so currently the "blur" setting sits there just for future proofness. The reason for this is because something about 3px wide starts to be a bit of a challenge for AVSInpaint's InpaintLogo(), this is the main reason that is the top thickness of the function and that I recommend to manually trim out serious border inconsistencies from the stab() process. That's exactly why FindBlackBorders() is useful for, it finds the thickest borders to aid in the painful process of trimming problematic scenes out.

    Because of this limitation of 3px I'm open to future ideas that can be implemented in replacement of InpaintLogo(). Something about consistent 6px interpolation should do a fine job. I'm not sure at all whether MVTools frame interpolation can take this role since it's more about temporal interpolation, here we need spatial mostly.
    Last edited by Dogway; 17th Apr 2015 at 04:27.
    Quote Quote  
  6. By the way, I was reading here. And found a function by Mini-Me very similar to my FillBorders() called FillBlackLines(), just that that one simply replaces borders with the unstable clip, so it's prone to show some cuts on borders with details. Also it doesn't have a border limit like mine.

    I'm reading about the stab() green artifact. I checked and it has a very slight hue shift to green on deshaked frames. It probably isn't too noticeable but I can't allow a degradation in a restoration project.
    My initial thought was to do a comparison to the "unstabilized" clip and if there was a change (deshaked) then apply a hue fix, the problem is that some stabilized frames don't show this green cast, and the hue shift could not be constant...

    edit: Reading a bit more, here jmac698 made some functions to replace Depan (the function that triggers the color cast). This served me as an idea to create my own Depan using resizer subpixel shifting. The problem is still collecting the stabilization data in one pass. DepanEstimate holds in buffer the motion data until the framebuffer is emptied, and the service clip looks like not useful at all.

    edit2: looks like it's not as easy as it seemed. I completed jmac698 intended function but it doesn't work as expected, maybe someone can shed a light here so we can fully replace Depan. I gave in and accepted to output a stats file. The difference would be that I would run the stab() call in the first pass along DepanEstimate for the stats and FindBlackBorders() for the stats file too. If I can get the below function to mimic stab() the stats from FindBlackBorders() in first pass could then be used in correlation.

    Code:
    ScriptClip ("""
    Str = RT_ReadTxtFromFile("ext1.log", 0, current_frame)
      
    dx=Value(MidStr(Str, 8, 8))
    dy=Value(MidStr(Str, 16, 8))
    trust=MidStr(Str, 40, 8)
    dx1=abs(dx)>0.5?0:dx
    dy1=abs(dy)>0.5?0:dy
    dx2=abs(round(ceil(dx)/2.0))
    dy2=abs(round(ceil(dy)/2.0))
    
    spline36resize(width(),height(),dx1,dy1,width(),height())
    padinwards(dx1>0?dx>0?0:dx2:0,dx1>0?dy>0?0:dy2:0,dx1>0?dx>0?dx2:0:0,dx1>0?dy>0?dy2:0:0,$000000)""" )
    Last edited by Dogway; 17th Apr 2015 at 13:37.
    Quote Quote  
  7. Originally Posted by Dogway View Post
    stab(ts=7,range=5,dxmax=40,dymax=40)
    What's ts? I've never seen that parameter on Stab(). And why set dxmax and dymax to 40? No video I know shakes that violently and ones that do aren't really worth repairing, especially with stab.

    And what exactly does your FilmGateFix function do? I couldn't understand a word of your description.

    Also, how does FillBorders recreate the missing content? You didn't provide any details.
    Quote Quote  
  8. ts is the internal radius of temporalsoften, the clip that is supplied to DepanEstimate inside Stab(). Maybe I have another version of the function, or maybe I just modified it a bit, can't remember. I also exposed more settings; Zoom and PAR.
    I can share if you want. Probably 40 is too high no doubt, I'm on a very shaky 1080p so maybe 25 could make more sense. I think it's ok to give always some extra room. (edit: bumped up dxmax/dymax value from checking Fred's 8mm script)

    As you said violent shakes shouldn't be repaired. They will show most likely as black borders. That's what FillBorders() do, it fills the black area with interpolated area from sourrounding pixels. It currently uses AVSInpaint plugin so it is very accurate for small borders, for thick borders (bigger than 3px) the black border is left untouched and then you use FindBlackBorders() function to create a stats file with all the avspmod bookmarks of the frames with thick borders that were not fixed with FillBorders().

    FilmGateFix() fixes film gate weaves, it is a distortion effect when the film passes through the film gate of the camera or telecine machine. You will mostly notice it in scene changes because about 15 years ago editing wasn't digital and film was actually cut and pasted one after another. This caused a bump in the film that translated in 2 or 3 distorted frames after a scene change. I hope this explanation makes it clear. The script is currently a bit experimental. It works for some anime sources I have around but I can't tell it works with everything you throw at it. The other two scripts are stable and 100% functional.
    Last edited by Dogway; 24th Jun 2015 at 12:07.
    Quote Quote  
  9. Scouring Depan source files for a hint on what to do for an alternative on Depan, I found a function called "compensate_plane_bicubic" which is the one that does the actual stabilization. I had the idea then to test with different subpixel kernels. "1" being bilinear also gave the color cast, tested with "0" nearest neighbor and it was fine, so this must be a problem on subpixel chroma shifting, something inside the function or any of its child functions, probably going as back as ancient avisynth code since it uses avisynth.h dated 03/2004.

    I'm not a programmer so I have no idea what could be happening. Also have no idea how to mimic the stabilization of the above function so if anyone wants to give a glance that would be the best option. The function is "compensate_plane_bicubic" inside interpolate.cpp in depan source.

    Meanwhile, as a workaround I will be using an automated script to recover hue. Looks fine so far, haven't noticed any chroma flashes but at this stage I don't trust my eyes anymore. It needs to be done in 16-bit because the hue shifts are mostly below integer values in a 8-bit scale of 256 tones.

    Code:
    ScriptClip ("""
    
    blue=round((AverageChromaU(before) - AverageChromaU()) * 256.0)
    red=round((AverageChromaV(before) - AverageChromaV()) * 256.0)
    
    Dither_convert_8_to_16()
    SmoothTweak16(saturation=1.0,hue1=min(384,blue),hue2=min(384,red),HQ=true)
    DitherPost(stacked=true,prot=false,mode=6)
    
    """, args="before" )
    Last edited by Dogway; 18th Apr 2015 at 09:44.
    Quote Quote  
  10. FilmGateFix() fixes film gate weaves, it is a distortion effect when the film passes through the film gate of the camera or telecine machine. You will mostly notice it in scene changes because about 15 years ago editing wasn't digital and film was actually cut and pasted one after another. This caused a bump in the film that translated in 2 or 3 distorted frames after a scene change. I hope this explanation makes it clear. The script is currently a bit experimental. It works for some anime sources I have around but I can't tell it works with everything you throw at it. The other two scripts are stable and 100% functional.
    lol, speak of the motherf***in' devil. I was just now working on a field-blended anime source with many problematic frames remaining before and after a scene change. I was about to start messing around with a Dedup log and change the values around spikes (scene change values) to 0 to drop those frames.

    If your function can already do this then that'll save me the grief of poking around a log file with excel.

    I get an error when I try your function though.

    Script error: scriptclip does not have a named argument "args"
    Stabilization Tools Pack v1.5.avsi, line 72


    About stab, it's never really been a reliable function. It rarely shifts the frame more than a single pixel regardless of the shake which is why I'm flabbergasted at the idea of using dxmax of 40 pixels. Just 6 pixels of shake at 1080p is violent shaking for me and stab is for removing projector wobble, not typical non-linear camera shake so it's rather useless for the serious shaking you describe.

    And the green tint is the least of its problems. Stab() sharpens the frames of the video it processes which increases entropy, enhances noise/artifacts and makes the video 50% bigger for any codec in the end.
    Quote Quote  
  11. The function is experimental, it's very conservative actually. Just use debug=true to check if your problematic areas/frames are considered for replacement, then play with threshold. Just read the header documentation in the script, it lists dependencies as well. You will need GRunT plugin for scriptclip. Both first and second frames after SC are considered for replacement.

    I think at some point stab() defaults were 30, I just raised a bit more, anyway I did a test and it makes no difference, 40 is a threshold. Maybe a value of 6 could be enough from stabilization center, the problem is the max difference from max and min from shake center, I can see that raising to 15 or 20px in 1080p. Since it is so poor documented I never worried too much, but there's no discussion, 30 is too high, I will fix it above.

    Maybe my English is not precise enough. This is what I wrote at the very top:
    I developed a set of tools to work with common stabilization issues, mainly from telecine process.
    For aggressive handheld camera shaking I still recommend vdub's Deshaker.
    I have tested it all and stab is the only one that can stabilize almost rock steady shaky or jittery sources. There was a very good one called Stabilise() but it lacked many many things like scene change detection, it also casted a green color and sharpened video. Stab() in the other hand and from the tests I did this morning if any it blurred my video, it's hard to tell unless you zoom x4 but it's not something I'm surprised at because it uses a bicubic kernel.
    Quote Quote  
  12. Upload the stab() you have because the one I got rarely if ever shifts the frame by more than one pixel no matter what dxmax or dymax values you input. Sometimes it even shifts the picture the wrong direction. This is why I've never been a fan of stab().

    I got your FilmGate fix to work but I can't get this frame to be detected, it occurs right after the last frame of the previous scene. I played around with all settings.

    http://pasteboard.co/2Fdm9Dlj.png

    Also, does stab() work for YV24 for anyone? For me it turns the video green. Doing stab() with YV12 is annoying because a black border of a single pixel will kill the chroma of the line next to it and I don't wanna lose more lines than I have to.
    Last edited by -Habanero-; 19th Apr 2015 at 00:05.
    Quote Quote  
  13. This is the one I got (tweaked defaults according):

    Code:
    function Stab (clip clp, int "ts", int "range", int "dxmax", int "dymax",float "zoom", int "mirror", float "PAR", clip "Mclip") {
    ts     = default(ts, 7)       #frames to temporal average for better motion estimation
    range  = default(range, 3)    #frames before/after to estimate motion
    dxmax  = default(dxmax, 4)    #maximum deviation in pixels
    dymax  = default(dymax, 4)    #x, and y should be the same
    zoom   = default(zoom, 1)     #maximum zoom factor (1 disabled)
    mirror = default(mirror, 0)   #Edge filling. 0 off, 15 everything on
    PAR    = default(PAR, 1.0)    #PAR of your source
    
    clp   = Defined(Mclip) ? Mclip : clp
    temp  = clp.TemporalSoften(ts,255,255,25,2)
    inter = Interleave(temp.Repair(clp.TemporalSoften(1,255,255,25,2)),clp)
    mdata = DePanEstimate(inter,range=range,pixaspect=PAR,trust=0,dxmax=dxmax,dymax=dymax,zoommax=zoom)
    
    DePan(inter,data=mdata,offset=-1,mirror=mirror,pixaspect=PAR,matchfields=false,subpixel=2)
    SelectEvery(2,0) }
    For completeness I'm going to list all the shortcomings:
    -Color tint (hue shift to green) when subpixel>0
    -No medium jitter fix
    -No advance border fill
    -Requires mod 8 inputs


    The problem is not whether you like stab() or not, but we haven't any real alternative to it. Deshake isn't that great for subpixel jitter, and it's not very avisynth friendly. About the screenshot you mean the first frame of a scene right? FilmGateFix() tries to fix film gate weave only, here I think you have some frame/field blending, the function wasn't written to deal with that. I think that if you work with very low quality anime sources like those with film gate weave, blending, etc it wouldn't be a bad idea to freeze all the first frames of a scene change with a current_frame+2 frame or something. The very first frame is too fast to notice a dup, if with FilmGateFix() you get a fix for the 2nd frame as well you will have 3 dups in a row, but for anime this isn't something to worry much about.

    To fix black borders use my function above FillBorders(). If you want to include the chroma line as well add pad=1
    Last edited by Dogway; 19th Apr 2015 at 17:41.
    Quote Quote  
  14. Thanks, my stab.avsi was missing a lot of parameters, not that it matters though because it didn't help stabilization at all. Stab is not that good, period.

    I tried your FillBorders function and sorry to say it doesn't look good. I get better results simply using the pre-stabbed edges on the stabbed video. I believe you mentioned someone that created this. I created my own script for it.

    Your filmgate was useful though because it removed many problematic frames after scene changes.
    Quote Quote  
  15. Originally Posted by -Habanero- View Post
    Stab is not that good, period.
    Is that supposed to be some sort of a definitive statement? Because I use it all the time and it does a very good job, I think. Maybe your films don't shake from telecine jitter or whatever it's called but for some other reason.

    My only gripe is from the frames sometimes turning greenish. But the stuff I work on is black and white so I just greyscale it afterwards.
    Quote Quote  
  16. Stab() is good enough to ignore it.

    For the green color cast use the script above in post #9. It requires smoothadjust and dither. Probably at some point I will make a Stab2() with included FillBorders() and Hue fix.

    -Habanero-, it's great you don't like FillBorders(), it gives me the chance to post some pictures so anyone can judge regardless of what I, you or anyone says. Use whatever suits you quality/speed.

    RAW........................................... FillBlackLines().............................. FillBorders()
    ......................


    EDIT: Updated to v1.7. Now FindBlackBorders() should be very reliable. Before it was looking for a single pixel under thr value, now it's the average of the border.
    Last edited by Dogway; 21st Apr 2015 at 09:18.
    Quote Quote  
  17. Originally Posted by Dogway View Post
    Stab() is good enough to ignore it.

    For the green color cast use the script above in post #9. It requires smoothadjust and dither. Probably at some point I will make a Stab2() with included FillBorders() and Hue fix.

    -Habanero-, it's great you don't like FillBorders(), it gives me the chance to post some pictures so anyone can judge regardless of what I, you or anyone says. Use whatever suits you quality/speed.

    RAW........................................... FillBlackLines().............................. FillBorders()
    ......................


    EDIT: Updated to v1.7. Now FindBlackBorders() should be very reliable. Before it was looking for a single pixel under thr value, now it's the average of the border.
    Can you post the source of that video so I can see if I can reproduce the results?
    Quote Quote  
  18. source is like 45Gb, I don't have it anymore anyways.

    You can use any source that shakes, there's no need to test FillBlackLines(), it only fills borders with the shaky original frames, it's not supposed to interpolate, align or look good, it's dumb copy-paste from the original frame.
    Quote Quote  
  19. I updated the functions, FindBlackBorders() and FilmGateFix(), both got major game changer updates.

    For FindBlackBorders() you can now fix both thin and thick borders. For borders of 4 pixels thick or more it gets the frame replaced with one supplied in the FalsPos argument. A thr2 setting is also added because these borders aren't PC levels black at all, so a bit of leeway is needed although I don't think you need to change the setting much. This change actually converts FindBlackBorders() function in something anecdotal, but I think it is still a good tool for debugging, so I keep it. I still need to edit the examples of OP.

    The second change is for FilmGateFix(), now I got rid of many false positives, namely in tilts and pans, also added horizontal wobble detection and a limiter for the first frame of SC to don't freezeframe() if change of 2nd and 3rd frame is notorious. So basically it has been limited, but the good thing is that it's still detecting the good matches of v1.7 so it's a great improvement. This version can now be safely used without thinking it's going to mangle the work. Check with debug=true to rest assured.

    edit: updated to v1.9 to fix a variable that checked for thick borders for every frame (slow), even when no 3px borders were detected.
    Last edited by Dogway; 9th Aug 2015 at 09:13.
    Quote Quote  
  20. Originally Posted by Dogway View Post
    Probably at some point I will make a Stab2() with included FillBorders() and Hue fix.
    that will be good thing
    Quote Quote  
  21. Originally Posted by Dogway View Post
    Probably at some point I will make a Stab2() with included FillBorders() and Hue fix.
    +1 .
    Quote Quote  
  22. Updated to v2.0 with Stab2(), bugfixes on FilmgateFix() and some reality reminders.

    FillBorders() shortcomings
    Unfortunately Depan is so random and crappy that it's actually hard to work around it with robust results. Sometimes thick borders aren't BTB (sub-16 value) so they blend with image content and automatic border detection starts to be risky, so you have two options, ignore completely the FixFalPos parameter of FillBorders() (which was crafted for this purpose) and run afterwards a FindBlackBorders() pass so you can manually freezeframe, etc, in QC. Or another option that relieves you of some work in post, by making use of the FixFalPos parameter which will fix most false-positives and later running FindBlackBorders(thr=18) or so to check manually the stranded +16 black false-positives that might be left.

    FilmGateFix() shortcomings
    On the same vein FilmGateFix() is risky as well, yes, it removes a lot of film gate issues, it ignores some as well, but worse than that it creates some noticeable issues on scene change tilts/pans/zooms which I can't tolerate at all.

    This leaves us with only one painful but accurate solution, we can either use some plugins to write out all scene changes to bookmark format, or something less painful, leverage FilmGateFix() to do the same but only on scene changes subject to film gate issues (saving more time to the previous). With this we can do in one shot bookmark checks for FilmGateFix() (still to implement bookmark output) and FindBlackBorders() at the same time. Maybe we could do the later automatically or save it from doing on an hypothetical bug-free stabilizer, but to be honest film gate is something I'm pretty sure it will always need manual intervention, just like random big stains or spots.
    Last edited by Dogway; 12th Sep 2015 at 12:54.
    Quote Quote  
  23. Originally Posted by Dogway View Post
    Unfortunately Depan is so random and crappy that it's actually hard to work around it with robust results.
    Someone described Depan as a random number generator . I think it's time to contact Fizick, maybe he still has some interest in improving/fixing Depan.

    Regardless thanks for the update! Will definitely tryout Stab2().
    Quote Quote  
  24. Interesting blog, It's rare to see continous 5 or 6px shifts (false-positives) with Depan. From my observations it's mostly a subpixel stabilizer which fits nicely for our purposes since every other deshaker fixes everything but small jitter. Subpixel correction always leads to a 1px border size that you will have to crop afterwards. Sometimes there are false positives that create borders of 2, 3 and 4 pixels wide but they are rare. The most critical issue is that it tries to look for global motion instead of local motion, so even when there are still features Depan wants to correct the frame. I guess the benefits of Stab() can somewhat overlook its shortcomings as an automatic stabilizer, another option is to go the professional post-pro packages route.

    I doubt Fizick is willing or maybe capable of improving it, even StainlessS once mentioned about not wanting to deal with deshakers due to its complexity.
    Quote Quote  
  25. Did many changes to Stab2().

    Implemented a different FixFalPos code I borrowed from somewhere else, so now you don't need to rely on FindBlackBorders() or FillBorders() for the thick false-positive borders. This will replace frames with black (0 value) borders of 3 or more pixels with original, which happens very rarely exclusively on action scenes. I removed the padding border code, so now you will end with 1px and 2px borders, my best advice here is to crop(2,2,-2,-2), this will also get rid of the 1px pixel artifacting at borders.

    I also made the HUE shift correction toggleable with an argument and changed back the internal TemporalSoften SC threshold to 25, since it was giving some issues.

    This -I think- doesn't solve the (VERY) rare frame with >0 black borders that might slip through, I need to face the issue again to work around it but if it worries you run FindBlackBorders(3,17) and check all the bookmarks to find something suspicious. Also Depan has the annoying habit to shake when the foreground cel shakes (despite background being static), which I couldn't fix for Stab2() either.
    Quote Quote  
  26. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    This doesn't work.
    I've added AutoAdjust, yet Avisynth claims that the functions does not exist.

    stab() works fine -- I use it all the time. (Actually, I use my own minor modifications of it all the time.)

    The problem with "stabilizing" filters (Avisynth or otherwise) is that none of them really stabilize at all, beyond very minor issues you mostly see on VHS tapes. As far as in-picture content is concerned, it does almost nothing.
    - Deshaker (VirtualDub) is lousy
    - DePanEstimate has odd "snap back" problems that I cannot figure out, and the rotational stabilization does not work at all
    - Dynapel Steadyhand (software) is interesting but has limitations (cannot "not zoom", etc)
    - vReveal (software) is a joke
    - After Effects CS6+ is mildly useful for tracking static objects
    Last edited by lordsmurf; 17th Sep 2015 at 10:57.
    Quote Quote  
  27. Originally Posted by lordsmurf View Post
    The problem with "stabilizing" filters (Avisynth or otherwise) is that none of them really stabilize at all, beyond very minor issues you mostly see on VHS tapes. As far as in-picture content is concerned, it does almost nothing.
    - Deshaker (VirtualDub) is lousy
    - DePanEstimate has odd "snap back" problems that I cannot figure out, and the rotational stabilization does not work at all
    - Dynapel Steadyhand (software) is interesting but has limitations (cannot "not zoom", etc)
    - vReveal (software) is a joke
    - After Effects CS6+ is mildly useful for tracking static objects
    I have to respectfully disagree with just about everything you said.

    Yes, motion stabilization technology can remove film gate weave, and it can remove jitter on VHS films. However, it can also smooth camera pans, and it can make shaky hand-held footage look like it was taken on a tripod. And, for that last statement, it doesn't look almost like it was taken on a tripod, but instead, it looks exactly like it was taken on a tripod. See my final example below for proof.

    If you Google my name ("John Meyer") and "Deshaker,"

    "John Meyer" deshaker Google search

    you'll find that not only did I write a very lengthy guide for how to use this excellent freeware program, but I also wrote extensive scripts designed to completely automate its use inside of Sony Vegas. The program works extremely well, if you take the time to learn how to use it correctly.

    If you search the Doom9.org AVISynth forum, you will see that I created a branch of the film restoration script developed by "videofred." That script makes extensive use of stabilization using Depanestimate. It works flawlessly, and I have stabilized, literally, tens of thousands of feet of film over the past three years using this technology. Here is an example of some 1941 16mm film I transferred last month. There is a lot going on with this film restoration, but look at the total lack of motion in the "after" version on the right. This was done with Depanestimate:

    1941 Film Restoration of Buick Aviation Engine Plant Construction, Melrose Park, Illinois

    Finally, the king of the hill is Mercalli, by Prodad. I don't have the latest version yet (it's expensive). This new version absolutely nails the rolling shutter issues that plague videos taken with CMOS cameras that are stabilized in post production. However, except for the rolling shutter issues, even the older Mercalli version that I have (V2) works absolute miracles.

    If you doubt any of this, check out this YouTube side-by-side comparison of original footage and the Mercalli 2 stabilized version (current Mercalli is version 4). It is absolutely miraculous. This video was shot by one of the most amazing wildlife photographers I know, Jerry am Ende. Enjoy!

    Panasonic TM700 and Mercalli V2 Stabilization

    You do have to spend the time to learn how to use these programs. If you don't take the time to learn, you will not get good results. This is especially true of Deshaker which doesn't have a "user-friendly" interface. That's why I wrote my guide. Also, if you want to get the stunning results shown in Jerry's bird video, you do need to set your camera shutter speed to something a little faster than the normal 1/60 or 1/50 second. See this video to see the problems you can get when using a normal shutter speed. This problem shows up on some, but not all, stabilizations:

    Effect of Shutter Speed on Video Stabilization

    As you can see, the regular shutter speed video is just as stable, but depending on how much the camera is moving, without high shutter speed you can sometimes get blurred frames. You don't see these when the camera is in motion because your eye expects blur on moving objects, but when the video is stabilized, it looks like the auto-focus is popping in and out.

    So, I encourage everyone to use these marvelous programs. Despite the claim in the previous post, they work extremely well, as my examples clearly demonstrate.
    Quote Quote  
  28. @lordsmurf: stab2() works here just fine, latest AutoAdjust doesn't work on XP though, are you on XP?
    If stab() works for you then you don't need stab2() although I listed its issues within the function, these are statements not opinions. Also some people are not content with current avisynth solutions, Reel.Deal linked above to another harsh review on Depan. Here's another petition from a known avisynth user.

    ### -Color tint (hue shift to green) when subpixel>0 to stablizated frames --> addressed here
    ### -Artifacts occasionally on frame borders (1px skew) --> crop out
    ### -No advanced border fill --> addressed above ( FillBorders() )
    ### -Some false-positives when people clapping, trembling...
    ### -Requires mod 4 inputs?
    ### -No medium jitter fix (deshaker like)
    ### -Some thick borders (false positives) aren't 0 black on the inner side

    stab() isn't bad at all for live footage, and I know about mercalli, but it involves a lot of human intervention, starting by going out of avisynth (not practical without a pay check on the table). I was looking more for an automatic type of stabiliser for avisynth but for now I have had to trim out heavy action scenes and I still get "stabilization" on static scenes when the foreground cel (animation) trembles. Deshaker as stated on OP doesn't work at all for the dejitter effect we are looking for in animated content.
    Depanstabilize (stab() uses DePanEstimate) gives less false-positives regarding tremble, but it also performs worse generally on source jitter.

    If you want to see Depan flaws in action run Stab() with this small clip, it will end worse than it was.
    13Mb Mediafire
    Quote Quote  
  29. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Part of my issue is with statements like "However, it can also smooth camera pans, and it can make shaky hand-held footage look like it was taken on a tripod." I can also close my eyes, spin around until I'm dizzy, and make 3-point jumpshot with nothing but net. In both cases, that's not typical. It "can" do that, but how reliably? That's my issue. Nothing is reliable. Sometimes it works, and sometimes the script/software gives you the finger.

    We've talked many times over the years. So you know I'm always hoping that something better (that folks like you and I need) will emerge. But when it comes to stabilization (just like with software TBC), I've been waiting for 15+ years now. Yeah, it's gotten better over time, and some stabilization errors are 99% solvable. Yet others are not.

    That Buick sample would be easy for me to match results on, possibly even improve on. (Realize that you and I are not your average video users. So for many, that probably does seem amazing.) All I see there is a little vertical jitter (laymen jitter, not technical jitter), some dirt noise, and some muddy colors. That doesn't even need DePanEstimate, but simply a stab() mod (though I realize stab uses DPE as well). What I refer to is far, far worse amateur handheld footage.

    I've read your Deshaker guide. You went into lots of good detail, but it still had minimal effect for the sort of ugly source I have -- especially given how long an encode takes. I've not given up 100% on it, but DePanStabilize has always had more promising results. Yet none are satisfying.

    I've dabbled with VideoFred's scripts, but I've never really been pleased by them. It felt more like a rough draft of a script, rather than something I could pass off as professional work. (Now, those gave me some ideas, so those did have value!)

    What always ends up happening is I'm left with a video that only partially stabilized well. So I have to dump it into an NLE, go scene by scene (ugh!!) and take as much as I can. What stabilized badly has to use a more mild filter, or no stabilizing at all. By looking for better filter methods, my goal is to make this an easier process, and cut out steps where possible.

    Mercalli may be what I want. But I've also read bad reviews on it, and the samples were clearly cherry-picked. However, that was some years ago, so I'll give it another go. I'm going to download the demo and put some ugly footage to the test. (I don't really consider $119 to $299 expensive. That's doable.)

    Can you answer these?
    - What's the important difference between the plugins and standalones?
    - About plugins: I like that I can use the V2 on Windows and Mac, especially if I could deploy it on both. I prefer my Mac for intense editing in either Adobe Premiere CS3 or FCP, as it has an i7 CPU and 16gb RAM. Do the plugins work with Premiere CS3+. I can't find that info. Honestly, I don't really care for NLE plugins. I prefer standalones.
    - The jello-vision removal of the V4 is interesting. (Having to buy both is where things get expensive.)
    - I may have heard of Mercalli in the past, but for some reason just forgot. (I have medical reasons.

    Yeah, shutter speed is always something to contend with, but I find it the less annoying (and often uncorrectable) error. I can live with that.

    Stabilization mat not be as bad as I'm suggesting, but it's also not utopian as you're suggesting.
    Quote Quote  
  30. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Originally Posted by Dogway View Post
    @lordsmurf: stab2() works here just fine, latest AutoAdjust doesn't work on XP though, are you on XP?
    Yep.

    I'll try it on a Windows 7 system instead. Do any versions of AutoAdjust work with XP?

    If stab() works for you then you don't need stab2() although I listed its issues within the function, these are statements not opinions. Also some people are not content with current avisynth solutions, Reel.Deal linked above to another harsh review on Depan. Here's another petition from a known avisynth user.
    Oh yeah, if you search my past posts online, even just VH, you'll see I am not overly fond of quite a few Avisynth filters (or even Avisynth itself). The documentation often sucks, has too many variant filters, too many unresolved bugs, etc. It's often excellent, but often disappointing as well.

    (I saw jmac on one of those posts. I wish jmac would develop some useful filters, as he has lots of useful ideas. He was the closest I ever saw towards a software TBC actually happening.)

    If you want to see Depan flaws in action run Stab() with this small clip, it will end worse than it was.
    13Mb Mediafire
    What am I supposed to be seeing?
    Quote Quote  



Similar Threads