View Full Version : Remove Dirt
torwart
17th February 2012, 17:46
Greetings.
I have a clip. It is very dirty. Dust, scratches, vertical lines, black and white dots and a lot of dirt is present in this clip. It is very old. From what to start??? Which plugins or/and scripts is better to use?? I am not a programmer an it's hard to understand which parameters I have to tune.
The clip is blackandwhite. 720*576, 25 f/s, Lagarith avi.
I have tried RemoveDirt and Remove Grain plugins , but it leaves part of a dirt in clip. Maybe you have some universal script with very strickt parameters for such a dirty video...
Thank you.
Bloax
17th February 2012, 18:03
I'll just go ahead and be a ninja:
"It'd be appropriate in such a case that you upload a sample for us to mess around with!"
Jenyok
17th February 2012, 18:27
torwart
Try to search (to find) in internet, for exaple, google.
Try to search (to find) here in forum.
Try this.
#
#
# File: RemoveDirt.avsi
#
# RemoveTempGrain, RemoveDirt and moution compensated RemoveDirt functions
#
# Functions:
#
# function RemoveTempGrain(clip clp, int "_mode")
#
# function RemoveDirt(clip clp, int "repmode", bool "_grey")
# function RemoveDirtMC(clip clp, int "limit", bool "_grey")
#
# function RemoveDirt2(clip clp, int "limit", int "rgrain", bool "_grey")
# function RemoveDirtMC2(clip clp, int "limit", int "rgrain", bool "_grey")
#
# function RemoveDirt_HQ(clip clp, int tlimit, int rgrain, bool "_grey")
# function RemoveDirt_HQMC(clip clp, int limit, int rgrain, bool "_grey")
#
# function RemoveDirtCareful(clip clp, int "th", bool "show")
# function RemoveDirtCarefulMC(clip clp, int "th", bool "show")
#
# function RemoveDirtS(clip clp, int "limit", bool "_grey")
# function RemoveDirtSMC(clip clp, int "limit", bool "_grey")
# function HQ_FilterS(clip clp)
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
# =============================================================================
#
#
function RemoveTempGrain(clip clp, int "_mode")
{
_mode = Default(_mode, 17)
rg = RemoveGrain(clp, mode=_mode)
return TemporalRepair(rg, clp)
}
# =============================================================================
#
#
function RemoveDirt(clip clp, int "repmode", bool "_grey")
{
_grey = Default(_grey, false)
repmode = Default(repmode, 16)
clmode = 17
clensed = Clense(clp, grey=_grey, cache=4)
sbegin = ForwardClense(clp, grey=_grey, cache=-1)
send = BackwardClense(clp, grey=_grey, cache=-1)
alt = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=repmode, modeU = _grey ? -1 : repmode)
restore = Repair(clensed, clp, mode=repmode, modeU = _grey ? -1 : repmode)
corrected = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \
dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode)
}
# RemoveDirtMC2 by heini011 on 26 February 2006
# Suggested by johnmeyer on 09 June 2010
# Incorporated into Filmrestoration script by videoFred on 08 July 2010
# Fixed (vector direction) by nephilis on 01 August 2010
# Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20 September 2010
#
function RemoveDirtMC(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=true)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=true)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=true)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = RemoveDirt(clipa, repmode=limit, _grey=_grey)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 2)
# clipc = SelectEvery(clipb, 7, 3)
return clipc
}
# =============================================================================
#
#
function RemoveDirt2(clip clp, int "limit", int "rgrain", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
_dgr1 = 0.35 + rgrain * 0.3
_dgr2 = 0.45 + rgrain * 0.4
repmode = 1
clensed = Clense(clp, grey=_grey, cache=4)
restore = clp.FluxSmoothST(3 + 3 * rgrain, rgrain)
restore = Repair(restore, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
restore = (rgrain == 0) ? restore.RemoveGrain(1) : \
restore.VagueDenoiser(threshold=_dgr1, chromaT=_dgr1, nsteps=7, percent=75).RemoveGrain(1)
alt = clp.VagueDenoiser(threshold=_dgr2, chromaT=_dgr2, nsteps=7, percent=100).RemoveGrain(5)
return RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, \
pthreshold=4 + 2 * rgrain, cthreshold=6 + 2 * rgrain, gmthreshold=40, \
dist=1, dmode=2, debug=false, noise=limit, noisy=12, grey=_grey)
# Alternative settings
# return RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=4, cthreshold=6, gmthreshold=40, dist=1, dmode=2, \
# debug=false, noise=limit, noisy=12, grey=_grey, show=true)
# return RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=6, cthreshold=8, gmthreshold=40, dist=3, \
# tolerance=12, dmode=2, debug=false, noise=limit, noisy=12, grey=_ grey, show=false)
}
# RemoveDirtMC2 by heini011 on 26 February 2006
# Suggested by johnmeyer on 09 June 2010
# Incorporated into Filmrestoration script by videoFred on 08 July 2010
# Fixed (vector direction) by nephilis on 01 August 2010
# Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20 September 2010
#
function RemoveDirtMC2(clip clp, int "limit", int "rgrain", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=true)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=true)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=true)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = RemoveDirt2(clipa, limit=limit, rgrain=rgrain, _grey=_grey)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 2)
# clipc = SelectEvery(clipb, 7, 3)
return clipc
}
# =============================================================================
#
#
function RemoveDirt_HQ(clip clp, int tlimit, int rgrain, bool "_grey")
{
_grey = Default(_grey, false)
_dgr = 0.4 + rgrain * 0.25
clensed = clp.RemoveTempGrain(1).FluxSmoothST(tlimit, rgrain)
restore = clp.VagueDenoiser(threshold=_dgr, nsteps=6, chromaT=_dgr, percent=100).RemoveGrain(1)
alt = restore
return RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, pthreshold=3 + 2 * rgrain, \
cthreshold=3 + 2 * rgrain, gmthreshold=40, dist=1, dmode=1, debug=false, \
noise=tlimit + 1, noisy=12, grey=_grey)
}
function RemoveDirt_HQMC(clip clp, int limit, int rgrain, bool "_grey")
{
_grey = Default(_grey, false)
super = MSuper(clp, pel=2, sharp=2)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=true)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
clipa = interleave(backw, clp, forw)
clipb = RemoveDirt_HQ(clipa, limit, rgrain, _grey=_grey)
clipc = SelectEvery(clipb, 3, 1)
return clipc
}
# =============================================================================
#
#
function RemoveDirtCareful(clip clp, int "th", bool "show")
{
th = Default(th, 16)
show = Default(show, false)
dirtless = clp.RemoveDirt()
# dirtless = clp.RemoveDirt2()
maskd = yv12lutxy(clp, dirtless, yexpr="x y - abs 16 > 255 0 ?", Y=3, U=-128, V=-128)
maskd = maskd.expand().reduceby2().reduceby2().expand(Y=3, U=-128, V=-128)
dirtless = (show == true) ? dirtless.subtitle("removedirt-ed") : dirtless
clp = Conditionalfilter(maskd, clp, dirtless, "Ydifferencefromprevious()+Ydifferencetonext()", "greaterthan", string(th))
# scriptclip(maskd, "subtitle(string(Ydifferencefromprevious()+Ydifferencetonext()))")
return clp
}
function RemoveDirtCarefulMC(clip clp, int "th", bool "show")
{
th = Default(th, 16)
show = Default(show, false)
super = MSuper(clp, pel=2, sharp=2)
bvec1 = MAnalyse(super, isb=true, blksize=8, delta=1, pel=2, truemotion=true)
fvec1 = MAnalyse(super, isb=false, blksize=8, delta=1, pel=2, truemotion=true)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
clp = Interleave(backw1, clp, forw1)
clp = clp.RemoveDirtCareful(th=th, show=show)
clp = clp.SelectEvery(3, 1)
return clp
}
# =============================================================================
#
#
function RemoveDirtS(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
clensed = clp.Clense(grey=_grey, cache=4)
alt = clp.RemoveGrain(2)
return (RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=4, cthreshold=6, gmthreshold=40, \
dist=1, dmode=2, debug=false, noise=limit, noisy=16, grey=_grey))
}
function RemoveDirtSMC(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
super = MSuper(clp, pel=2, sharp=2)
bvec1 = MAnalyse(super, isb=true, blksize=8, delta=1, pel=2, truemotion=true)
fvec1 = MAnalyse(super, isb=false, blksize=8, delta=1, pel=2, truemotion=true)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
clp = Interleave(backw1, clp, forw1)
clp = clp.RemoveDirtS(limit, _grey)
dnc = clp.RemoveTempGrain(1)
clp = clp.SelectEvery(3, 1)
dnc = dnc.SelectEvery(3, 1)
clp = clp.SeeSaw(dnc, Sstr=0.26, Szp=12, SdampHi=20, bias=40)
return clp
}
function HQ_FilterS(clip clp)
{
clp = clp.RemoveDirtSMC(limit=6)
clp = clp.YlevelsS(0, 1.05, 255, 0, 255)
clp = clp.LimitedSharpenFaster(Smode=4, strength=18, overshoot=1, wide=false)
return clp
}
torwart
17th February 2012, 18:50
Here it is https://rapidshare.com/files/91630146/1.avi
cobo
21st February 2012, 00:30
I experimented on your sample with Mdegrain3 and RemoveSpotsMC4, but the results didn't look promising.
For the vertical scratches I tried out descratch and VerticalCleaner, but the results looked worse than just leaving them alone.
The best result I could get was with Didées idea for a single frame spot remover (http://forum.doom9.org/showthread.php?p=1402690#post1402690) - adapted with SelectEvery second frame
so that it catches spots that are static over up to four frames.
I recommend using the older 0.5 version of medianblur for this because the newer versions cause some encoders to crash.
Medianblur 0.5 is only available here:
http://www.avisynth.org/warpenterprises/files/medianblur_25_dll_20041029.zip
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\medianblur0.5.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\MaskTools v2.0a48\mt_masktools-25.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\RemoveGrain1.0\RemoveGrainSSE2.dll")
import("C:\Program Files\AviSynth 2.56a\plugins\All\LimitedSharpenFaster.avsi")
avisource("2.avi")
greyscale()
SelectEvery(2,0)+SelectEvery(2,1)
# remove single-frame spots
o=last ox=o.width() oy=o.height()
osup = o.MSuper(pel=2,sharp=2)
bv1 = osup.MAnalyse(isb=true, delta=1,blksize=8,overlap=4,search=4)
fv1 = osup.MAnalyse(isb=false,delta=1,blksize=8,overlap=4,search=4)
bc1 = o.MCompensate(osup,bv1)
fc1 = o.MCompensate(osup,fv1)
Interleave(fc1,o,bc1)
MedianblurT(0,0,0,1)
SelectEvery(3,1)
a=last.Trim(0,1462)
b=last.Trim(1463,2924)
Interleave(a,b)
# remove single-frame spots
o=last ox=o.width() oy=o.height()
osup = o.MSuper(pel=2,sharp=2)
bv1 = osup.MAnalyse(isb=true, delta=1,blksize=8,overlap=4,search=4)
fv1 = osup.MAnalyse(isb=false,delta=1,blksize=8,overlap=4,search=4)
bc1 = o.MCompensate(osup,bv1)
fc1 = o.MCompensate(osup,fv1)
Interleave(fc1,o,bc1)
MedianblurT(0,0,0,1)
SelectEvery(3,1)
crop(0,0,-24,0)
addborders(0,0,24,0)
LimitedSharpenFaster( Smode=3, Lmode=3, ss_x=1.0, ss_y=1.0, strength=150, overshoot=0,soft=30, wide=false, edgemode=1 )
For the significant spots that remain, if you wanted to take the trouble, you could scroll through the clip in virtualdub
and note the bad frame numbers and replace them with interpolated replacement frames using MugFunkys Morph function.
Copy and save as Morph.avsi
# http://forum.doom9.org/showthread.php?t=161154
# 9th May 2011
# Using MVTools2 for repair of broken frames.
# morph by Mug Funky
# usage: if you have, say, frames 21 and 22 bad, then use "morph(20,23)"
function morph (clip c, int in, int "out", int "blksize")
{
Function fill_loop(string s, int stop, int count)
{
#return (stop == 0) ? s : string("tofill.mflowinter(morph_spr,fill_vb,fill_vf,time=" + string(100*(count - stop)/float(count))) + ",thscd1=800,thscd2=255).selectevery(tofill.framecount(),0)," + fill_loop(s,stop-1,count)
return (stop == 0) ? s : string("tofill.mflowinter(morph_spr,fill_vb,fill_vf,time=" + string(100*(count - stop)/float(count))) + ",thscd1=255,thscd2=255).selectevery(tofill.framecount(),0)," + fill_loop(s,stop-1,count)
}
out=default(out, 0)
blksize=default(blksize,16)
d=c.trim(in,out)# in-1?
numframes=d.framecount-2
tofill=d.selectevery(c.framecount(),0,c.framecount()-1)
global morph_spr=tofill.msuper()
fill_vf=morph_spr.manalyse(truemotion=true,blksize=blksize,isb=false,overlap=blksize/2)
fill_vb=morph_spr.manalyse(truemotion=true,blksize=blksize,isb=true,overlap=blksize/2)
filled=eval("interleave(" + fill_loop("" ,d.framecount()-1,d.framecount()-1) + "tofill.selectevery(tofill.framecount(),tofill.framecount())).assumefps(c.framerate())")
c.trim(0,-(in+1))++filled.trim(1,numframes)++c.trim(out,0)
}
Here's a list of morph calls for your sample clip:
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\mvtools2.dll")
import("C:\Program Files\AviSynth 2.56a\plugins\All\Morph.avsi")
morph(108,110)
morph(200,202)
morph(203,205)
morph(655,657)
morph(1444,1446)
morph(1522,1524)
morph(1700,1702)
morph(1952,1954)
morph(1986,1988)
morph(2069,2071)
morph(2147,2149)
morph(2152,2155)
morph(2164,2167)
morph(2212,2214)
morph(2228,2230)
torwart
22nd February 2012, 14:57
thank you cobo for your work!!!
i'll try your script.
Mounir
22nd February 2012, 19:21
Check here Towart:
http://avisynth.org/mediawiki/DeVCR
and here:
http://forum.videohelp.com/threads/323093-How-to-use-DeVCR-for-Avisynth?p=2019587&viewfull=1#post2019587
cobo
23rd February 2012, 12:03
DeVCR doesn't remove the scratches because they barely move from frame to frame, so there is no different information to replace them with.
I tried improving the levels and contrast in various ways including two different methods of automatic gain (colorYUV(autogain=true) amd Mug Funkys AGC (http://forum.doom9.org/showthread.php?t=73110) function). Here's what I would do after denoising and sharpening:
crop(24,0,-24,0)
levels(15,1.0,228,0,255,coring=false)
tweak(cont=1.28)
coloryuv(levels="TV->PC")
addborders(24,0,24,0)
Didée
23rd February 2012, 12:39
Here's what I would do after denoising and sharpening:
That's not so good. You're taking three steps to 1) enhance contrast, then 2) enhance contrast, finally 3) enhance contrast. Working with video in 8bit colorspace, that means you're first creating gaps, then creating more gaps, and finally creating evenmore gaps.
I'd rather use SmoothAdjust (forum.doom9.org/showthread.php?t=154971) to do it all in one go.
cobo
23rd February 2012, 16:47
OK. I think it needed more contrast anyways.
crop(24,0,-24,0)
SmoothTweak( brightness=-65, contrast=1.90, limiter=false, TVrange=false )
addborders(24,0,24,0)
or
crop(24,0,-24,0)
SmoothTweak( brightness=-65, contrast=1.90, limiter=true, TVrange=true )
addborders(24,0,24,0,$000000)
torwart
8th March 2012, 09:42
People.
help me to remove black line in the middle of a frame. this line stays there for whole video. i don't know how to erase it without bad artefacts.
help!!!!
there is a full video in post 4.
http://s018.radikal.ru/i513/1203/f5/bde36fc2a422.jpg
:thanks:
Selur
8th March 2012, 16:53
just a guess, haven't tested but one of the inpaint based plugins might work,..
Tempter57
8th March 2012, 21:19
torwart
source=last
crop(362,0,-344,0,true)
left = last.Mt_Convolution(Horizontal=" 48 64 96 64 48 ", vertical ="1", u=-128, v=-128).Mt_Convolution(Horizontal=" 48 64 96 64 48 ", vertical ="1", u=-128, v=-128).blur(1.5,0.0)
Overlay(source,left,x=362)
I experimented a little more with your clip and came up with these suggestions.
I find FFmpegSource (http://code.google.com/p/ffmpegsource/) works better than AviSource because it keeps the frames in correct order, which AviSource
doesn't seem to do.
I've tried various schemes to remove vertical scratch, none of them diminished the vertical scratches as much as the
convolution/overlay script posted above by Tempter57.
The MVtools-1 version of RemoveNoiseMC (http://forum.doom9.org/showthread.php?t=110078) leaves a little more detail and sharpness than RemoveDirt.
Increasing contrast and using HDRAGC (http://forum.doom9.org/showthread.php?t=93571) and a second inverted pass of it, to keep from blowing out the high and low values
while enhancing the middle values, helps to bring out what detail is there.
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\ffms2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\mvtools1.4.13.0.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\MaskTools158.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\MaskTools v2.0a48\mt_masktools-25.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\deblock.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\VagueDenoiser.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\FluxSmooth.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\RemoveGrain1.0\RemoveGrainSSE2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\RemoveGrain1.0\RepairSSE2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\RemoveDirtSSE2-0_9.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\medianblur0.5.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\SmoothAdjust.dll")
LoadPlugin("C:\Program Files\AviSynth 2.56a\plugins\All\AGC.dll")
import("C:\Program Files\AviSynth 2.56a\plugins\All\FFMS2.avsi")
import("C:\Program Files\AviSynth 2.56a\plugins\All\Morph.avsi")
import("C:\Program Files\AviSynth 2.56a\plugins\All\RemoveNoiseMC.avsi")
import("C:\Program Files\AviSynth 2.56a\plugins\All\RemoveDirt0_9.avs")
import("C:\Program Files\AviSynth 2.56a\plugins\All\SeeSaw.avsi")
import("C:\Program Files\AviSynth 2.56a\plugins\All\LimitedSharpenFaster.avsi")
FFmpegSource2("2.avi", fpsnum=25, fpsden=1)
greyscale()
morph(108,110)
morph(200,202)
morph(203,205)
morph(655,657)
morph(1444,1446)
morph(1522,1524)
morph(1700,1702)
morph(1952,1954)
morph(1986,1988)
morph(2069,2071)
morph(2147,2149)
morph(2152,2155)
morph(2164,2167)
morph(2212,2214)
morph(2228,2230)
morph(2248,2250)
morph(2765,2768)
morph(2814,2816)
SmoothTweak( brightness=-45, contrast=1.70, limiter=false, TVrange=true, smooth=0, dither=-1 )
HDRAGC(avg_lum=10, max_gain=3.0, protect=2, black_clip=0.5, shift=1, corrector=1.0, reducer=0.0)
invert()
HDRAGC(avg_lum=0, max_gain=1.0, protect=0, black_clip=0.0, shift=0, corrector=0.0, reducer=0.0)
invert()
source=last
crop(362,0,-344,0,true)
left = last.Mt_Convolution(Horizontal=" 48 64 96 64 48 ", vertical ="1", u=-128, v=-128).Mt_Convolution(Horizontal=" 48 64 96 64 48 ", vertical ="1", u=-128, v=-128).blur(1.5,0.0)
Overlay(source,left,x=362)
RemoveNoiseMC(rdlimit=11, denoise=6, rgrain=1, sharp=false)
# remove single-frame spots
o=last ox=o.width() oy=o.height()
osup = o.MSuper(pel=2,sharp=2)
bv1 = osup.MAnalyse(isb=true, delta=1,blksize=8,overlap=4,search=4)
fv1 = osup.MAnalyse(isb=false,delta=1,blksize=8,overlap=4,search=4)
bc1 = o.MCompensate(osup,bv1)
fc1 = o.MCompensate(osup,fv1)
Interleave(fc1,o,bc1)
MedianblurT(0,0,0,1)
SelectEvery(3,1)
crop(24,0,-24,0)
LimitedSharpenFaster( Smode=3, Lmode=3, ss_x=1.0, ss_y=1.0, strength=180, overshoot=0, soft=30, wide=false, edgemode=1 )
addborders(24,0,24,0)
Mug Funky
4th July 2012, 05:08
i haven't used this script in a BILLION YEARS, but here's an attempt at removing a scratch, so long as it doesn't move (which all depends on how stable the telecine's gate is and how much perf damage/shrinking the film has suffered over the years):
function stripekill(clip c, bool "show")
{
show=default(show,false)
b=c.blendfps(c.framerate(),20).fft3dfilter(bw=2,bh=2,ow=0,oh=0,bt=0,sigma=10000)
e=merge(b.mt_inpand(mode="-2,0,-1,0,0,0,1,0,2,0",y=3,u=3,v=3),b.mt_inpand(mode="-1,0,0,0,1,0",y=3,u=3,v=3),.75).mt_expand(mode="-2,0,-1,0,0,0,1,0,2,0",y=3,u=3,v=3)
f=merge(c,c.mt_inpand(mode="-1,0,0,0,1,0",y=3,u=3,v=3),.4).blur(1,0).blur(1,0)#.blur(1,0).blur(1,0).blur(1,0).blur(1,0).blur(1,0).blur(1,0)
linemask=mt_lutxy(b,e,expr="x y - abs")
\.bilinearresize(c.width,4).bilinearresize(c.width,8).bicubicresize(c.width,c.height,1,0)
\.bicubicresize(c.width,c.height,1,0).mt_inflate().mt_lut(expr="x 14 > 0 x 14 - - 14 + x ? 4 - 256 14 4 - / *").mt_inflate(y=3,u=-0,v=-0).mt_inflate(y=3,u=-0,v=-0).mt_lut(expr="x 256 96 / *") # 8 > 255 0 ?
maskedmerge(c,f,linemask)
show==true? linemask : last
bordermask=stackhorizontal(blankclip(color=$ffffff,width=1,height=8),blankclip(width=1,height=8),blankclip(color=$ffffff,width=1,height=8)).bilinearresize(c.width,c.height,.5,0,2,8).converttoyv12().levels(64,.5,243,0,255,coring=false).fity2uv()
maskedmerge(last,c,bordermask,y=3,u=3,v=3)
}
this might need updating to current plugin syntaxes. it might also be complete shite :)
use it by isolating it with crop first - you'll only want to run it on a sliver of the original clip, so try stackhorizontal(crop(blah_left_side),crop(middle).stripekill(),crop(blah_right_side))
torwart
7th April 2014, 19:57
hello people.
thanks for last 2 posts. i didn't see them 2 years ago.
one more question about remove dirt.
maybe this script is improved and simplifyed.
i have this:
http://s020.radikal.ru/i715/1404/c7/8aeab2e364d7.jpg (http://www.radikal.ru)
which script will be good for this kind of video?????????????
thank you.
Mounir
9th April 2014, 16:36
send a video sample , thank you
torwart
9th April 2014, 17:27
this is a link to download video
http://www.ssyoutube.com/watch?v=_3JqSpH48d8
a have the same quality...
Mounir
10th April 2014, 00:22
Try this script i just made but it'll need some more tweaks i believe:
http://www.mediafire.com/?ea5l5plldjreqh9
that gives you this:
sample1: http://www.mediafire.com/watch/kpj6lgpai205dkn/cuna_da_crucuna_1961-special-final2-sample.avi/
sample2: http://www.mediafire.com/watch/2h2clnlr3qucl22/cuna_da_crucuna_1961-special-final2-sample2.avi
torwart
10th April 2014, 06:52
to say thank you means to say nothing. the job is just great...
respect
torwart
10th April 2014, 10:49
Mounir, maybe it is a highest peak of impudence, but can you upload plugins, functions, and scripts in one bundle ???
it seems it became problematic to find all plugins, becouse i am serching for some of them and no luck yet...
torwart
11th April 2014, 13:09
helppp
i cant find these 3 files:
sse3.dll, unsharpHQ_v04.dll, ShowChannels.dll.
StainlessS
11th April 2014, 15:50
I'm gonna take a guess that you are looking for SSETools (or one of the others from RemoveGrain),
http://forum.doom9.org/showthread.php?t=103162
UnsharpHQ
http://avisynth.nl/index.php/UnsharpHQ
ShowChannels
http://forum.doom9.org/showthread.php?t=163829&highlight=showchannels
Its amazing what you can find if you use the 'Search' option at the top of every D9 page, also google has acquired some favour :)
See also Wiki here: http://avisynth.nl/index.php/Main_Page
in particular External filters direct link here: http://avisynth.nl/index.php/External_filters
EDIT: And an older archive at Warp enterprises here: http://www.avisynth.nl/users/warpenterprises/
torwart
15th April 2014, 09:40
Hello people.
I can't make the script working.
maybe i am doing something wrong or have wrong files.
i have many questions. get ready...
here is link on .rar file in which are placed all the scripts and plugins that i'm using.
http://www.mediafire.com/download/10xe9guju76u23e/SCRIPT.rar
so lets start.
1) which version of avisynth i need? in script is written 2.6. is it possible to use 2.5.8???
2) in script is wriiten that i need a plugin mvtools-v2.5.10. i could find only the 2.5.11.3. is it a problem?
3) masktools-v2.0a36\mt_masktools-26.dll") only for avisynth 2.6???
4) RemoveGrain_v1.0\RemoveGrainSSE3.dll") which version of removegrain 1.0b or 1.0pre???
5) remove grain sse3 and repair sse 2 is it right?
6) QTGMC 32-bit Plugins\Avisynth 32-bit Plugins\SSE3Tools.dll") i could find sse2 only!!!
7) in script import ("Removespots\RemoveSpots.avsi") and calling RemoveSpotsMC()???
8) which remove dirt.avsi do i need. i think there are many versions. is my(in .rar) version right?
9) could find only unsharp_hq only 0.5. in script is 0.4.
10) please check all the scripts and plugins if they are what they have to be...
11) maybe i need additional files to place somewhere in windows. if yes which??
thanks !!!
this is a link to download video
http://www.ssyoutube.com/watch?v=_3JqSpH48d8
Mounir
15th April 2014, 11:09
1) 2.6 is better but you can run it on 2.5
2) not a problem
3) mt_masktools-26.dll is for avisynth 2.6 for avisynth 2.5 > mt_masktools-25.dll
4) sse2 is ok from qtgmc plugins here: http://forum.doom9.org/showthread.php?t=156028
5) yes
6) just download qtgmc plugins http://forum.doom9.org/showthread.php?t=156028
7) yep totally normal
8) this is the one i have: https://www.mediafire.com/?8myfrxsfk0av1u8
Works with mvtools 1.1.1 (would be nice if someone could update it and make it work with mvtools 2...just sayin')
torwart
15th April 2014, 12:03
thanks Mounir.
2 more questions
one about which version of remove grain i need. 1.0b or 1.0pre
and second which removespots.avsi is better to use. with mine it gives error.
i found this jenyoks script
function RemoveSpotsMC(clip clp, int "limit", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 16)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveSpots(clp, limit=limit, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
but avisynth tells me "there is no Null clip".
Mounir
15th April 2014, 12:57
removegrainsse2 (from qtgmc plugins) should be fine i believe
removespots.avsi( the one i use):
https://www.mediafire.com/?oy9k0ak1uxejw3e
torwart
15th April 2014, 18:42
no luck yet.
i took your removespots.avsi and added more plugins which were written in this file. it seemed to start working , but...
when i throw script in virtualdub i see this:
http://s006.radikal.ru/i215/1404/34/55bf5cbbce43.jpg (http://www.radikal.ru)
when push PLAY this:
http://s020.radikal.ru/i714/1404/db/be162ba7ba3f.jpg (http://www.radikal.ru)
both versions 2.5.8 and 2.6 did the same.
maybe there is a mistake in a script itself or i don't have something needed.
what to look at???
_________________________________________________________________________________________________________
this is a final script with all new removespots.avsi plugins. i erased not needed lines. after # this sign and so on.
http://www.mediafire.com/download/590pf25z9b7ezpw/script.rar
please check it on your computers and see if it works!!!
i think its easier to learn C++ instead of doing what i do now...
SetMemoryMax(1024) did not help.
Mounir
15th April 2014, 19:24
it works for me (unsurprisingly) you're missing a .dll of some kind i guess
torwart
15th April 2014, 19:48
on windows 64bit, dlls should be in system 32 or syswow64?? i have in syswow64
from dlls i have avsrecursion and fftw3.dll. what i need more???
Mounir
15th April 2014, 20:38
try this version, perhaps you'll have more luck with it: https://www.mediafire.com/?b6bd6ngzjbe9wg9
the result is almost the same
torwart
15th April 2014, 22:01
no, it doesn't work
Mounir
15th April 2014, 22:37
even without the multithreading parts ? >> SetMemoryMax(900), SetMTMode(3,4) , SetMTMode(4)
fAy01
16th April 2014, 03:34
I ran into the CAVIstreamsynth error as well, mostly when using directshowsource on HD mp4 files. It was driving me crazy until I lowered the process priority of cscript(in my case the encoder process using wmcmd.vbs). After that everything was fine.
As far as I can tell when the encoder is taking up all processor time avisynth does not get enough information about the video stream and this causes the error. I think this is correct as when i ran it at normal priority it took wmcmd.vbs forever to determine the videostream length, when running at below normal priority it got the duration instantly.
Hope this will help people who are getting the CAVIstreamsynth error. Another tip, if you want to run a process at the priority of your choice all the time you may want to use the utility PRIO. Among other functions this can remember priority settings for processes.
http://forum.doom9.org/showthread.php?t=129302
torwart
16th April 2014, 21:23
i'll install new windows tomorrow and do everything from scratch.
there will be a lot of question...
torwart
17th April 2014, 10:55
now i have newly installed windows 7 ultimate 64 bit with service pack 1. only 1 program(winrar, skype, google chrome also) is installed. it is called AVISYNTH 2.6 (alpha 5).
i have one appeal. can u give me only one script to make only removing dirt and spots. nothing else like color correction and e.t.c. also if there would be list of needed plugins in that script it would be great. to know for 100% that i have all the plugins and script is working. another problem is dlls for system 32. as i know for windows 64 i have to put them in syswow64. is it true? list of these dll files will be appreciated :)
i'll be waiting for answer. even if it's negative.
also which virtual dub better to use???
Sparktank
17th April 2014, 11:47
another problem is dlls for system 32. as i know for windows 64 i have to put them in syswow64. is it true?
you can still put them in the syswow32 folder. they'll appear in the syswow64.
you can see this by copying to 32 first then trying to copy to 64, it should ask you if you want to replace/etc.
torwart
18th April 2014, 14:02
thanks to everybody.
bad thing is that result is 0.
many different errors.
Mounir
18th April 2014, 15:40
still struggling eh?
torwart
19th April 2014, 14:01
i'm back.
you guys did a lot but for now it didn't work for me.
i started new script from yours. here it is:
____________________________________
import("RemoveSpots.avs")
loadplugin("mvtools2.dll")
loadplugin("RemoveDirt.dll")
loadplugin("RemoveGrain.dll")
loadplugin("Repair.dll")
avisource("e:\script.avi")
converttoyv12
bicubicresize(900,720)
RemoveSpotsMC
turnright
RemoveSpotsMC
turnleft
_______________________________________
it works. here are only needed plugins. if i take one - it doesn't. so.
now i want to make working another function. it is remove dirt:
____________________________________________________
# You need: RemoveGrain, MVTools 1.1.1
function RemoveDirt(clip input, int limit, bool _grey)
{
clensed=input.Clense(grey=_grey, cache=4)
alt=input.RemoveGrain(2)
return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey)
}
function RemoveDirtMC(clip,int limit, bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)
bvec = clip.MVAnalyse(isb=false, blksize=8, delta=1, pel=2, truemotion=true, idx=1)
fvec = clip.MVAnalyse(isb=true, blksize=8, delta=1, pel=2, truemotion=true, idx=1)
backw = clip.MVFlow(bvec)
forw = clip.MVFlow(fvec)
clp=interleave(backw,clip,forw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}
____________________________________________________
when i import this removedirt.avs, load mvtools v1.11.4.5(i can't find 1.1.1) and write in script removedirtmc , avisynth tells me i don't know what removedirtmc means.
what could be a problem?? wrong version of mvtools or something else?? i made a separate script just for removedirt to do not interfere removespots function. the same. avisynth don't speaks that language.
avisynth plugins folder does the same error.
what to doooo??
torwart
19th April 2014, 14:46
answer is found. i had to write removedirtmc andddd (50). just removedirtmc don't work.
now another question. which are good parameters for removedirtmc function and removespotsmc???
torwart
19th April 2014, 15:49
now script is this:
_________________________________
import("RemoveSpotsMC.avs")
import("RemoveDirtMC.avs")
loadplugin("mvtools.dll")
loadplugin("mvtools2.dll")
loadplugin("RemoveDirt.dll")
loadplugin("RemoveGrain.dll")
loadplugin("Repair.dll")
ffvideosource("f:\picxel.mp4")
RemoveDirtMC(60)
turnright
RemoveSpotsMC
turnleft
RemoveSpotsMC
o=last ox=o.width() oy=o.height()
osup = o.MSuper(pel=2,sharp=2)
bv1 = osup.MAnalyse(isb=true, delta=1,blksize=8,overlap=4,search=4)
fv1 = osup.MAnalyse(isb=false,delta=1,blksize=8,overlap=4,search=4)
bc1 = o.MCompensate(osup,bv1)
fc1 = o.MCompensate(osup,fv1)
Interleave(fc1,o,bc1)
SelectEvery(3,1)
o=last ox=o.width() oy=o.height()
osup = o.MSuper(pel=2,sharp=2)
bv1 = osup.MAnalyse(isb=true, delta=1,blksize=8,overlap=4,search=4)
fv1 = osup.MAnalyse(isb=false,delta=1,blksize=8,overlap=4,search=4)
bc1 = o.MCompensate(osup,bv1)
fc1 = o.MCompensate(osup,fv1)
Interleave(fc1,o,bc1)
SelectEvery(3,1)
_____________________________
what else could be done to remove just dirt , spots and scrathes? nothing else. is there other plugins or functions???
Mounir
19th April 2014, 16:41
You have to import RemoveDirtMc.avs
torwart
19th April 2014, 16:58
both of them are MC. i just changed the name. i'll correct now.
torwart
19th April 2014, 19:07
is it a good idea to stabilize footage before removing dirt? i have read it in internet. will the result be better???
Mounir
19th April 2014, 22:01
yeah i'm sure it would be better to stabilize before removing dirt/denoising
Guest
19th April 2014, 23:33
@torwart
Please tell us where you got the source video. Thank you.
torwart
20th April 2014, 10:13
this is a source video:
http://www.youtube.com/watch?v=_3JqSpH48d8
this is a link to download it:
http://en.savefrom.net/#url=http://youtube.com/watch?v=_3JqSpH48d8&utm_source=youtube.com&utm_medium=short_domains&utm_campaign=www.ssyoutube.com
Guest
20th April 2014, 13:23
Thanks.
torwart
24th April 2014, 12:27
neuron2 is there any progress or nothing???
Guest
24th April 2014, 14:53
I was just asking to clarify rule 6 issues.
Seems like you've gotten some pretty good help.
EuropeanMan
1st May 2014, 01:46
@Mounir, I have to wonder WHY you called up VirtualDub plugins...what's the purpose?
Mounir
1st May 2014, 12:34
removing macroblocks and removing some color noise, i thought it was self explanatory
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.