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. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: Sep 2023
Posts: 31
|
Stablizing a film image ...
I'm trying to use Stab() to reduce vertical jitter on a TV broadcast of an old black-and-white movie (the usual problem with worn-down sprockets on the print, I guess).
It seems to help, although I see what looks like a 1-pixel black line on the top of the frame that flashes on and off. Is there some way to eliminate this artifact? Or, is there another plug-in I should use for this purpose? Also, I'm de-interlacing and converting the video from 29.970 to 23.976 fps, using: tfm().TDecimate() Not sure if(?) I can just add Stab() after that line, or if I need(?) to change my script somehow. TIA ! Last edited by frobber; 19th February 2026 at 06:27. |
|
|
|
|
|
#3 | Link |
|
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,789
|
You should always recover the original 24 fps cadence before applying stabilization.
"VideoFred" over at doom9.org started several epically long threads about film restoration. This includes film stabilization. I re-wrote some of his scripts and posted my own version there. Here is the original thread: The power of Avisynth: restoring old 8mm films He specifically addressed just stabilization here: An advanced stabilisation script Here is the stabilization code from my version of his script. You can try some of the parameters in your script. Code:
#STABILISING PARAMETERS #---------------------------------------------------------------------------------------------------------------------------- maxstabH=10 #maximum values for the stabiliser (in pixels) 20 is a good start value maxstabV=10 est_left=40 est_top=40 est_right=40 est_bottom=40 #crop and contast values for special Estimate clip est_cont=0.6 #Too large a value defeats stabilization #STABILIZING #.................................................................................................................................................................... stab_reference= cropped_source.crop(est_left,est_top,-est_right,-est_bottom).tweak(cont=est_cont).MT_binarize(threshold=80).greyscale().invert() mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstabH,dymax=maxstabV) #stab=DePanStabilize(cropped_source,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15).deflicker() #use this instead of next line to add the Deflicker function stab=DePanStabilize(cropped_source,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15) |
|
|
|
|
|
#4 | Link |
|
Registered User
Join Date: Sep 2023
Posts: 31
|
@johnmeyer, thank you for kindly sharing this.
I looked at VideoFred's script 256.1.01_Stab_only.avs, but I'm not sure how to use it. I have the various DLLs installed, but the script itself is fairly complicated. I tried pasting your script into what I've already got to correct the frame rate (after that step, as you indicated), but when I run it through MeGUI I get an error because cropped_source is undefined. Any additional hints to make this work would be much appreciated.
|
|
|
|
|
|
#5 | Link |
|
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,789
|
Sorry about posting only that fragment. My main intent was to show you some Depan parameters that work and produce good results.
If you click on the first link in my previous post, it takes you directly to my full script. Search for the undefined variable and you'll see what it is and how it gets defined. Here is a video that shows "before/after" examples of what the script can do. The first half dozen examples mostly show the stabilization and, as you will see, it works quite well. Before/After Examples |
|
|
|
|
|
#6 | Link |
|
Registered User
Join Date: Sep 2023
Posts: 31
|
Thanks, but now I'm lost. The first link in your previous post leads to a thread by videoFred. I don't see johnmeyer anywhere in that thread. Are you "videoFred"? I'm confused.
videoFred links to a ZIP file from 2012. I DL'd it and opened "01_E_Stabilisation_Only.avs". It is similar to the script fragment you pasted, but not the same. No mention of cropped_source anywhere. Perhaps I misunderstood something and just got completely lost. Also, these scripts don't really explain the various parameters. Are the crop values going to actually crop the image, or are these only for the stabilization code to do image processing? If they do crop the image, can I just use zero values, or will the algorithm cease to function? I need to know if any cropping/zooming will happen to the result, because I'm afraid that is a deal-breaker for my purposes. Last edited by frobber; 20th February 2026 at 23:54. |
|
|
|
|
|
#8 | Link | |
|
Registered User
Join Date: Sep 2023
Posts: 31
|
Quote:
|
|
|
|
|
|
|
#9 | Link |
|
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,789
|
Just a few days ago I gave someone else the link directly to my own script that is posted in the middle of that massive thread. I thought I had done that above, but as you found, it is just a link to the beginning of that thread.
Here is the link I should have sent to you: John Meyer's version of the film restoration script |
|
|
|
![]() |
| Tags |
| avisynth, stabilization, stabilize |
| Thread Tools | |
| Display Modes | |
|
|