VideoHelp Forum
+ Reply to Thread
Results 1 to 23 of 23
Thread
  1. Looking at restoring video to as close as possible to being artifact free and sharp.

    Here is the video clip -

    JR_JC.avi

    It appears that there is some ghosting(?), color smearing, and distortion particularly at the bottom of the clip.

    As I'm a beginner I really don't know which filters should be used (and in which appropriate order) to remove ghosting and color smear, and remove the distortion as far as possible.

    Detailed/sample script(s) would really be appreciated in order to do this video clip restoration.

    Thank you very much!
    Quote Quote  
  2. Is there a reason why it's deinterlaced ?

    Anyway you can try this (will require further tweaks like dehalo and so on)

    Code:
    LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\degrainmedian082\degrainmedian.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\RgTools-v1.1\x86\RgTools.dll")
    ##########
    LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\mvtools-2.7.44-with-depans20201214\x86\DePan.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\mvtools-2.7.44-with-depans20201214\x86\DePanEstimate.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\mvtools-2.7.44-with-depans20201214\x86\mvtools2.dll")
    LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\aWarpSharpMT\x86\Release_W7\aWarpsharpMT.dll")
    #####################################################
    ###############
    SetMemoryMax(900)
    SetMTMode(3,2)
    
    AVISource("JR_JC.avi")
    converttoyv16()
    A=Last
    B=A.Greyscale()
    Overlay(B,A,X=6,Y=0,Mode="Chroma") #
    input=last
    U = UToY().SpotLessUV() 
    V=VToY().SpotLessUV() 
    YToUV(U,V,last)
    
    ConverttoRGB32(matrix="rec601",interlaced=false)
    LoadVirtualDubPlugin("C:\Program Files (x86)\Virtualdub\plugins32\rgbeq.vdf", "rgbeq", 0)
    # 
    rgbeq("20G2020G2020G2G20G2020G2020G2020G1m20G2020G2020G2020G2020G2020G2020G2020G1x20G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2420G2020G2020G2020G2020G2020G2020G201uG1p20G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2820G2020G2020G2020G2020G2020G2020G2020G2F20G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2000H4H00G4100G4100G4100G4100G4100LLL00G4100G4100G4100H4H00G0J000W0")
    converttoyv12(matrix="rec601",interlaced=false)
    
    # CHROMA BLEEDING: 
    mergechroma(aWarpSharp(depth=10, thresh=0.75, blurlevel=3, cm=1))
    turnright()
    mergechroma(aWarpSharp(depth=5, thresh=0.75, blurlevel=2, cm=1))
    turnleft()
    
    ######################################
    a=last
    #clense(reduceflicker=false).merge(last,0.5).clense(reduceflicker=false)
    mot=removegrain(8,0).DepanEstimate(range=2)
    take2=a.depaninterleave(mot,prev=2,next=2,subpixel=2)
    clean1=take2.SpotLess().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,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).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
    
    
    
    ################ SHARPENING ###########
    #non edge sur X:
    #LimitedSharpenFaster(ss_x=1.4,ss_y=1.0,Smode=3,strength=100,soft=0,edgemode=2,wide=false) # FINAL
    # edge mode=1 sur Y:
    #LimitedSharpenFaster(ss_x=1.0,ss_y=2.0,Smode=3,strength=100,soft=0,edgemode=1,wide=false) # FINAL
    #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 (x86)\Virtualdub\plugins32\ccd_sse2.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)
    }
    Image Attached Thumbnails Click image for larger version

Name:	JR_JC-original-bien.jpg
Views:	31
Size:	114.3 KB
ID:	70797  

    Click image for larger version

Name:	JR_JC-themaster1.jpg
Views:	40
Size:	122.3 KB
ID:	70798  

    Last edited by themaster1; 6th May 2023 at 14:41.
    *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
    Quote Quote  
  3. What has happened to the reply by themaster1 ?

    I was about to copy script details and comment on themaster1 reply to my post!

    I notice the reply by themaster1 has been edited. Thank you very much for the very comprehensive script!! I'm still locating associated appropriate modules and scripts in order to get this script to work.

    The video is "as is". I didn't deinterlace intentionally.

    Any further comments on how to clean up this video clip?

    Thank you.
    Last edited by meeshu; 7th May 2023 at 20:51.
    Quote Quote  
  4. In my opinion, you are not getting rid of the garbage at the bottom unless you crop it off, or recapture the video from tape again in better quality. You cant just magically erase all that black and white static and get picture back that's been destroyed.

    I don't see any ghosting in the sample.

    Maybe its just a bad sample that's way too short, but I literally don't see anything you can improve except maybe sharpness with a sharpener and chroma sharpening.

    mergechroma(awarpsharp2(depth=3, blur=1, type=1))
    ChromaShiftSP(x=-1.00, y=0.00)
    LimitedSharpenFaster(ss_x=1.00, ss_y=1.00, strength=5, overshoot=0, undershoot=0, soft=0, edgemode=0)
    Last edited by killerteengohan; 6th May 2023 at 17:38.
    Quote Quote  
  5. This is a YouTube video (this is queued up to match the OP's clip):

    https://www.youtube.com/watch?v=MBJ_Ag86g-A&t=380s

    Thus, the OP cannot recapture the tape.

    The only options are to mask off the noise or find a better source.
    Quote Quote  
  6. SpotLess with a temporal radius of 3 helps with some of the noise&blocking, see: https://imgsli.com/MTc2NTM3
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  7. Dirty trick!
    Image Attached Files
    Quote Quote  
  8. So, since the camera was locked down and she didn't move her lower body, did you just copy a clean frame and merge the lower part into the bad video?
    Quote Quote  
  9. Dirty trick indeed!
    Quote Quote  
  10. Originally Posted by jagabo View Post
    Dirty trick!
    That was genius level work there man.
    Quote Quote  
  11. The available clip is 360p but the YouTube video is available as 480p. At the very least he should redownload it to get the max resolution available.
    Quote Quote  
  12. Originally Posted by killerteengohan View Post
    In my opinion, you are not getting rid of the garbage at the bottom unless you crop it off, or recapture the video from tape again in better quality. You cant just magically erase all that black and white static and get picture back that's been destroyed.

    I don't see any ghosting in the sample.

    Maybe its just a bad sample that's way too short, but I literally don't see anything you can improve except maybe sharpness with a sharpener and chroma sharpening.

    mergechroma(awarpsharp2(depth=3, blur=1, type=1))
    ChromaShiftSP(x=-1.00, y=0.00)
    LimitedSharpenFaster(ss_x=1.00, ss_y=1.00, strength=5, overshoot=0, undershoot=0, soft=0, edgemode=0)
    Yes. I'm aware that some data will be lost forever owing to the presence of lines of distortion which effectively overwrite the original data.

    Thanks for the script also.
    Quote Quote  
  13. Originally Posted by johnmeyer View Post
    . .
    The only options are to mask off the noise or find a better source.
    Comment noted, thanks.
    Quote Quote  
  14. Originally Posted by Selur View Post
    SpotLess with a temporal radius of 3 helps with some of the noise&blocking, see: https://imgsli.com/MTc2NTM3
    Thanks for that.

    I was experimenting with "Spotless" also about the same time as your post.
    Quote Quote  
  15. Originally Posted by jagabo View Post
    Dirty trick!
    Interesting! I do note that a portion of the bottom of the clip appeared to be cropped off. Cropping is not really an option as I prefer to retain as much of the image as possible, even though part of the image may be distorted.
    Quote Quote  
  16. I could have left the line switching noise there. I decided it didn't really contain any easily recoverable picture so I cropped it.
    Last edited by jagabo; 7th May 2023 at 21:11.
    Quote Quote  
  17. Originally Posted by manono View Post
    The available clip is 360p but the YouTube video is available as 480p. At the very least he should redownload it to get the max resolution available.
    Hmmm! I must have missed the 480 version!?
    Quote Quote  
  18. I'm having difficulty in locating the module/script for the function SpotLessUV. Anyone know where to get this, please?
    Quote Quote  
  19. Thank you!

    Now I can't seem to find the VirtualDub (32 bit) plugin rgbeq.vdf.
    Anyone know where to get this plugin?

    Thanks.
    Quote Quote  
  20. Originally Posted by meeshu View Post
    Thank you!

    Now I can't seem to find the VirtualDub (32 bit) plugin rgbeq.vdf.
    Anyone know where to get this plugin?

    Thanks.
    Here
    Image Attached Files
    *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
    Quote Quote  
  21. Thank you very much!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!