Log in

View Full Version : Vhs...


torwart
29th February 2012, 18:32
Hi.

I have 3 big problems with VHS restoration.

1) Remove horizontal scratches

2) Color correction

3) Enhance details(sharpen)

Here is one frame of my video:

http://s50.radikal.ru/i130/1202/bb/3c504622cc22.jpg




if only one of this problems will be completly solved , it will be a big step forward.





:thanks: for any suggestions!!!

yup
29th February 2012, 18:49
Hi torwart!
if only one of this problems will be completly solved , it will be a big step forward.
We can only solve problem partially :D
For remove horizontal lines see
http://forum.doom9.org/showthread.php?p=943287#post943287
After 5 years I have small progress, video became watchable.
yup.

Ghitulescu
29th February 2012, 19:18
It's not the same, here's a typical drop out (digitally captured).

Colour corrections and sharpening are quite simple, there are plenty of scripts here. You need however to use masks, as different parts of your video need different settings.

torwart
29th February 2012, 20:01
:thanks: for quick answers :)

Here is a very good script:

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) # you can also use "Clense(reduceflicker=false)" instead
SelectEvery(3,1)

it helped me a lot in dirt removal and now it helps with vertical scratches. it really works.

is it better to use it with separated fields or frames?
how to make this script more powerful for horizontal scratches?(if line is thick, it(script) leaves half of it)
can i use something else instead of medianblurt? to have more detailes...

johnmeyer
29th February 2012, 20:28
1) Remove horizontal scratchesHave you tried capturing using the manual tracking control on the VCR (usually the channel up/down button on the VCR itself)? That sure looks like tracking noise.

2) Color correctionIt looks like you have both chroma noise and also a chroma shift. Is this a first-generation tape? There are scripts that address each of these issues.

3) Enhance details(sharpen)You need to denoise before you do any sharpening. If you search in this forum for "VHS" and my user name, you will find quite a few script designed to deal with #2 and #3.

Didée
29th February 2012, 21:07
3) Enhance details(sharpen)
The term "detail enhancement" implies that there is any detail to start with.

torwart
1st March 2012, 15:29
I did not capture this video. one gye from tv just brought it to me and I have to do all I can to make it better. it is mpeg2 file. 720*576, 50i.

About detailes... not all the frames are like this frame.

what about script from above?? is it possible to change it for better working with horizontal lines???

Tempter57
3rd March 2012, 14:50
torwart
http://forum.videohelp.com/threads/323093-How-to-use-DeVCR-for-Avisynth/page2

torwart
3rd March 2012, 18:45
thank you Tempter57! I tried devcr and script from that page, but lines didn't disapear. i stayed on this script:

SeparateFields()
e=SelectEven().sharpen(0.2)
o=selectOdd().sharpen(0.2)



bvo = o.MVAnalyse(isb = true, truemotion=true, delta = 1, idx = 1, overlap=4, dct=1)
fvo = o.MVAnalyse(isb = false, truemotion=true, delta = 1, idx = 1, overlap=4, dct=1)
fco = o.MVFlow(fvo, idx=1, thSCD1=500)
bco = o.MVFlow(bvo, idx=1, thSCD1=500)
interleave(fco, o, bco)
DeGrainMedian(limitY=255,limitUV=255,mode=1, norow=true)
#DeGrainMedian(limitY=255,limitUV=255,mode=1)
od=selectevery(3,1)

bve = e.MVAnalyse(isb = true, truemotion=true, delta = 1, idx = 2, overlap=4, dct=1)
fve = e.MVAnalyse(isb = false, truemotion=true, delta = 1, idx = 2, overlap=4, dct=1)
fce = e.MVFlow(fve, idx=2, thSCD1=500)
bce = e.MVFlow(bve, idx=2, thSCD1=500)
interleave(fce, e, bce)
DeGrainMedian(limitY=255,limitUV=255,mode=1, norow=true)
#DeGrainMedian(limitY=255,limitUV=255,mode=1)
ed=selectevery(3,1)

interleave(ed,od)
Weave()
sharpen(0.2)

last
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) # you can also use "Clense(reduceflicker=false)" instead
SelectEvery(3,1)
separatefields
lsfmod
weave
tweak(cont=1)



спасибо

Tempter57
4th March 2012, 13:07
torwart
source (http://forum.videohelp.com/attachments/3526-1284989375/word.demuxed.m2v) & output (http://multi-up.com/661846)
My preset for script:
#ccd_sse2.vdf
#vdf_arguments:CamCD:0
#RemoveGrainSSE2.dll
#RemoveGrainTSSE2.dll
#RemoveDirt.dll
#RepairSSE3.dll
#Warpsharp.dll
#mvtools2.dll
#medianblur.dll
#mt_masktools-25.dll
#MT.dll
#awarpsharp2.dll
#DePulse.dll
#Gradfun2db.dll
#AddGrainC.dll
#DeHalo_alpha.avs
#RemoveColorBleeding.avs
#RemoveDirtMC.avs
#GradFunkMirror.avs
#GrainFactory3.avs
#LimitedSharpenFaster Mod.avs


setmtmode(2)
setmemorymax(640)

ConvertToRGB32()
CamCD(9,1) # chroma denoiced & DeRainbow
#ConvertToYUY2()
#DePulse(h=20, l=70, d=32, debug=false)
ConvertToYV12()

# ==== VHS colorshift ====
Vshift=2 # 2 пикселя на ленте
Hshift=0
mergechroma(last.awarpsharp2(depth=16,thresh=255,blur=3).crop(Hshift,Vshift,0,0, align=true).addborders(0,0,Hshift,Vshift))

# RemoveColorBleeding() # Delate Colorbleeding

#==== Remove horizontal scratches ====
source=last
RemoveDirtMC(false,10).RemoveDirt().RemoveDust(3)
crop(0,300,0,-148,true)
top = last
rdr = Overlay(source,top,y=300).tweak(sat=1.1)

# ==== Denoiced ====
pre = rdr.blur(1.5)
psup = pre.MSuper(pel=2, sharp=2)
rsup = rdr.MSuper(pel=2, sharp=2, levels=1)
vb2 = MAnalyse(psup, isb=true, truemotion=false, delta=2, blksize=16, overlap=8, dct=5)
vb1 = MAnalyse(psup, isb=true, truemotion=false, delta=1, blksize=16, overlap=8, dct=5)
vf1 = MAnalyse(psup,isb=false, truemotion=false, delta=1, blksize=16, overlap=8, dct=5)
vf2 = MAnalyse(psup,isb=false, truemotion=false, delta=2, blksize=16, overlap=8, dct=5)
den = rdr.MDegrain2(rsup,vb1,vf1,vb2,vf2,thSAD=400)

smD = mt_makediff(rdr,den,U=3,V=3)
mrg = rdr.mt_makediff(smD,U=3,V=3)
mrg_super = mrg.MSuper(pel=2,levels=1,chroma=true)
cf1 = MCompensate(mrg, mrg_super, vf1, thSCD1=400)
cb1 = MCompensate(mrg, mrg_super, vb1, thSCD1=400)
interleave(cf1, mrg, cb1)
MedianblurT(0,0,0,1) # Clense(reduceflicker=false)
SelectEvery(3,1)

# ==== Sharpening ====
DeHalo_alpha(rx=1.5, ry=1.5).LSFmod(defaults="slow", strength=240)

# ==== DeBanding & AddGrain ====
GradFunkMirror()
GrainFactory3(2,2,3,60,66,80,1.1,0.9,0.7,0,0,0,0,0,24,56,128,160)

Tempter57
4th March 2012, 13:09
torwart

# RemoveDirtMC 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, bool "_grey", int "limit")
{
_grey = default(_grey, false)
limit = default(limit, 6)
i = MSuper(clp, pel=2)
bvec = MAnalyse(i, isb=true, blksize=8, delta=1, truemotion=true) # for a backward search isb should be "true" not "false"
fvec = MAnalyse(i, isb=false, blksize=8, delta=1, truemotion=true) # for a forward search isb should be "false" not "true"
backw = MFlow(clp, i, bvec)
forw = MFlow(clp, i, fvec)
clipa = interleave(backw, clp, forw)
clipb = RemoveDirt(clipa, _grey, limit)
clipc = SelectEvery(clipb, 3, 1)
return clipc
}

function RemoveDirt(clip input, bool "_grey", int "repmode")
{
_grey = default(_grey, false)
repmode = default(repmode, 16)
clmode = 17
clensed = Clense(input, grey=_grey, cache=4)
sbegin = ForwardClense(input, grey=_grey, cache=-1)
send = BackwardClense(input, grey=_grey, cache=-1)
alt = Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode)
restore = Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
corrected = RestoreMotionBlocks(clensed, restore, neighbour=input, 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)
}

function RemoveDust(clip input, int _mode)
{
repmode = 16
clensed = Clense(input)
rep=Repair(clensed, input, mode=repmode)
return RemoveGrain(rep, mode=_mode)
}