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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 17th February 2012, 17:46   #1  |  Link
torwart
Registered User
 
Join Date: Jul 2010
Location: Tbilisi
Posts: 75
Remove Dirt

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.
torwart is offline   Reply With Quote
Old 17th February 2012, 18:03   #2  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
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!"
Bloax is offline   Reply With Quote
Old 17th February 2012, 18:27   #3  |  Link
Jenyok
Warm and fuzzy
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
torwart

Try to search (to find) in internet, for exaple, google.
Try to search (to find) here in forum.

Try this.

Code:
#
#
# 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
}
__________________
Warm and fuzzy (white and fluffy)

Last edited by Jenyok; 17th February 2012 at 18:37.
Jenyok is offline   Reply With Quote
Old 17th February 2012, 18:50   #4  |  Link
torwart
Registered User
 
Join Date: Jul 2010
Location: Tbilisi
Posts: 75
Here it is https://rapidshare.com/files/91630146/1.avi

Last edited by torwart; 24th February 2012 at 10:36.
torwart is offline   Reply With Quote
Old 21st February 2012, 00:30   #5  |  Link
cobo
Registered User
 
Join Date: Mar 2004
Posts: 118
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 - 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/warpenterpri...l_20041029.zip

Code:
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
Code:
# 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:
Quote:
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)

Last edited by cobo; 21st February 2012 at 01:06.
cobo is offline   Reply With Quote
Old 22nd February 2012, 14:57   #6  |  Link
torwart
Registered User
 
Join Date: Jul 2010
Location: Tbilisi
Posts: 75
thank you cobo for your work!!!
i'll try your script.
torwart is offline   Reply With Quote
Old 22nd February 2012, 19:21   #7  |  Link
Mounir
Registered User
 
Join Date: Nov 2006
Posts: 773
Check here Towart:
http://avisynth.org/mediawiki/DeVCR
and here:
http://forum.videohelp.com/threads/3...=1#post2019587
Mounir is offline   Reply With Quote
Old 23rd February 2012, 12:03   #8  |  Link
cobo
Registered User
 
Join Date: Mar 2004
Posts: 118
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 function). Here's what I would do after denoising and sharpening:
Quote:
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)
cobo is offline   Reply With Quote
Old 23rd February 2012, 12:39   #9  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Quote:
Originally Posted by cobo View Post
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 to do it all in one go.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 23rd February 2012, 16:47   #10  |  Link
cobo
Registered User
 
Join Date: Mar 2004
Posts: 118
OK. I think it needed more contrast anyways.
Quote:
crop(24,0,-24,0)
SmoothTweak( brightness=-65, contrast=1.90, limiter=false, TVrange=false )
addborders(24,0,24,0)
or
Quote:
crop(24,0,-24,0)
SmoothTweak( brightness=-65, contrast=1.90, limiter=true, TVrange=true )
addborders(24,0,24,0,$000000)
cobo is offline   Reply With Quote
Old 8th March 2012, 09:42   #11  |  Link
torwart
Registered User
 
Join Date: Jul 2010
Location: Tbilisi
Posts: 75
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.





torwart is offline   Reply With Quote
Old 8th March 2012, 16:53   #12  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
just a guess, haven't tested but one of the inpaint based plugins might work,..
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 8th March 2012, 21:19   #13  |  Link
Tempter57
Registered User
 
Join Date: Jan 2011
Location: Donetsk
Posts: 58
torwart
Code:
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)
Tempter57 is offline   Reply With Quote
Old 2nd July 2012, 23:07   #14  |  Link
cobo
Registered User
 
Join Date: Mar 2004
Posts: 118
I experimented a little more with your clip and came up with these suggestions.

I find 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 leaves a little more detail and sharpness than RemoveDirt.

Increasing contrast and using HDRAGC 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.

Code:
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)
cobo is offline   Reply With Quote
Old 4th July 2012, 05:08   #15  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
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):

Code:


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))
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 7th April 2014, 19:57   #16  |  Link
torwart
Registered User
 
Join Date: Jul 2010
Location: Tbilisi
Posts: 75
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:



which script will be good for this kind of video?????????????


thank you.

Last edited by Guest; 7th April 2014 at 20:31. Reason: rule 12
torwart is offline   Reply With Quote
Old 9th April 2014, 16:36   #17  |  Link
Mounir
Registered User
 
Join Date: Nov 2006
Posts: 773
send a video sample , thank you
Mounir is offline   Reply With Quote
Old 9th April 2014, 17:27   #18  |  Link
torwart
Registered User
 
Join Date: Jul 2010
Location: Tbilisi
Posts: 75
this is a link to download video

http://www.ssyoutube.com/watch?v=_3JqSpH48d8

a have the same quality...
torwart is offline   Reply With Quote
Old 10th April 2014, 00:22   #19  |  Link
Mounir
Registered User
 
Join Date: Nov 2006
Posts: 773
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
Mounir is offline   Reply With Quote
Old 10th April 2014, 06:52   #20  |  Link
torwart
Registered User
 
Join Date: Jul 2010
Location: Tbilisi
Posts: 75
to say thank you means to say nothing. the job is just great...

respect
torwart is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:14.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.