digitalFAQ.com Forum

digitalFAQ.com Forum (https://www.digitalfaq.com/forum/)
-   Restore, Filter, Improve Quality (https://www.digitalfaq.com/forum/video-restore/)
-   -   Ghost removal filters? (https://www.digitalfaq.com/forum/video-restore/10260-ghost-removal-filters.html)

jjdd 01-18-2020 10:21 PM

Ghost removal filters?
 
1 Attachment(s)
Hi trying to find good ghost removal Filter or DCT ringing filter

i did test GhostBuster and LGhost avisynth filter i guess they where ok but to much detail was removed before the ghost or ringing was removed

i did test tmpgenc 2.5 ghost removal to but it was about the same as GhostBuster and LGhost

have anyone test this VirtualDub filter MSU Tuner TV Restore Filter http://www.compression.ru/video/tune.../index_en.html

it was from this forum i did find about the MSU Tuner TV Restore Filter http://www.dscalerproject.org/phpBB/...b44baa059a190a

here is a example what i mean
the movie is recorded from old analog tv signal about 25 years ago and it´s a old movie from 68 so the ghosting is only visible sometimes maby best to not do anything about it :)

themaster1 01-20-2020 06:44 AM

For the ghosting i don't know but for the noise reduction that's what you could use:

Quote:

AVISource("E:\00-Montage\ghost.avi")
assumetff()
converttoyv12(interlaced=true)
separatefields()
#DeGrainMedian(limitY=0,limitUV=220,mode=3,norow=t rue,interlaced=true)
a=last
#clense(reduceflicker=false).merge(last,0.5).clens e(reduceflicker=false)
mot=removegrain(8,0).DepanEstimate(range=2)
take2=a.depaninterleave(mot,prev=2,next=2,subpixel =2)
clean1=take2.DeGrainMedian(limitY=255,limitUV=255, mode=5,norow=true,interlaced=false).selectevery(5, 2)

sup1 = clean1.minblur(1).removegrain(11,0)
\ .mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
\ .msuper(pel=2,sharp=0)
sup2 = a.msuper(pel=2,levels=1,sharp=2)
###### Good mvtools values, Do not change, checked##########
bv22=sup1.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=16,ov erlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=16,ov erlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,glob al=true,delta=1,blksize=16,overlap=8,search=5,sear chparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,glob al=true,delta=2,blksize=16,overlap=8,search=5,sear chparam=4,DCT=5)

interleave(a.mcompensate(sup2,fv22),a.mcompensate( sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensat e(sup2,bv22))
mergeluma(TMedian2(),0.9).mergechroma(TMedian2(),1 ).selectevery(5,2)

sup3 = last.msuper(pel=2,sharp=2)
bv33=sup3.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=8,ove rlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=1,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=2,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,glob al=true,delta=3,blksize=8,overlap=4,search=5,searc hparam=4,DCT=5)
last
weave()
################################################## ###############
function EdgeCleaner(clip c, float "strength", bool "rep", int "rmode", int "smode", bool "hot", bool "fix") {

strength = default(strength, 8.0)
rep = default(rep, true)
rmode = default(rmode, 17)
smode = default(smode, 0)
hot = default(hot, false)
fix = default(fix, true)

c = (c.isYV12()) ? c : c.ConvertToYV12()
strength = (smode==0) ? strength : strength+4

main = c.aWarpSharp(strength,1)
main = (rep) ? Repair(main,c,rmode) : main

mask = c.mt_edge("prewitt",4,32,4,32).mt_invert().mt_conv olution()

final = (!hot) ? mt_merge(c,main,mask) : Repair(mt_merge(c,main,mask),c,2)
final = (fix) ? Overlay(final,c.ConvertToRGB24().Crop(0,1,-c.width+1,-c.height+2),x=0,y=1) : final
final = (smode != 0) ? mt_merge(final,c,c.StarMask(smode)) : final

return final

}

function StarMask(clip c, int "mode") {

mode = default(mode, 1)

clean = (mode==1) ? c.RemoveGrain(17) : Repair(c.Deen("a3d",4,12,0),c,15).RemoveGrain(21)
diff = (mode==1) ? mt_makediff(c,clean) : NOP

final = (mode==1) ? diff.Greyscale().Levels(40,0.350,168,0,255).remove grain(7,-1).mt_edge("prewitt",4,16,4,16) : \
Subtract(mt_merge(clean,c,c.mt_edge("roberts",0,2, 0,2).mt_expand(mode=mt_circle(1)).mt_invert()),c). mt_edge("roberts",0,0,0,0).mt_deflate()

return final

}



function MinBlur(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200

RG11D = (r==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
\ : (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=u v2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegra in(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegra in(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r<=1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2 )
\ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U= uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U= uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}



# median of 5 clips from Helpers.avs by G-force
Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
{
chroma = default(chroma,"process") #default is "process". Alternates: "copy first" or "copy second"
#MEDIAN(i1,i3,i5)
Interleave(input_1,input_3,input_5)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
m1 = selectevery(3,1)
#MAX(MIN(i1,i3,i5),i2)
m2 = input_1.MT_Logic(input_3,"min",chroma=chroma).MT_L ogic(input_5,"min",chroma=chroma).MT_Logic(input_2 ,"max",chroma=chroma)
#MIN(MAX(i1,i3,i5),i4)
m3 = input_1.MT_Logic(input_3,"max",chroma=chroma).MT_L ogic(input_5,"max",chroma=chroma).MT_Logic(input_4 ,"min",chroma=chroma)
Interleave(m1,m2,m3)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
selectevery(3,1)
chroma == "copy first" ? last.MergeChroma(input_1) : chroma == "copy second" ? last.MergeChroma(input_2) : last
ConverttoRGB32(matrix="rec601",interlaced=false)
LoadVirtualDubPlugin("C:\Program Files (x86)\VirtualDub\plugins\Camcorder_Color_Denoise_s se2.vdf", "CCD", 1)
CCD(7,1) # de 0 à 100 # Défaut =30 /
converttoyv12(matrix="rec601",interlaced=false)
Return(last)
}

function TMedian2(clip c) {
Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2) ) }


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=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=li mit,noisy=4, grey=_grey)

# Alternative settings
# return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=li mit,noisy=12,grey=_grey,show=true)
# return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_ grey,show=false)
}

jjdd 01-20-2020 07:24 AM

themaster1 Thanks :)

there are some errors in the code i guess something happened when you paste the code in the forum post

i did fix it there was many one space key errors

one more thing to get is Camcorder_Color_Denoise_s se2.vdf then maby it works

did find it from here http://acobw.narod.ru/

it looks very good Thanks again :)

msgohan 01-20-2020 08:42 AM

5 Attachment(s)
I see two echos of the edges. I don't know whether these were caused by the transmission, or if they are oversharpening halos from the playback VCR.

The black level of your clip is too high. Did you adjust it using Histogram in VirtualDub's Capture Mode without cropping "black" borders and head-switching noise? That would lead to this incorrect result.

Simple way that I know to reduce haloing is to downscale-upscale. You can choose the exact downscale width yourself; I just picked what looked good to me. The subtitles in your source have a higher resolution than the background video, which is a blurry old film print.

Code:

AVISource("ghost.avi").AssumeTFF()

# 'phase shift'
SeparateFields().Trim(1,0).Weave()

# downsize - upsize
Spline36Resize(330,height).nnedi3_rpow2(rfactor=2,cshift="lanczosresize",fwidth=width,fheight=height)

# black/white levels (brightness & contrast)
ConvertToYV24()
ColorYUV(off_y=-14,gain_y=14)

Source
Attachment 11096

Fix temporal field alignment; no more overt combing
Attachment 11097

Reduce halos
Attachment 11098

"Better" levels
Attachment 11099

Quote:

Originally Posted by jjdd (Post 65899)
Hi trying to find good ghost removal Filter or DCT ringing filter

DCT ringing is a technical term for a specific compression artifact found in JPEG, MPEG, DV, etc. It can never be present in video that was always analog & captured losslessly without a lossy compression step in between.

https://en.wikipedia.org/wiki/Ringing_artifacts#JPEG
https://kornel.ski/deringing/

Your sample is RGB32. A proper YUY2 lossless version of your clip is a little over 50MB instead of 90MB. When creating samples, use Direct Stream Copy mode in VirtualDub or Fast recompress if you need to change the compressor. The default Full processing mode converts to RGB, inflating the size and clamping values <16 & >235.

jjdd 01-20-2020 09:02 AM

4 Attachment(s)
msgohan Thanks :)

im going to test this im a beginner when it comes to ghost removal :)

the ghosting is caused by the transmission that im sure of

-- merged --

themaster1 have you managed to run that denoise script on Avisynth+ 64bit

it does work very good with avisynth 32bit and i get about 5.5FPS

but i did try to get it to work with Avisynth+ 64bit it almost works and i get 23FPS :)

but there is something weird about depaninterleave when you run Avisynth+ 64bit

here is the modified code that i did get to work but not as good as the Avisynth 32 bit version
i had to add ConvertToYUY2 to depaninterleave and i have to take out selectevery(5,2)

so if someone know how to get it to work as good as with Avisynth 32bit that would be great :)

Code:


AVISource("E:\00-Montage\ghost.avi")
AssumeTFF()
ConvertToYV12(interlaced=true)
separatefields()

#DeGrainMedian(limitY=0,limitUV=220,mode=3,norow=t rue,interlaced=true)
a=last
#clense(reduceflicker=false).merge(last,0.5).clens e(reduceflicker=false)
mot=removegrain(8,0).DepanEstimate(range=2)
take2=ConvertToYUY2(a,interlaced=false).depaninterleave(ConvertToYUY2(mot,interlaced=false),prev=2,next=2,subpixel =2)

clean1=take2.DeGrainMedian(limitY=255,limitUV=255, mode=5,norow=true,interlaced=false).selectevery(5, 2).converttoyv12()


sup1 = clean1.minblur(1).removegrain(11,0)
\ .mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
\ .msuper(pel=2,sharp=0)
sup2 = a.msuper(pel=2,levels=1,sharp=2)
###### Good mvtools values, Do not change, checked##########
bv22=sup1.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)

y=interleave(a.mcompensate(sup2,fv22),a.mcompensate( sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensate(sup2,bv22))
mergeluma(TMedian2(),0.9).mergechroma(TMedian2(),1 )#.selectevery(5,2)

sup3 = last.msuper(pel=2,sharp=2)
bv33=sup3.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
last
weave()
################################################## ###############
function EdgeCleaner(clip c, float "strength", bool "rep", int "rmode", int "smode", bool "hot", bool "fix") {

strength = default(strength, 8.0)
rep = default(rep, true)
rmode = default(rmode, 17)
smode = default(smode, 0)
hot = default(hot, false)
fix = default(fix, true)

c = (c.isYV12()) ? c : c.ConvertToYV12()
strength = (smode==0) ? strength : strength+4

main = c.aWarpSharp(strength,1)
main = (rep) ? Repair(main,c,rmode) : main

mask = c.mt_edge("prewitt",4,32,4,32).mt_invert().mt_conv olution()

final = (!hot) ? mt_merge(c,main,mask) : Repair(mt_merge(c,main,mask),c,2)
final = (fix) ? Overlay(final,c.ConvertToRGB24().Crop(0,1,-c.width+1,-c.height+2),x=0,y=1) : final
final = (smode != 0) ? mt_merge(final,c,c.StarMask(smode)) : final

return final

}

function StarMask(clip c, int "mode") {

mode = default(mode, 1)

clean = (mode==1) ? c.RemoveGrain(17) : Repair(c.Deen("a3d",4,12,0),c,15).RemoveGrain(21)
diff = (mode==1) ? mt_makediff(c,clean) : NOP

final = (mode==1) ? diff.Greyscale().Levels(40,0.350,168,0,255).removegrain(7,-1).mt_edge("prewitt",4,16,4,16) : \
Subtract(mt_merge(clean,c,c.mt_edge("roberts",0,2, 0,2).mt_expand(mode=mt_circle(1)).mt_invert()),c). mt_edge("roberts",0,0,0,0).mt_deflate()

return final

}



function MinBlur(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200

RG11D = (r==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
\ : (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r<=1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2 )
\ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U= uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U= uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}



# median of 5 clips from Helpers.avs by G-force
Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
{
chroma = default(chroma,"process") #default is "process". Alternates: "copy first" or "copy second"
#MEDIAN(i1,i3,i5)
Interleave(input_1,input_3,input_5)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
m1 = selectevery(3,1)
#MAX(MIN(i1,i3,i5),i2)
m2 = input_1.MT_Logic(input_3,"min",chroma=chroma).MT_Logic(input_5,"min",chroma=chroma).MT_Logic(input_2 ,"max",chroma=chroma)
#MIN(MAX(i1,i3,i5),i4)
m3 = input_1.MT_Logic(input_3,"max",chroma=chroma).MT_Logic(input_5,"max",chroma=chroma).MT_Logic(input_4 ,"min",chroma=chroma)
Interleave(m1,m2,m3)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
selectevery(3,1)
chroma == "copy first" ? last.MergeChroma(input_1) : chroma == "copy second" ? last.MergeChroma(input_2) : last
ConverttoRGB32(matrix="rec601",interlaced=false)
LoadVirtualDubPlugin("C:\Program Files\VirtualDub64\plugins64\ccd_64bit.vdf", "CCD", 1)
CCD(7,1) # de 0 à 100 # Défaut =30 /
converttoyv12(matrix="rec601",interlaced=false)
Return(last)
}

function TMedian2(clip c) {
Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2) ) }


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=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)

# Alternative settings
# return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=li mit,noisy=12,grey=_grey,show=true)
# return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_ grey,show=false)
}

and i put my Avisynth+ 64bit Plugins here to that i did use to get it to work and the Virtualdub plugin ccd_64bit.vdf

i put an example how Avisynth 32bit does the denoise and how the Avisynth+ 64bit does it
you can see tru if something goes fast you see what i mean on the example

lordsmurf 01-22-2020 10:12 AM

I wanted to quickly mention that some of my most impressive de-ghosting work was actually done in TMPGEnc Plus 2.5, with some of the filters found in it. The chased it with Avisynth. So while Avisynth in the defacto tool for restoration, often followed by VirtualDub, remember that some other useful tools may exist.

I see you tried this, so kudos. :)

jjdd 01-22-2020 10:18 AM

lordsmurf ok Thanks for the info i have to try it more
to be honest i didn't try it so much i did only give it one setting and done i was to lazy :)

lordsmurf 01-22-2020 10:28 AM

I never need the de-ghosting, aside from my nth gen hobby work, and haven't done any of that in years. I took care of my more difficult hobby projects in the late 2000s.

But I do vividly recall filter chains in TMPGEnc were like 8-12 filters long, sometimes using the same filter with a different preset in the chain. In hindsight, and after Avisynth advances, some of the NR would probably be better done in Avisynth now, but that'd be one heck of a back-and-forth between the programs, time consuming chain. But doable!

Good luck. Ghosting can be a harder error to chew through.

But again, I think the error on this thread is slight, not like the ghastly analog cable sources I was doing, recorded to VHS.

jjdd 01-22-2020 10:35 AM

ok :)

lordsmurf have you test MSU Tuner TV Restore Filter VirtualDub filter
i think it have ghost removal to but do not know how good or bad

lordsmurf 01-22-2020 10:50 AM

I've never liked anything from MSU. Something better always seems to exist.

jjdd 01-22-2020 11:38 AM

lordsmurf ok :)

themaster1 01-22-2020 11:58 AM

Quote:

Originally Posted by jjdd (Post 65927)
msgohan Thanks :)

im going to test this im a beginner when it comes to ghost removal :)

the ghosting is caused by the transmission that im sure of

-- merged --

themaster1 have you managed to run that denoise script on Avisynth+ 64bit

it does work very good with avisynth 32bit and i get about 5.5FPS

but i did try to get it to work with Avisynth+ 64bit it almost works and i get 23FPS :)

I've never dared to try (only avisynth 2.6 MT), i guess it's time if i consider the fps increase.

Usually i use SetMemoryMax(1200).SetMTMode(3,4) but it's a funky experience (some filters like that other don't...) and then i find myself trying all combinations possible during 30min with avsmeter until it crash (or not). I hate avisynth deep inside me Arghhh

jjdd 01-22-2020 12:53 PM

themaster1 ok :)

i use this to avisynth 2.6 MT and i have similarly settings on the top of the script like you have SetMemoryMax(1920).SetMTMode(3,4)

the computer i use have i7-970 Processor and 12gig ram and Windows 7 64bit it´s maby 10 years old i did build it myself

but down on the script i i change SetMTMode to SetMTMode(5)"slower but more stabel" if there is unstable functions and change again to SetMTMode(2) or even SetMTMode(1) if does functions are more stable

i try to have SetMTMode as low as i can so i get more speed :)

and sometimes i use ImageWriter function to output image sequence if the script is slow and unstable then it does not matter if it crash you can just continue where it crashed :)

example of ImageWriter function it output image sequence as tiff

Code:

return last.ConvertToRGB24().imagewriter(file="D:\movie\image%d.tiff",start=0,end=0,type="tiff")
and to read the tiff image sequence example
Code:

ImageSource("D:\movie\image%d.tiff",start=0,end=99999,fps=25)

lordsmurf 01-22-2020 01:02 PM

Quote:

Originally Posted by jjdd (Post 65994)
themaster1 ok :)

i use this to avisynth 2.6 MT and i have similarly settings on the top of the script like you have SetMemoryMax(1920).SetMTMode(3,4)

the computer i use have i7-970 Processor and 12gig ram and Windows 7 64bit it´s maby 10 years old i did build it myself

but down on the script i i change SetMTMode to SetMTMode(5)"slower but more stabel" if there is unstable functions and change again to SetMTMode(2) or even SetMTMode(1) if does functions are more stable

i try to have SetMTMode as low as i can so i get more speed :)

and sometimes i use ImageWriter function to output image sequence if the script is slow and unstable then it does not matter if it crash you can just continue where it crashed :)

Interesting. I've saved these notes. :salute:

jjdd 01-22-2020 01:06 PM

lordsmurf :)

jjdd 01-23-2020 06:26 AM

Hi i was wrong about the speed Increase in Avisynth+ 64 bit sorry about that it did not do everything that Avisynth 32 bit did thats why it was faster

but i think i did manage to get it to work with Avisynth+ 64bit as good as with Avisynth 32bit but little slower :/

here is the Avisynth+ 64bit version
Code:


AVISource("E:\00-Montage\ghost.avi")

AssumeTFF()
ConvertToYV12(interlaced=true)
separatefields()

#DeGrainMedian(limitY=0,limitUV=220,mode=3,norow=t rue,interlaced=true)
a=last
#clense(reduceflicker=false).merge(last,0.5).clens e(reduceflicker=false)
#Interleave(temp.Repair(clp.TemporalSoften(1,255,255,25,2)),clp)
Interleave(last.selectevery(1,-2), last.selectevery(1,-1), last, last.selectevery(1,1), last.selectevery(1,2))

mot=removegrain(8,0).DepanEstimate(range=2)

take2=DePanInterleave(ConvertToYUY2(last,interlaced=false),data=ConvertToYUY2(mot,interlaced=false),prev=0,next=0,subpixel =2)

clean1=take2.DeGrainMedian(limitY=255,limitUV=255, mode=5,norow=true,interlaced=false).selectevery(5,2).converttoyv12()

sup1 = clean1.minblur(1).removegrain(11,0).mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2).msuper(pel=2,sharp=0)
sup2 = a.msuper(pel=2,levels=1,sharp=2)
###### Good mvtools values, Do not change, checked##########
bv22=sup1.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)

interleave(a.mcompensate(sup2,fv22),a.mcompensate( sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensate(sup2,bv22))
mergeluma(TMedian2(),0.9).mergechroma(TMedian2(),1.0 ).selectevery(5,2)

sup3 = last.msuper(pel=2,sharp=2)
bv33=sup3.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
last
weave()
################################################## ###############
function EdgeCleaner(clip c, float "strength", bool "rep", int "rmode", int "smode", bool "hot", bool "fix") {

strength = default(strength, 8.0)
rep = default(rep, true)
rmode = default(rmode, 17)
smode = default(smode, 0)
hot = default(hot, false)
fix = default(fix, true)

c = (c.isYV12()) ? c : c.ConvertToYV12()
strength = (smode==0) ? strength : strength+4

main = c.aWarpSharp(strength,1)
main = (rep) ? Repair(main,c,rmode) : main

mask = c.mt_edge("prewitt",4,32,4,32).mt_invert().mt_convolution()

final = (!hot) ? mt_merge(c,main,mask) : Repair(mt_merge(c,main,mask),c,2)
final = (fix) ? Overlay(final,c.ConvertToRGB24().Crop(0,1,-c.width+1,-c.height+2),x=0,y=1) : final
final = (smode != 0) ? mt_merge(final,c,c.StarMask(smode)) : final

return final

}

function StarMask(clip c, int "mode") {

mode = default(mode, 1)

clean = (mode==1) ? c.RemoveGrain(17) : Repair(c.Deen("a3d",4,12,0),c,15).RemoveGrain(21)
diff = (mode==1) ? mt_makediff(c,clean) : NOP

final = (mode==1) ? diff.Greyscale().Levels(40,0.350,168,0,255).removegrain(7,-1).mt_edge("prewitt",4,16,4,16) : \
Subtract(mt_merge(clean,c,c.mt_edge("roberts",0,2, 0,2).mt_expand(mode=mt_circle(1)).mt_invert()),c). mt_edge("roberts",0,0,0,0).mt_deflate()

return final

}

function MinBlur(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200

RG11D = (r==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
\ : (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r<=1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2 )
\ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U= uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U= uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}

# median of 5 clips from Helpers.avs by G-force
Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
{
chroma = default(chroma,"process") #default is "process". Alternates: "copy first" or "copy second"
#MEDIAN(i1,i3,i5)
Interleave(input_1,input_3,input_5)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
m1 = selectevery(3,1)
#MAX(MIN(i1,i3,i5),i2)
m2 = input_1.MT_Logic(input_3,"min",chroma=chroma).MT_Logic(input_5,"min",chroma=chroma).MT_Logic(input_2 ,"max",chroma=chroma)
#MIN(MAX(i1,i3,i5),i4)
m3 = input_1.MT_Logic(input_3,"max",chroma=chroma).MT_Logic(input_5,"max",chroma=chroma).MT_Logic(input_4 ,"min",chroma=chroma)
Interleave(m1,m2,m3)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
selectevery(3,1)
chroma == "copy first" ? last.MergeChroma(input_1) : chroma == "copy second" ? last.MergeChroma(input_2) : last
ConverttoRGB32(matrix="rec601",interlaced=false)
LoadVirtualDubPlugin("C:\Program Files\VirtualDub64\plugins64\ccd_64bit.vdf", "CCD", 1)
CCD(7,1) # de 0 à 100 # Défaut =30 /
converttoyv12(matrix="rec601",interlaced=false)
Return(last)
}

function TMedian2(clip c) {
Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2) ) }


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=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)

# Alternative settings
# return RestoreMotionBlocks(clensed,input,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,input,alternative=alt, pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=false)
}

light version here to Avisynth 32bit MT
block_size i have it on 16 but 8 and 4 works to but slower

Code:

  SetMemoryMax(1920)  #enable if you use MT mode
  SetMTMode(2,4)          #enable if you use MT mode

AVISource("E:\00-Montage\ghost.avi")
AssumeTFF()
ConvertToYV12(interlaced=true)
separatefields()

a=last

mot=removegrain(8,0).DepanEstimate(range=2)
take2=a.depaninterleave(mot,prev=2,next=2,subpixel =2)
clean1=take2.DeGrainMedian(limitY=255,limitUV=255, mode=5,norow=true,interlaced=false).selectevery(5, 2)

sup1 = clean1.minblur(1).removegrain(11,0).mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2).msuper(pel=2,sharp=0)
sup2 = a.msuper(pel=2,levels=1,sharp=2)
###### Good mvtools values, Do not change, checked##########
block_size=16
block_over=block_size/2
bv22=sup1.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=block_size,overlap=block_over,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=block_size,overlap=block_over,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=block_size,overlap=block_over,search=5,searchparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=block_size,overlap=block_over,search=5,searchparam=4,DCT=5)

interleave(a.mcompensate(sup2,fv22),a.mcompensate( sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensate(sup2,bv22))
return last.mergeluma(TMedian2(),0.9).mergechroma(TMedian2(),1 ).selectevery(5,2).Weave()

Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
{
chroma = default(chroma,"process") #default is "process". Alternates: "copy first" or "copy second"
#MEDIAN(i1,i3,i5)
Interleave(input_1,input_3,input_5)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
m1 = selectevery(3,1)
#MAX(MIN(i1,i3,i5),i2)
m2 = input_1.MT_Logic(input_3,"min",chroma=chroma).MT_Logic(input_5,"min",chroma=chroma).MT_Logic(input_2 ,"max",chroma=chroma)
#MIN(MAX(i1,i3,i5),i4)
m3 = input_1.MT_Logic(input_3,"max",chroma=chroma).MT_Logic(input_5,"max",chroma=chroma).MT_Logic(input_4 ,"min",chroma=chroma)
Interleave(m1,m2,m3)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
selectevery(3,1)
chroma == "copy first" ? last.MergeChroma(input_1) : chroma == "copy second" ? last.MergeChroma(input_2) : last
ConverttoRGB32(matrix="rec601",interlaced=false)
LoadVirtualDubPlugin("C:\Program Files (x86)\VirtualDub_1_9_11\plugins\ccd_32bit.vdf", "CCD", 1)
CCD(7,1) # de 0 à 100 # Défaut =30 /
converttoyv12(matrix="rec601",interlaced=false)
Return(last)
}

function TMedian2(clip c) {
Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2) ) }

function MinBlur(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200

RG11D = (r==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
\ : (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r<=1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2 )
\ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U= uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U= uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}

here is a Denoise script i have use much on Super 8 film it´s modified Videofred´s Script but it work ok for VHS to i think but it´s extremely slow only 1.6fps
Code:

  SetMemoryMax(1920)  #enable if you use MT mode
  SetMTMode(2,4)          #enable if you use MT mode
  LoadDll("C:\VIDEO BILDER S8/fftw3.dll")  #change the path where you have the dll files

m=AVISource("D:\movie\bttf2_930.avi",audio=false).AssumeTFF().SeparateFields().ConvertToYV12(interlaced=true)
m1=m.SelectOdd().denoise()
m2=m.SelectEven().denoise()
m3=interleave(m2,m1).Weave()

return m3

    function denoise(clip movie)
    {
    block_size=8
    block_over=block_size/2
    USM_sharp_ness=23 USM_radi_us=2
    USM_sharp_ness1 = USM_sharp_ness
    USM_sharp_ness2 = USM_sharp_ness+(USM_sharp_ness/2)
    USM_sharp_ness3 = USM_sharp_ness*2
    USM_radi_us1 = USM_radi_us
    USM_radi_us2 = USM_radi_us-1
    USM_radi_us3 = USM_radi_us2-1

 cleaned=movie.unsharpmask(USM_sharp_ness1,USM_radi_us1,0).RemoveGrain(2).unsharpmask(USM_sharp_ness2,USM_radi_us2,0).RemoveGrain(2)

    SetMTMode(5)  #enable if you use MT mode
    vectors= MVAnalyseMulti(cleaned,refframes=6, pel=2,truemotion=true, blksize=block_size ,blksizev=block_size, overlap=block_over,dct=0,idx=1,search=1,threads=12,prefetch=1)

    t=MVDegrainMulti(cleaned,vectors, thSAD=450,thSADC=0,limit=15, SadMode=0, idx=2,plane=4,threads=12).unsharpmask(USM_sharp_ness3,USM_radi_us3,0)

    b2=t.mgrain33().mgrain3().NonlinUSM(1.2,1.5,1.2,3.5)

    b22=overlay(b2,movie,mask=b2.GaussianBlur(VarY=20),opacity=1.0,greymask=true,mode="blend",pc_range=true)
    return b22
    SetMTMode(1) #enable if you use MT mode
    }

    function mgrain3(clip last)
    {
    blksize_size=4
    overlap_size=blksize_size/2
    dct=0
    tmotion=false
    super= last.MSuper(pel=2)
    bv1 = MAnalyse(super, isb = true, delta=1,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    fv1 = MAnalyse(super, isb = false, delta=1,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    bv2 = MAnalyse(super, isb = true, delta=2,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    fv2 = MAnalyse(super, isb = false, delta=2,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    bv3 = MAnalyse(super, isb = true, delta=3,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    fv3 = MAnalyse(super, isb = false, delta=3,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    l=last.MDegrain3(super, bv1,fv1,bv2,fv2,bv3,fv3,plane=4,thSAD=650,thSADC=100,limit=15)
    return l
    }

    function mgrain33(clip last)
    {
    blksize_size=32
    overlap_size=blksize_size/2
    dct=0
    tmotion=false
    super= last.MSuper(pel=2)
    bv1 = MAnalyse(super, isb = true, delta=1,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    fv1 = MAnalyse(super, isb = false, delta=1,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    bv2 = MAnalyse(super, isb = true, delta=2,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    fv2 = MAnalyse(super, isb = false, delta=2,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    bv3 = MAnalyse(super, isb = true, delta=3,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    fv3 = MAnalyse(super, isb = false, delta=3,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct)
    l=last.MDegrain3(super, bv1,fv1,bv2,fv2,bv3,fv3,plane=4,thSAD=500,thSADC=300,limit=15)
    return l
    }

    function NonlinUSM(clip o, float "z", float "pow", float "str", float "rad", float "ldmp")
    {
    z  = default(z,  6.0)  # zero point
    pow = default(pow, 1.6)  # power
    str = default(str, 1.0)  # strength
    rad = default(rad, 9.0)  # radius for "gauss"
    ldmp= default(ldmp, 0.001) # damping for verysmall differences

    g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0)

    mt_lutxy(o,g,"x x y - abs "+string(z)+" / 1 "+string(pow)+" / ^ "+string(z)+" * "+string(str)+
    \                        " * x y - 2 ^ x y - 2 ^ "+string(ldmp)+" + / * x y - x y - abs 0.001 + / * +",U=2,V=2)

    return(last)
    }


jjdd 01-24-2020 06:17 PM

i did test my old super 8mm film HDR avisynth scrip and did modified it little to test if i can use it somehow to overlay original clip to a clip i have done aggressive setting to removie ghosting

and it did works good maby :) Ghostbuster or LGhost avisynth plugin does not remove so much detail if i do the extream overlay thing that my HDR scrip does maby it does not need that many overlays maby just one :) it was many many hours trial and error when i did it for my Super 8mm film this HDR script :) but i did delete some lines of code which is not needed here

anyway i put it here

Code:

SetMemoryMax(512)
SetMTMode(2,4)

k_stab=AVISource("D:\movie\tpta4444.avi",audio=false).ConvertToYV12()
a_stab=k_stab
#b_stab=k_stab.ConvertToYuy2().ColorYUV(gain_y=-120,cont_y=0).Ghostbuster(offset=3,strength=95).ConvertToYV12()
b_stab=k_stab.ColorYUV(gain_y=-120,cont_y=0).LGhost(1,2,15,2,2,115,4,2,-127)

e=overlay(hhddrr01(a_stab,b_stab),hhddrro2(a_stab,b_stab),x=0,y=0,mask=hhddrr01(a_stab,b_stab),opacity=1.0,greymask=true,mode="Blend",pc_range=true)

return e


function hhddrro2(clip a_stab,clip b_stab)
{
t=a_stab
ab=overlay( b_stab,t,x=0,y=0,mask=b_stab,opacity=0.5,greymask=true,mode="Multiply",pc_range=true)

ab1=overlay(t,b_stab,x=0,y=0,mask=t,opacity=0.5,greymask=true,mode="hardlight",pc_range=true)
l=overlay(ab,ab1,x=0,y=0,mask=ab,opacity=1.0,greymask=true,mode="blend",pc_range=true)
last=overlay(l,t,x=0,y=0,mask=ab,opacity=1.0,greymask=true,mode="blend",pc_range=true)
return last.ColorYUV(off_y=0,gain_y=22)
}


function hhddrr01(clip a_stab,clip b_stabb)
{
b_stab=b_stabb

t=a_stab

ab=overlay( b_stab,t,x=0,y=0,mask=b_stab,opacity=0.4,greymask=true,mode="Multiply",pc_range=true)
abc=overlay( b_stab,t,x=0,y=0,mask=b_stab,opacity=1.0,greymask=true,mode="Difference",pc_range=true)
ass=overlay(ab,abc,x=0,y=0,mask=invert(ab),opacity=1.0,greymask=true,mode="Blend",pc_range=true)

ab1=overlay(t,ass,x=0,y=0,mask=t,opacity=0.15,greymask=true,mode="SoftLight",pc_range=true)

l=overlay(ass,ab1,x=0,y=0,mask=ass,opacity=1.0,greymask=true,mode="Blend",pc_range=true)
ll=overlay(ab1,ass,x=0,y=0,mask=ab1,opacity=1.0,greymask=true,mode="Darken",pc_range=true)
k=overlay(l,ll,x=0,y=0,mask=l,opacity=1.0,greymask=true,mode="Blend",pc_range=true)

return k
}


but the downsize - upsize method that msgohan did post have more details so it´s better to go with that :)

themaster1 01-25-2020 03:08 AM

Show us the results (before/after), a good deghosting script is always nice to have imo. In the past i've tried exorcist 'n stuff but wasn't satisfied.

jjdd 01-25-2020 06:31 AM

4 Attachment(s)
themaster1 ok here is a new Original_Test.avi clip and then GHOST_Removal_and_overlay_2_clips.avi and i put the avisynth scrip to that i did use

you can still see just little ghosting

i did add one more example clip it´s from the same movie


Code:

SetMemoryMax(512)
SetMTMode(2,4)

AVISource("D:\\Original_Test.avi",audio=false).AssumeTFF().ConvertToYV12()#.SeparateFields().Weave()
#########################################################################################################

a_stab=Spline36Resize(330,height).nnedi3_rpow2(rfactor=2,cshift="lanczosresize",fwidth=width,fheight=height)  # Clip 1 Original with light Ghost Removal
#b_stab=ConvertToYuy2().ColorYUV(gain_y=-170,cont_y=0).Ghostbuster(offset=3,strength=95).ConvertToYV12()
#b_stab=ColorYUV(gain_y=-120,cont_y=0).LGhost(1,2,15,2,2,115,4,2,-127)
#b_stab=ColorYUV(gain_y=-120,cont_y=0).LGhost(2,3,127,1,3,127)
b_stab=Spline36Resize(244,height).nnedi3_rpow2(rfactor=2,cshift="lanczosresize",fwidth=width,fheight=height)  # Clip 2 More aggressively Ghost Removal

#########################################################################################################

e=overlay(hhddrr01(a_stab,b_stab),hhddrro2(a_stab,b_stab),x=0,y=0,mask=hhddrr01(a_stab,b_stab),opacity=1.0,greymask=true,mode="Blend",pc_range=true)

return e.ColorYUV(off_y=-4,gain_y=-7)#.AssumeFieldBased().Weave()#.ConvertToRGB32().imagewriter(file="D:\movie\image%d.tiff",start=0,end=0,type="tiff")

#########################################################################################################

function hhddrro2(clip a_stab,clip b_stab)
{
t=a_stab
ab=overlay( b_stab,t,x=0,y=0,mask=b_stab,opacity=0.5,greymask=true,mode="Multiply",pc_range=true)

ab1=overlay(t,b_stab,x=0,y=0,mask=t,opacity=0.5,greymask=true,mode="hardlight",pc_range=true)
l=overlay(ab,ab1,x=0,y=0,mask=ab,opacity=1.0,greymask=true,mode="blend",pc_range=true)
last=overlay(l,t,x=0,y=0,mask=ab,opacity=1.0,greymask=true,mode="blend",pc_range=true)
return last.ColorYUV(off_y=0,gain_y=22)
}


function hhddrr01(clip a_stab,clip b_stabb)
{
b_stab=b_stabb

t=a_stab

ab=overlay( b_stab,t,x=0,y=0,mask=b_stab,opacity=0.4,greymask=true,mode="Multiply",pc_range=true)
abc=overlay( b_stab,t,x=0,y=0,mask=b_stab,opacity=1.0,greymask=true,mode="Difference",pc_range=true)
ass=overlay(ab,abc,x=0,y=0,mask=invert(ab),opacity=1.0,greymask=true,mode="Blend",pc_range=true)

ab1=overlay(t,ass,x=0,y=0,mask=t,opacity=0.15,greymask=true,mode="SoftLight",pc_range=true)

l=overlay(ass,ab1,x=0,y=0,mask=ass,opacity=1.0,greymask=true,mode="Blend",pc_range=true)
ll=overlay(ab1,ass,x=0,y=0,mask=ab1,opacity=1.0,greymask=true,mode="Darken",pc_range=true)
k=overlay(l,ll,x=0,y=0,mask=l,opacity=1.0,greymask=true,mode="Blend",pc_range=true)

return k
}


themaster1 01-25-2020 07:35 AM

You have forgotten an important detail at the beginning: ConvertToYV12(interlaced=true) otherwise it's considered progressive


All times are GMT -5. The time now is 09:39 PM

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.