VideoHelp Forum




+ Reply to Thread
Results 1 to 22 of 22
  1. I've finally got through my own families home movies, and am doing my elderly uncle a favor by transferring his tapes to DVD as well. But on most of his tapes I'm finding these horizontal lines (see picture) popping up all the time. I've tried this tape in my JVC HR-40000, and both my Pani AG-1980's, hand cleaned all heads/rollers/capstans in all VCR's with 99% Alc and chamois, and I'm still getting these lines popping up randomly throughout the tape. I'm assuming the tape is just damaged, so is there any filter or script out there to blend them, or even just darken them maybe?

    Click image for larger version

Name:	2.png
Views:	721
Size:	691.6 KB
ID:	13493
    Quote Quote  
  2. Are the lines are truly random - or are they reproducable in the exact same spot (not random) on other the other machines? What I'm asking is would this frame look exactly the same on the other machines, with the line in the exact same spot?

    What is the distribution and timing? If they are transient , and only occur in 1 field then there are scripts that can help fix it. If they "linger" for more than 1 field in the exact same spot , then any "automatic" script will usually fail to detect the defect
    Quote Quote  
  3. Is it difficult to send a sample ?
    Possible solutions are the YUP's scripts or if you want to interpolate i like the Dvdropout script

    See Also devcr: http://avisynth.org/mediawiki/DeVCR
    *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
    Quote Quote  
  4. @poisondeathray Going to take some samples from each machine and see if they are random right now

    @I'll upload some
    Quote Quote  
  5. Still shot from each of the 3 Machines
    Click image for larger version

Name:	stripes.png
Views:	620
Size:	718.2 KB
ID:	13503

    Video sample (highly compressed)
    https://www.youtube.com/watch?v=CC1FaNP9iUQ
    Image Attached Thumbnails Click image for larger version

Name:	stripes.png
Views:	481
Size:	1.28 MB
ID:	13502  

    Quote Quote  
  6. DeVCR script looks like exactly what I'm looking for me thinks Man you guys are good
    Quote Quote  
  7. Crap, I'm having trouble getting DeVCR to work. Getting a GeneralConvolution requires RGBA input error, but as far as I can see, the script is calling for a ConverTToRGB to my clip already. Anyone have experience with this script? Am I missing a plugin?
    Quote Quote  
  8. post your full script and full error message
    Quote Quote  
  9. Try using ConvertToRGB32() explicitly.
    Last edited by jagabo; 16th Aug 2012 at 10:22.
    Quote Quote  
  10. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Originally Posted by chewybacca View Post
    Crap, I'm having trouble getting DeVCR to work. Getting a GeneralConvolution requires RGBA input error, but as far as I can see, the script is calling for a ConverTToRGB to my clip already. Anyone have experience with this script? Am I missing a plugin?
    I use it all the time in YV12, no problems. I note your image in post #1 is 694x476. Is this the frame size of the original video? I believe YUV to RGB requires mod-16 frame size (? ?).
    Often I use deVCR along with RemoveSpots(), together they usually clean up pretty well. But sometimes not, if the rip extends over multiple consecutive frames. In that case, you have to try other tricks.
    Last edited by sanlyn; 23rd Mar 2014 at 06:12.
    Quote Quote  
  11. Originally Posted by poisondeathray View Post
    post your full script and full error message
    Error is
    "AVISynth Open Failure:
    GeneralConvulation requires RGBA input
    (E:\temp\devcr.avs, line3)
    (E:\temp\devcr.avs, line14)
    (E:\temp\devcr.avs, line20)


    Code:
    function DetectVCRLines(clip c,int threshold)
    {
      spacial_data = GeneralConvolution(ConvertToRGB(c),0,"0 -1 0 0 2 0 0 -1 0")
      bar_data = ConvertToRGB(BilinearResize(spacial_data,16,c.height))
      st_data = Overlay(bar_data,Trim(bar_data,1,0),mode = "subtract")
      st_data2 = Greyscale(Levels(st_data,threshold,10.0,threshold+1,0,255,coring = false))
      st_data3 = Greyscale(Levels(st_data2,127,10.0,128,0,255,coring = false))
      st_data4 = Overlay(st_data3,st_data3,y = -1, mode = "add")
      return PointResize(st_data4,c.width,c.height)
    }
    
    function deVCR(clip c,int threshold)
    {
      mybars = DetectVCRLines(c,threshold)
      return Overlay(c,Trim(c,1,0), mask = mybars,greymask = true)  
    }
    
    myclip = AviSource("E:\temp\stripes.avi")
    fixedclip = deVCR(myclip,30)
    StackHorizontal(myclip,fixedclip,Overlay(myclip,fixedclip,mode = "subtract"))
    I've also tried...
    Code:
    function DetectVCRLines(clip c,int threshold)
    {
      spacial_data = GeneralConvolution(ConvertToRGB(c),0,"0 -1 0 0 2 0 0 -1 0")
      bar_data = ConvertToRGB(BilinearResize(spacial_data,16,c.height))
      st_data = Overlay(bar_data,Trim(bar_data,1,0),mode = "subtract")
      st_data2 = Greyscale(Levels(st_data,threshold,10.0,threshold+1,0,255,coring = false))
      st_data3 = Greyscale(Levels(st_data2,127,10.0,128,0,255,coring = false))
      st_data4 = Overlay(st_data3,st_data3,y = -1, mode = "add")
      return PointResize(st_data4,c.width,c.height)
    }
    
    function deVCR(clip c,int threshold)
    {
      mybars = DetectVCRLines(c,threshold)
      return Overlay(c,Trim(c,1,0), mask = mybars,greymask = true)  
    }
    
    myclip = AviSource("E:\temp\stripes.avi")
    mycliprgb = ConvertToRGB(myclip)
    fixedclip = deVCR(mycliprgb,30)
    StackHorizontal(mycliprgb,fixedclip,Overlay(mycliprgb,fixedclip,mode = "subtract"))
    Originally Posted by sanlyn View Post
    I note your image in post #1 is 694x476. Is this the frame size of the original video? I believe YUV to RGB requires mod-16 frame size (? ?).
    Often I use deVCR along with RemoveSpots(), together they usually clean up pretty well. But sometimes not, if the rip extends over multiple consecutive frames. In that case, you have to try other tricks.
    --The clip I'm playing with is 720x480, 29.97 FPS, the image has an oddball dimension because I did a quick crop from a screen capture


    P.S. I should probably mention I'm using Win7 64-Bit, but I haven't had issues with AVIsynth yet :/
    Last edited by chewybacca; 16th Aug 2012 at 20:16.
    Quote Quote  
  12. Your first script worked fine here. But I can duplicate your error by changing the source to RGB24 in your second clip. My guess is your video is coming out of AviSource() as RGB 24*. So explicitly use ConvertToRGB32() to be sure it's RGB32 not RGB24.

    * You can verify this with Info().
    Quote Quote  
  13. Originally Posted by jagabo View Post
    Try using ConvertToRGB32() explicitly.
    This did seem to let me load the clip with VirtualDub, but the script doesn't seem to actually do anything.

    edit: Also set threshold to '0', still nothing.
    Last edited by chewybacca; 16th Aug 2012 at 20:41.
    Quote Quote  
  14. I've never used the deVCR() filter so I can only suggest you play around with the threshold value -- the "30" in the deVCR() command. Ie, try higher and lower values.

    If you upload a sample of your source someone will probably play around with it.
    Quote Quote  
  15. Ok, I've tried 0,15,30, 100, and 255 on threshold, so I must be doing something wrong lol.

    If anyone wants to play with my clip, I uploaded it..
    It's Huffy multi threaded compression as name suggests and about 66MB

    www.bezalu.com/dropbox/stripes_huffymt.avi

    If you have trouble downloading it, I also zipped it..

    www.bezalu.com/dropbox/stripes_huffymt.zip

    Here is the script I'm trying to use.
    Code:
    function DetectVCRLines(clip c,int threshold)
    {
      spacial_data = GeneralConvolution(ConvertToRGB(c),0,"0 -1 0 0 2 0 0 -1 0")
      bar_data = ConvertToRGB(BilinearResize(spacial_data,16,c.height))
      st_data = Overlay(bar_data,Trim(bar_data,1,0),mode = "subtract")
      st_data2 = Greyscale(Levels(st_data,threshold,10.0,threshold+1,0,255,coring = false))
      st_data3 = Greyscale(Levels(st_data2,127,10.0,128,0,255,coring = false))
      st_data4 = Overlay(st_data3,st_data3,y = -1, mode = "add")
      return PointResize(st_data4,c.width,c.height)
    }
    
    function deVCR(clip c,int threshold)
    {
      mybars = DetectVCRLines(c,threshold)
      return Overlay(c,Trim(c,1,0), mask = mybars,greymask = true)  
    }
    
    myclip = AviSource("E:\temp\stripes_huffymt.avi")
    myclip = ConvertToRGB32(myclip)
    fixedclip = deVCR(myclip,0)
    StackHorizontal(myclip,fixedclip,Overlay(myclip,fixedclip,mode = "subtract"))
    I dont think my clip is stacking on itself as it should, just seems to add another version of it next to it

    EDIT::: After consuming some wine, my noob ass figured out his script is set up to show the 3 versions next to eachother, and since I didnt maximize VirtualDub, I didn't realize this till now lol. Now to do my homework on stackhorizontal and overlay to just get the "fixed" output

    EDIT AGAIN::: more wine and more discovery, playing around with poisondeathrays post of a script using remotedirt and remotedust, realizing how noob I really am hahaha
    Last edited by chewybacca; 16th Aug 2012 at 22:22. Reason: I'm a dummy
    Quote Quote  
  16. Yes, it's working here, though not perfectly:

    Click image for larger version

Name:	devcr.jpg
Views:	325
Size:	117.4 KB
ID:	13522

    It's also screwing up the interlacing though.
    Quote Quote  
  17. Yea i noticed it jacks it up too, is there a way to do some type of unfold/fold to deinterlace and reinterlace with scripts like in virtualdub? Or would that not help the situation
    Quote Quote  
  18. I don't use deVCR , but it looks like it would be too damaging to the interlacing. You might need to apply it to separated fields then weave it

    Many of the defects will be picked up in your video with simple filters like removedirtmc - but a few "linger" over a few even and odd fields - that's the problem I mentioned earlier. Most scripts will look at differences between frames, if a defect is persistent, the algorithm won't be able to distinguish that defect from a "wanted" detail

    You would need to use heavier scripts if you want to them catch "automatically" . The problem is the stronger the settings, and the more filters you stack, the softer the picture becomes, and when you begin to counter sharpen , it starts to look "plasticky"

    You can try the script in post #4 and adjust the settings - it does picks up most the defects, but the fine details like hair detail are erroded as well. You can adjust the settings (you wouldn't use the frame interpolation part, and you would probably use much lower removedirtmc settings for the 2nd part) - I'll post the modified script below, of course adjust it to your tastes
    https://forum.videohelp.com/threads/343296-Transfer-of-real-bad-tape-to-pc-and-restore

    Sample clip is attached below I didn't address the other issues like colors, green borders, but 1 thing at a time. You can probably "fix" the green borders with a colored overlay if it's persistently green

    man that looks like some good cake




    Code:
    AVISource()
    ConvertToYV12(interlaced=true) 
    
    AssumeTFF()
    SeparateFields() 
    a=last
    
    clense(reduceflicker=false).merge(last,0.5).clense(reduceflicker=false)
    mot=removegrain(11,0).removegrain(20,0).DepanEstimate(range=2)
    take2=a.depaninterleave(mot,prev=2,next=2,subpixel=2)
    clean1=take2.TMedian2().selectevery(5,2)
    
    sup1 = clean1.minblur(1).removegrain(11,0).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)
    #bv23=sup1.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
    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)
    #fv23=sup1.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
    
    #a.mdegrain3(sup2,bv21,fv21,bv22,fv22,bv23,fv23,thSAD=499) # << this is the "2-fold" variant
    
    interleave(a.mcompensate(sup2,fv22),a.mcompensate(sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensate(sup2,bv22))
    TMedian2().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.mdegrain3(sup3,bv31,fv31,bv32,fv32,bv33,fv33,thSAD=499)
    Interleave() 
    Weave()
    
    
    ####2nd filtering to catch remaining defects
    
    AssumeTFF()
    SeparateFields() 
    f1=SelectEven().RemoveDirtMC(50,false).LSFMod(strength=50)
    f2=SelectOdd().RemoveDirtMC(50,false).LSFMod(strength=50)
    Interleave(f1,f2) 
    Weave()
    
    
    
    
    #--------------------------------------------------------------
    # Helper functions
    
    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
    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)
    }
    
    function RemoveDirtMC(clip,int limit, bool "_grey")
    {
      _grey=default(_grey, false)
      limit = default(limit,6)
      i=MSuper(clip,pel=2)
      bvec = MAnalyse(i,isb=false, blksize=8, delta=1, truemotion=true)
      fvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true)
      backw = MFlow(clip,i,bvec)
      forw  = MFlow(clip,i,fvec)
      clp=interleave(backw,clip,forw)
      clp=clp.RemoveDirt(limit,_grey)
      clp=clp.SelectEvery(3,1)
      return clp
    }
    Image Attached Files
    Last edited by poisondeathray; 17th Aug 2012 at 12:04.
    Quote Quote  
  19. Originally Posted by chewybacca View Post
    Yea i noticed it jacks it up too, is there a way to do some type of unfold/fold to deinterlace and reinterlace with scripts like in virtualdub? Or would that not help the situation
    Something like this:

    Code:
    AviSource("stripes.avi").ConvertToYUY2(interlaced=true)
    SeparateFields()
    deVCR(30)
    Weave()
    Even better:

    Code:
    AviSource("stripes.avi").ConvertToYUY2(interlaced=true)
    SeparateFields()
    evn=SelectEven().deVCR(30)
    odd=SelectOdd().deVCR(30)
    Interleave(evn,odd)
    Weave()
    And since deVCR() is leaving a lot of dark lines:
    Code:
    AviSource("stripes.avi").ConvertToYUY2(interlaced=true)
    SeparateFields()
    evn=SelectEven().deVCR(30).Invert().DeVCR(30).Invert()
    odd=SelectOdd().deVCR(30).Invert().DeVCR(30).Invert()
    Interleave(evn,odd)
    Weave()
    I'd play around with the threshold value a bit too. With the fields separated it using lower values won't screw up the interlacing.

    Note that this code is a little sloppy because your source is TFF but it's treated as BFF (the defualt in AviSynth). But it doesn't really matter in this case.
    Last edited by jagabo; 17th Aug 2012 at 07:35.
    Quote Quote  
  20. Thanks so much Poison and Jaga, can't wait to get some time today to play with this.

    That clip is AMAZING, can't even see any trace at least with my untrained eye
    Trying your script on a clip I have poison and it's saving at about 1.02 FPS so I'll check on it after work lol
    Quote Quote  
  21. I forgot to add ConvertToYV12(interlaced=true) after AVISource() , as your clip was RGB (I just edited the post above)

    Yes it's slow. I usually break up slow scripts into stages. This way you can tweak the different filters without having to re-do the entire thing (kind of like photoshop where you have a history)

    Note - If you go frame by frame , it still misses a few defects (they aren't completely removed, just partially in some frames/fields) - and the reason is those defects were "persistent". They linger in roughly the same spot. You can crank up the settings and stack more filters, but I feel that damages the details too much. You could also experiment with some of the scripts that "Yup" on doom9 wrote as suggested earlier

    If you were very picky, you would actually use masks in a compositing application (so only those lines are removed, you basically "circle" the areas manaully), but this can be quite tedious, but it's essentially a "perfect" repair





    Top and left Green borders: One approach is to basically "cover up" those areas with a less green, color denoised overlay. Let's say we start with a filtered video (with the script or a similar one from above). You can probably do a much better job matching the left side, but it's just the general approach that I'm trying to show


    Code:
    AVISource("prefiltedvideo.avi")
    filtered1=last
    
    
    #this crops so only the top 16 pixels are left
    filtered1
    crop(0,0,0,-464,true)
    coloryuv(off_v=5)
    smoothuv(6)
    top=last
    
    
    #this is for the left side
    filtered1
    crop(0,0,-690,0,true)
    coloryuv(off_v=1)
    smoothuv(5)
    left=last
    
    overlay(filtered1, top)
    b=last
    
    overlay(b, left)
    If you look closely, this screenshot also demonstrates the "damage" caused by the "automatic" filters. Look at the fine details in the hair and cake are removed . The only way to get around this is to use masks to do more selective filtering
    Image Attached Thumbnails Click image for larger version

Name:	76_original.png
Views:	518
Size:	500.7 KB
ID:	13528  

    Click image for larger version

Name:	76_colored_overlay.png
Views:	465
Size:	415.2 KB
ID:	13529  

    Quote Quote  
  22. Yea it bitc#ed at me about the YV12 so I figured to throw in the convert at the beginning. The script did an amazing job of removing 99% of those lines, which is a complete success in my book! I see what you mean by the loss of detail though. If I had more time I'd love to do this for him using selected areas, but I estimate there's over 72,000 instances of this random line noise in this 2 hour video, multiply that by 12 tapes, and having a temporarly disabled wife and two kids under 5 years old... I think I'll stick with tweaking the auto filters lol.

    I'll play with the color overlays tonight when I get a chance, I'm blown away by the power of avisynth. What a cool piece of free code. Totally getting hooked on learning about it thanks so much. I wasn't going to get too picky, but now that you have shown me what can be done, I think I'm about to redo my own tapes lol
    Quote Quote  



Similar Threads

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