logo Sign In

Avisynth gate weave stabilization

Author
Time
 (Edited)

OK, so let me preface this by saying I know very little about avisynth and am hopeless with programming, so I always need simple step by step instructions when attempting something like this.

So, here is the script I’m using, which works just fine:

AviSource(“P:\video.avi”)

converttoYV12()

LoadPlugin(“plugins/removedirt.dll”)
Import(“plugins/03_RemoveDirtMC.avs”)
dirt_strenght=20
RemoveDirtMC(dirt_strenght)

ConvertToRGB24
return last

Now, I found this stabilization script from GForce:

temp=orig.TemporalSoften(7,255,255,25,2)
rep=Repair(temp,orig,mode=16).TemporalSoften(1,255,255,25,2)
source=Interleave(rep,orig,rep)
mdata=DePanEstimate(source, range=1, trust=0, dxmax=1, dymax=1)
DePan(source, data=mdata, offset=1)
SelectEvery(3,2)

How do I incorporate it into the above script, so that it stabilizes before it removes dirt?
When I simply pasted it after converttoYV12() I got an error saying:
I don’t know what “orig” means.

Author
Time

I think before the line temp=orig.TemporalSoften(7,255,255,25,2) if you put

orig = last

I think that will address the error you’re getting.

Author
Time

Thanks, that fixed the error but the stabilization doesn’t seem to work - I see the preview now but it’s just as shaky as before 😦

Author
Time
 (Edited)

AviSynth is a great tool to have in your arsenal, as with any software there is a learning curve when you first start using it.

# Define orig
orig = last

# Remove Noise/Grain
temp=orig.TemporalSoften(7,255,255,25,2)
rep=Repair(temp,orig,mode=16).TemporalSoften(1,255,255,25,2)

# Merge DeNoised/DeGrained Frames into one sequence (3 frames for every 1 original frame)
source=Interleave(rep,orig,rep)

# Stabilize Video
mdata=DePanEstimate(source, range=1, trust=0, dxmax=1, dymax=1)
DePan(source, data=mdata, offset=1)

# Every 3 frames discard the 1st and 2nd frame
SelectEvery(3,2)

You probably don’t need all of the above, I’ve added comments to explain whats happening at each stage.

# Stabilize Video
source = last
mdata=DePanEstimate(source, range=1, trust=0, dxmax=1, dymax=1)
DePan(source, data=mdata, offset=1)

This is the stabilization part. If it’s not making a difference you may need to try playing with the settings, here is the explanation for the DePan plugin: http://avisynth.org.ru/depan/depan.html

Good Luck!

Original Trilogy in Replica Technicolor Project
Star Wars PAL LaserDisc Project

Author
Time

Thanks. I couldn’t get it to work but then I found stab.avs, which has the same thing at its core and importing that as a function and changing the dymax and dxmax values inside to 50 (dealing with a pretty shaky HD video) seems to have done the trick.

Author
Time

Harmy,

Glad you got it to work. As the inventor and as a user of stab, I’ve come across sources that require some modifications to stab over the years. If you have a particularly stubborn scene that stab doesn’t fix acceptably well, send it my way and I’ll have a look at it.

-G