VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 53
Thread
  1. Hi everyone,

    Today I'd like to talk about Glitch or with my words, "bad lines".
    How can I remove them ?

    But first, I will show you 2 kind of glitch : black&white + colors
    It appears on 3/4 frames. But like a blink at normal speed.

    Thank you
    Image Attached Thumbnails Click image for larger version

Name:	glitch1.png
Views:	314
Size:	795.5 KB
ID:	45075  

    Click image for larger version

Name:	glitch2.png
Views:	344
Size:	1.03 MB
ID:	45076  

    Last edited by TONYFRANCE; 2nd Apr 2018 at 00:58.
    Quote Quote  
  2. A video sample of each film
    Image Attached Files
    Quote Quote  
  3. You can interpolate over the "bad" frames using data from the adjacent "good" frames . e.g using avisynth/mvtools2. This method replaces the entire bad frames, but you can combine with more selective masks to repair parts of frames. Unfortunately, this approach means manual identification of frame numbers - so some work involved

    So in the 1st example, RX(13,3) means frames 13,14,15 are replaced
    Code:
    AVISource("glitch1video.avi")
    RX(13,3)
    
    function RX(clip Source, int N, int X)
    {
    # N is number of the 1st frame in Source that needs replacing.
    # X is total number of frames to replace
    #e.g. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps interpolation
    
    start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point
    end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point
    
    start+end
    AssumeFPS(1) #temporarily FPS=1 to use mflowfps
    
    super = MSuper()
    backward_vec = MAnalyse(super, isb = true)
    forward_vec = MAnalyse(super, isb = false)
    MFlowFps(super, backward_vec, forward_vec, blend=false, num=X+1, den=1) #num=X+1
    AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining
    Trim(1, framecount-1) #trim ends, leaving replacement frames
    
    Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0)
    }
    2nd video
    Code:
    AVISource("glitch2video.avi")
    RX(12,3)



    Other methods include a more precise repair in after effects / photoshop

    The problem here is selectivity - you want to repair the defect without damaging other parts
    Image Attached Files
    • File Type: avi 1.avi (4.13 MB, 92 views)
    • File Type: avi 2.avi (4.13 MB, 60 views)
    Quote Quote  
  4. Originally Posted by poisondeathray View Post
    Unfortunately, this approach means manual identification of frame numbers
    Manual ? It happens during all the film...
    There is no automatic detection ? Or should I use the same kind of software that people use for 35mm film (to remove dirt) ?

    https://www.youtube.com/watch?v=VYUeKK9Vhns
    Quote Quote  
  5. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    I forget the name of the avisynth filter that can take multiple VHS captures (you have to capture the tape multiple times) and then averages them into a single averaged copy to try and suppress noise and errors. But if this error happens in the exact same place every time then it can't average it out. Also don't want to be capturing this in DV but maybe lossless YUY2.
    Quote Quote  
  6. Originally Posted by KarMa View Post
    I forget the name of the avisynth filter...
    That would be the Median Filter.

    And, as mentioned, it's necessary that the same artifacts not appear on all copies in the same places.
    Quote Quote  
  7. Originally Posted by TONYFRANCE View Post
    Originally Posted by poisondeathray View Post
    Unfortunately, this approach means manual identification of frame numbers
    Manual ? It happens during all the film...
    There is no automatic detection ? Or should I use the same kind of software that people use for 35mm film (to remove dirt) ?

    https://www.youtube.com/watch?v=VYUeKK9Vhns
    The nature of the defect is different than "dirt. " . This is not characterized as "dirt"

    The duration is 3-4 frames, and the location "lingers" over the same area in the duration (dirt is usually only 1 frame, the location changes) .

    But "dirt" can usually be removed "automatically" in avisynth too. The effectiveness is actually quite close to professional restoration software in "automatic" mode.

    Professional restoration approaches like pfclean use semi manual repairs too for lingering defects that occur over multiple consecutive frames in the same location. In fact, there is more manual work and masking, but it's meant for a more targeted repair. The quality of the repair is higher because you're spending more time on it manually


    The problem here, again, is selectivity. You don't want to damage the other frames, or even parts of the same frame. An "automatic" filter strong enough to eliminate that defect would seriously degrade the other parts
    Quote Quote  
  8. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Try converting the tape again and use a DVD recorder to condition the line timing. It may help.
    Quote Quote  
  9. You can sometimes use tricks to remove defects that appear for a few, but more than one, frame. For spots that appear over two consecutive frames:

    Code:
    even = SelectEven().RemoveDirtMC(20)
    odd = SelectOdd().RemoveDirtMC(20)
    Interleave(even, odd)
    over four consecutive frames:

    Code:
    even = SelectEven()
    ee = even.SelectEven().RemoveDirtMC(20)
    eo = even.SelectOdd().RemoveDirtMC(20)
    even = Interleave(ee, eo)
    
    odd = SelectOdd()
    oe = odd.SelectEven().RemoveDirtMC(20)
    oo = odd.SelectOdd().RemoveDirtMC(20)
    odd = Interleave(oe, oo)
    
    Interleave(even, odd)
    This worked fairly well with the first of the two videos:

    Code:
    AviSource("glitch1video.avi") 
    
    SeparateFields()
    
    even = SelectEven()
    ee = even.SelectEven().RemoveDirtMC(30)
    eo = even.SelectOdd().RemoveDirtMC(30)
    even = Interleave(ee, eo)
    
    odd = SelectOdd()
    oe = odd.SelectEven().RemoveDirtMC(30)
    oo = odd.SelectOdd().RemoveDirtMC(30)
    odd = INterleave(oe, oo)
    
    Interleave(even, odd)
    RemoveDirtMC(30)
    Weave()
    before/after:
    Click image for larger version

Name:	both.jpg
Views:	286
Size:	58.1 KB
ID:	45083

    You have to be careful when using "dirt" removal filters like this. Sometimes real picture elements appear on single frames and they will disappear. Things like footballs in motion, panning star fields, etc.
    Last edited by jagabo; 2nd Apr 2018 at 09:47.
    Quote Quote  
  10. Stupid question : I downloaded "Film_Restoring_vs_06_2012"
    But I don't know what to do to avoid the virtualdub message : There is no function named "RemoveDirtMC"
    Quote Quote  
  11. Download RemoveDirtMC.avs and import it into your script.

    Code:
    import("C:\Program Files (x86)\AviSynth\plugins\RemoveDirtMC.avs")
    Fix the path if it's somewhere else on your computer. You may also need some of the third party filters it depends on.
    Quote Quote  
  12. Where can I find this filter ?
    Here ? https://pastebin.com/PgkQc9X4

    Then, I need to cut/paste into an .avs file ?
    Quote Quote  
  13. The one I'm currently using looks like:

    Code:
    #REMOVE DIRT FUNCTION
    #.................................................   ..................................................   ..................................................  .................
    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)
    }
    
    function RemoveDirtMC(clip clip,int limit, bool "_grey")
    {
      _grey=default(_grey, false)
      limit = default(limit,6)
      i=MSuper(clip,pel=2)
      bvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true)
      fvec = MAnalyse(i,isb=false, 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
    }
    
    function RemoveSpots(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 corrected
    }
    Quote Quote  
  14. I want to know if I'm stupid
    Image Attached Thumbnails Click image for larger version

Name:	folder1.png
Views:	243
Size:	72.7 KB
ID:	45085  

    Click image for larger version

Name:	virtualdub1.png
Views:	64
Size:	16.1 KB
ID:	45086  

    Quote Quote  
  15. You can put the import line anywhere, but I like to import stuff at the start of the script:

    Code:
    import("C:\Program Files (x86)\AviSynth\plugins\RemoveDirtMC.avs")  # change path if necessary
    
    AviSource("glitch1video.avi") 
    
    even = SelectEven().RemoveDirtMC(20)
    odd = SelectOdd().RemoveDirtMC(20)
    Interleave(even, odd)
    Or you can include all the text of RemoveDirtMC within your script rather than importing it. You can use that script to verify you have RemoveDirtMC working but your video is interlaced and that script will screw it up. And the lines in your video last more than two frames so they will not be removed. Use the third script I posted once you have RemoveDirtMC working.
    Quote Quote  
  16. Same problem, different message.
    Image Attached Thumbnails Click image for larger version

Name:	virtualdub2.png
Views:	76
Size:	17.2 KB
ID:	45087  

    Quote Quote  
  17. MSuper is part of mvtools2 . So either put mvtools2.dll in the plugins folder to autoload; or load it manually with LoadPlugin("PATH\mvtools2.dll") in the script
    Quote Quote  
  18. Code:
    import("D:\Nouveau dossier (2)\Nouveau dossier\RemoveDirtMC.avs")
    LoadPlugin("C:\Users\JEAN\Desktop\mvtools-v2.5.11.22\mvtools2.dll")
    LoadPlugin("C:\Users\JEAN\Desktop\RgTools-x86\RgTools.dll")
    
    AviSource("glitch1video.avi")
    
    even = SelectEven().RemoveDirtMC(20)
    odd = SelectOdd().RemoveDirtMC(20)
    Interleave(even, odd)
    New virtualdub problem : Clense works only with planar colorspace....
    Quote Quote  
  19. You can add ConvertToYV12() right after AVISource(), but Pal DV (4:2:0) should be planar already. This probably means problem with your VFW system installed decoder

    When you open the AVI video natively in vdub, what does file=>file information say ?
    Quote Quote  
  20. Code:
    Video:
    Frame size, fps (µs per frame): 720x576, 25.000 fps (40000 µs)
    Length: 30 frames (0:01.20)
    Decompressor: MainConcept DV Codec 2.0.4 (dvsd)
    Number of key frames: 30
    Min/avg/max/total key frame size: 144000/144000/144000 (4219K)
    Min/avg/max/total delta size: (no delta frames)
    Data rate: 28800 kbps (0.02% overhead)
    
    Audio:
    Sampling rate: 
    Channels: 
    Sample precision: 
    Compression: 
    Layout: 
    Length: 
    Min/avg/max/total frame size: 
    Data rate:
    Quote Quote  
  21. It's probably converting to RGB . (not ideal)

    You can check with AVISource("glitch1video.avi").Info() to see what it's returning

    By default, AVISource() uses the system installed VFW decoder. I think mainconcept can be configured to return 4:2:0 in the configuration. I don't have it installed right now but I recall there were some options.

    Or uninstall it and use another decoder like cedocida
    Quote Quote  
  22. Now it works. With this code :

    Code:
    import("D:\Nouveau dossier (2)\Nouveau dossier\RemoveDirtMC.avs")
    LoadPlugin("C:\Users\JEAN\Desktop\mvtools-v2.5.11.22\mvtools2.dll")
    LoadPlugin("C:\Users\JEAN\Desktop\RgTools-0.96\x86\RgTools.dll")
    LoadPlugin("C:\Users\JEAN\Desktop\RemoveDirt\RemoveDirt.dll")
    
    AviSource("glitch1video.avi")
    ConvertToYV12()
    
    SeparateFields()
    
    even = SelectEven()
    ee = even.SelectEven().RemoveDirtMC(30)
    eo = even.SelectOdd().RemoveDirtMC(30)
    even = Interleave(ee, eo)
    
    odd = SelectOdd()
    oe = odd.SelectEven().RemoveDirtMC(30)
    oo = odd.SelectOdd().RemoveDirtMC(30)
    odd = INterleave(oe, oo)
    
    Interleave(even, odd)
    RemoveDirtMC(30)
    Weave()
    Quote Quote  
  23. It's not ideal if it's returning RGB (clipping data , superbright/dark clipping) . Not only is the quality worse, it's slower with unnecessary conversions .

    Or you can use another source filter like ffms2 . But it requires indexing (slower, clutter) , but it will return the native original colorspace, even for NTSC DV (4:1:1) .
    Quote Quote  
  24. Instead of

    Code:
    AviSource("glitch1video.avi")
    ConvertToYV12(interlaced=true)
    try just:

    Code:
    AviSource("glitch1video.avi", pixel_type="YV12")
    Also, although it's interlaced both fields appear to be the same, aside from some distortion. How did that happen? Is the entire video like this?
    Last edited by jagabo; 2nd Apr 2018 at 16:42.
    Quote Quote  
  25. Originally Posted by jagabo View Post
    try just:

    Code:
    AviSource("glitch1video.avi", pixel_type="YV12")
    Also, although it's interlaced both fields appear to be the same, aside from some distortion. How did that happen?
    AVISource: the video decompressor couldn't produce YV12 output
    Quote Quote  
  26. Originally Posted by TONYFRANCE View Post
    Originally Posted by jagabo View Post
    try just:

    Code:
    AviSource("glitch1video.avi", pixel_type="YV12")
    Also, although it's interlaced both fields appear to be the same, aside from some distortion. How did that happen?
    AVISource: the video decompressor couldn't produce YV12 output
    Ok, so your DV decoder can't supply YV12, you'll have to use ConvertToYV12(interlaced=true).

    What about the duplicate fields problem? Is the file you uploaded exactly what was captured?
    Quote Quote  
  27. The filter works good but as said before, if I need to do it scene by scene, it's too much work.

    glitch1video.avi and glitch2video.avi are the original files that was captured with my ADVC110.
    Even the bitrate is untouched.
    Quote Quote  
  28. Comparison before/after
    Image Attached Thumbnails Click image for larger version

Name:	glitchbef.png
Views:	154
Size:	841.7 KB
ID:	45091  

    Click image for larger version

Name:	glitchaft.png
Views:	122
Size:	703.3 KB
ID:	45092  

    Quote Quote  
  29. If these videos are very important to you consider getting an old Panasonic ES10 or ES15 DVD recorder to use as passthrough to clean up the time base. It may fix a lot of these problems as well as reducing the horizontal jitter on the rest of the frame.
    Quote Quote  
  30. These films are not the first priority of my life. Just want to discover and learn, for future... and also, I'm maybe a little bit crazy yeah
    Want to do the best I can do when I work.

    I bought my JVC in 2016, sealed. I'm sure it's not a problem from the vcr, dirty heads or else.

    And I also heard that sometimes, watching your tape in a simple 2 heads vcr is enough.
    Watch the same tape in a high model can provoke issues.
    Is that true ?
    Quote Quote  



Similar Threads

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