VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Hello everyone.
    I have an issue:
    I have a very messy file outputed by a garbage quality vhs.
    It has duplicate FIELDS in different nearby frames in random positions.

    For instance if a couple of letters is a frame and each letter is a field I can find something like that:
    AB AC DE FG HI JK LM LN OP QR QS TU VW XW YZ

    There is no pattern, they are errors. The duplicate fields are always 1 frame distant on the same field (top or bottom).
    So if I separate the fields the result is two video with subsequent duplicates frames sometimes.

    To correct this behavior I thought that it would be needed something like
    MultiDecimate each field but instead of removing the second duplicate, I would like to replace with a black frame, then I deinterlace the video, I remove the black frames and then I reinterlace again the video with the correct video order.
    But I can't find a method to do this.

    Can you help me to achieve this? Even if in another way?
    Thank you!
    Quote Quote  
  2. Having a sample to work with would make this easier. Replacing duplicate frames (fields) with black frames (fields) may not be hard but I'm not sure it's the right approach. Use the runtime ConditionalFilter() along with YDifferenceFromPrevious() or a testclip that's a subtraction of the current frame and the last frame. Noise and time base errors in VHS may make this much more difficult.

    Code:
    WhateverSource()
    AssumeTFF() # or BFF
    
    SeparateFields()
    evn = SelectEven()
    odd = SelectOdd()
    
    black = evn.ColorYUV(off_y=-256, cont_u=-256, cont_v=-256).ColorYUV(off_y=16)
    
    evn = ConditionalFilter(evn, evn, black, "YDifferenceFromPrevious()", "greaterthan", "2")
    odd = ConditionalFilter(odd, odd, black, "YDifferenceFromPrevious()", "greaterthan", "2")
    
    Interleave(evn,odd)
    Weave()
    Last edited by jagabo; 30th Jan 2018 at 07:01.
    Quote Quote  
  3. This is a sample of the interlaced video. If you deinterlace it you can see that sometimes there are random errors.

    I'm trying to use the conditional filter and my code is
    Code:
    avisource("1.avi")
    ConvertToYUY2()
    AssumeTFF()
    SeparateFields()
    
    even = SelectEven()
    odd = SelectOdd()
    
    black = even.coloryuv(off_y=-256, cont_u=-256, cont_v=-256).colorYUV(off_y=16)
    
    even = ConditionalFilter(even, even, black, "YDifferenceFromPrevious()", "greaterthan", "2")
    odd = ConditionalFilter(odd, odd, black, "YDifferenceFromPrevious()", "greaterthan", "2")
    
    interleave(even,odd)
    But on the video it is displayed the error message:
    "Plane Difference: only planar images (as YV12) supported!"

    Then I tried to write ConvertToYV12() instead of ConvertToYUY2() but the result was the same.
    Image Attached Files
    Quote Quote  
  4. The video needs to be YV12. Replace your ConvertToYUY2() with ConvertToYV12(interlaced=true). I'll look into it in more detail later...
    Quote Quote  
  5. If anything, (I mentioned it in the doom9 thread) rather than replace the duplicate fields with black ones, you should be replacing them with interpolated fields.

    jagabo will probably be able to show you how to do it. I'd have to work it out as it's not something I've done before.
    Quote Quote  
  6. Originally Posted by hello_hello View Post
    If anything, (I mentioned it in the doom9 thread) rather than replace the duplicate fields with black ones, you should be replacing them with interpolated fields.
    Yes, that is what I was thinking. And it's one reason for the structure of my earlier script. In the following script I create evenr and oddr as replacement fields (instead of black). They are made of only fields motion interpolated between each of the source fields.

    Code:
    AviSource("A1.avi") 
    ConvertToYV12(interlaced=true)
    AssumeTFF()
    
    SeparateFields()
    
    even = SelectEven()
    #evenr = even.InterFrame(FrameDouble=true, cores=4).SelectOdd().Subtitle("evenr")
    evenr = even.DoubleFPS2().SelectOdd().Subtitle("evenr")
    
    odd = SelectOdd()
    #oddr = odd.InterFrame(FrameDouble=true, cores=4).SelectOdd().Subtitle("oddr")
    oddr = odd.DoubleFPs2().SelectOdd().Subtitle("oddr")
    
    #black = even.coloryuv(off_y=-256, cont_u=-256, cont_v=-256).colorYUV(off_y=16)
    
    even = ConditionalFilter(even, even, evenr, "YDifferenceFromPrevious()", "greaterthan", "2")
    odd = ConditionalFilter(odd, odd, oddr, "YDifferenceFromPrevious()", "greaterthan", "2")
    
    interleave(even,odd)
    Weave()
    I stamped the interpolated fields with Subtitle() so it's obvious which fields have been replaced. You wouldn't do that in production, obviously.

    DoubleFPS2() can be found in these forums:

    https://forum.videohelp.com/threads/329754-Help-deinterlacing-IVTC-ing-VHS-material-co...lm#post2042689

    Or use some other frame rate doubler like InterFrame().

    Add QTGMC() and Stab() at the end and you get smooth 50p video.
    Last edited by jagabo; 30th Jan 2018 at 17:33.
    Quote Quote  
  7. I tried these three alternative:
    1) Transform the second duplicates fields in black fields
    2) Transform the second duplicate fields in black fields, then deinterlace, remove the black frames and reverse-interlace
    3) The Jagabo's solution: trasform the second duplicate fields in a motion-estimated interpolation of the near fields.

    The third alternative is the best and it is resolutive for me. Thank you Jagabo!

    This practice allows me to correct (the best as I can) the errors of my defective TBC AVT8710. Unfortunately many units of this model have the same problem, so this solution could be useful for everyone else has a defective unit of this TBC.

    This is a temporary solution: the only true solution to the problem would be to buy a non defective TBC!

    In my case it was compulsory to adopt this solution because the VHS was acquired with the defective TBC multiple times (because I tried to correct the errors in various unsuccessful ways). It was very degraded before and after every playing it was sensibly more degraded.
    So now a working TBC would be unuseful for that VHS!

    The avisynth code that handle this situation is this:

    Code:
    avisource("1.avi")
    ConvertToYV12(interlaced=true)
    AssumeTFF()
    SeparateFields()
    
    even = SelectEven()
    odd = SelectOdd()
    
    function DoubleFPS2(clip source){
    super = MSuper(source, pel=2, hpad=0, vpad=0, rfilter=4)
    backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
    forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
    backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3)
    forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3)
    backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3)
    forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3)
    MBlockFps(source, super, backward_3, forward_3, num=2*FramerateNumerator(source), den=FramerateDenominator(source), mode=0)
    }
    
    evenr = even.DoubleFPS2().SelectOdd()
    oddr = odd.DoubleFPs2().SelectOdd()
    
    even = ConditionalFilter(even, even, evenr, "YDifferenceFromPrevious()", "greaterthan", "2")
    odd = ConditionalFilter(odd, odd, oddr, "YDifferenceFromPrevious()", "greaterthan", "2")
    
    a = interleave(even,odd).killaudio()
    a
    weave()
    
    ConvertToYUY2()
    
    QTGMC(Preset="Placebo")
    Very good


    One last question, jagabo: why in the DoubleFPS2() you always put chroma=false?
    Quote Quote  
  8. Re chroma=false, just habit.

    If you have multiple caps and the dups are in different places in each you can use a median (of three, or five) filter to get rid of the duplicate frames and otherwise clean up some of the noise. Or use one of the other caps for replacement fields (rather than motion interpolated fields) with the above script.
    Quote Quote  



Similar Threads