VideoHelp Forum




+ Reply to Thread
Results 1 to 23 of 23
  1. Hello all renowned board members

    With your great help I've been doing my own VHS rips/QTGMC deinterlace - briliant result.

    Recently I've received a file from someone, of unknown origin and it is totally weird to me.

    I've got interlaced AVI that claims to be from VHS (it was) but have following specifics (see below)
    I'm sure it is BFF (checked and de-interlace produced OK results -in time.TFF was jumping back-and-forth. Codec also looks unfamiliar.


    The problem to me is - the image jumps up and down. Naked eye observations in VirtualDub are showing
    Image 0,1,2 OK
    Image 3,4,5 shifted, for me should be shifted down
    pattern repeats.


    The most visible part is on white title "Within", or at triangle logo on right.

    Attaching 30MB (8sec) of original AVI (I've just cut the beginning of file so for example VLC say "no index", and this is just for the cut version, no complaining on full vid.


    What I've tried was VirtualDub2, Avisynth+ , QTGMC as below:

    #my blind guess
    FFmpegSource2("dyn.avi")
    AssumeBFF()
    SeparateFields()
    normal_fields=SelectEvery(6,0,1,2)
    shifted_fields=SelectEvery(6,3,4,5) # those I guess I need to shift down
    fixed_shifted= shifted_fields.Crop(0,0,0,-1).AddBorders(0,0,0,1)
    Interleave(normal_fields,fixed_shifted)
    Weave()

    ConvertToYV12(interlaced=true)
    QTGMC(preset="Slower", EdiThreads=16)







    Details from MediaInfo
    #Codec ID : dvsd
    #Codec ID/Hint : Sony
    #Width : 720 pixels
    #Height : 480 pixels
    #Display aspect ratio : 4:3
    #Frame rate : 29.970 (30000/1001) FPS
    #Standard : NTSC
    #Color space : YUV
    #Chroma subsampling : 4:1:1
    #Bit depth : 8 bits
    #Scan type : Interlaced
    #Scan order : Bottom Field First
    Image Attached Files
    Quote Quote  
  2. Additional question, how to properly view/assess frames or fields in Virtualdub ?
    Quote Quote  
  3. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    You can use the bob filter in vdub, or there is a filter called viewfields which works on 32 bit vdub.

    I suppose it depends on what your intentions/requirements are, but it
    looks like the underlying field rate is 50, so convert to 25i. The jitter doesn't seem too noticeable after that
    Image Attached Files
    Quote Quote  
  4. This looks like a video posted in doom9.org a few days ago. I developed this script for that and it seems to work for your video as well.

    Field Corrected

    Code:
    #Detect and correct field reversal
    #John Meyer March 21, 2026
    
    Loadplugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\MVTools\mvtools2.dll")
    
    #Modify this to point to the video file you use. 
    src = AVISource("E:\fs.avi").ConvertToYV12().killaudio()
    
    # Start by assuming TFF 
    clip = src.AssumeTFF()
    
    # Use TFM in debug mode to detect combing
    tfm = clip.TFM(mode=2, debug=true)
    
    # Conditional: if combing detected, flip field order
    # Change test from 5.0 to something else, if needed
    
    ScriptClip(tfm, """
      c = YDifferenceToNext()
      c > 5.0 ? last.AssumeBFF() : last
    """)
    
    filldrops ()
    
    #-----------------
    #Begin functions
    
    #Function which detects duplicate frames and fills one of those frames with 
    #a motion estimated frame. This function (unlike my modified one below) is
    #hard-wired with a detection threshhold of 1.1. I was too lazy to correct this
    
    function filldrops (clip c)
    {
      super=MSuper(c,pel=2)
      vfe=manalyse(super,truemotion=true,isb=false,delta=1)
      vbe=manalyse(super,truemotion=true,isb=true,delta=1)
      filldrops = mflowinter(c,super,vbe,vfe,time=50)
      fixed = ConditionalFilter(c, filldrops, c, "YDifferenceFromPrevious()", "lessthan", "1.1")
      return fixed
    }
    Last edited by johnmeyer; 26th Mar 2026 at 16:53. Reason: Add link to video
    Quote Quote  
  5. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    I'd like to have a play around with that clip but it won't run in VDub2 64bit at all (just a static image), and VLC throws an error (as you note).

    Could you pls do a VDub Direct Stream Copy of a chunk of say 15 seconds and attach for me?
    Quote Quote  
  6. Here is the Direct Stream copy for you @Alwyn, Thanks.
    Image Attached Files
    Quote Quote  
  7. If we inspect the fields assuming BFF we see a broken field order sequence like
    tbtbtt btbtbb tbtbtt btbtbtt .....
    (t=top field, b=bottom field)
    which gets fixed by johnmeyers script keeping the framerate intact.

    The vertical wobbling of the text and logo overlay remains and my have to be addressed separately, I think ....

    Edit:
    As the video is actually progressive a basic Fieldmatching seems to fix it as well:
    Code:
    LWLibavVideoSource("dyn98-30m.avi")
    AssumeBFF()
    TFM()
    Image Attached Files
    Last edited by Sharc; 27th Mar 2026 at 05:00.
    Quote Quote  
  8. Originally Posted by Forgotten View Post
    Here is the Direct Stream copy for you @Alwyn, Thanks.
    This longer clip has more severe issues like multiple dropped frames towards the end (frame #490 onwards) which TFM() alone (nor johnmeyer's script it seems?) does not fix ..... sorry.
    Maybe a recapture is due.

    Edit: For automated fixes of "random" dupes/drops you may want to take a look here:
    https://forum.doom9.org/showthread.php?p=1964066#post1964066

    Call this script with something like
    Code:
    LWLibavVideoSource("dyn98-stream-copy-600.avi")
    converttoYV16(interlaced=true)
    QTGMC(preset="fast")
    
    FixJumps(Method=1,debug=true)
    Good luck.
    Image Attached Files
    Last edited by Sharc; 27th Mar 2026 at 07:09.
    Quote Quote  
  9. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Appears to be a DV capture of a VHS tape which itself was a NTSC telecined version of a film shot. Possibly!

    Here's my offering, using SantiagMod. The second sample still played havoc with my system so I re-rendered it into another AVI, then ran Santiag on that new AVI.

    In VDub2, I cropped the yukky edges off (which removed the bouncy top lines) and resized to Yank standard.

    I did try to sharpen it with lsfmod but it came out too plasticy. The sharpening experts could no doubt improve it.

    Code:
    avisource("H:\Videohelp\Forgotten\dyn98-stream-copy-600 Magic.avi")
    ConvertToYV16()
    Spline16Resize(400,300)
    santiagmod(3,3)
    QTGMC(inputtype=2)
    converttoyv12()
    Image Attached Files
    Quote Quote  
  10. Here another attempt, based on a different field order swap detection method, originally proposed by jagabo AFAIK

    Code:
    LWLibavVideoSource("dyn98-stream-copy-600.avi")
    ConverttoYV16(interlaced=true)
    crop(16,8,-8,-12)
    
    AssumeTFF()
    
    n = TFM(clip2=QTGMC(FPSDivisor=2)) # normal field matching
    s = TFM(Crop(0,0,-0,-1).AddBorders(0,1,0,0).AssumeBFF().SwapFields(), clip2=QTGMC(FPSDivisor=2)) # field matching after swapping field positions
    
    ncombs = n.Crop(8,8,-8,-8).ConvertToYV12().FindCombing(9) # look for combing in n
    scombs = s.Crop(8,8,-8,-8).ConvertToYV12().FindCombing(9) # look for combing in s
    morecombs = Subtract(scombs, ncombs) # which has more combing?
    ConditionalFilter(morecombs, s, n, "AverageLuma()", "LessThan", "126.0") # pick the frame with the least combing
    TDecimate()
    
    #optional motion smoothing
    RGB=z_ConvertFormat(pixel_type="RGBPS", colorspace_op="709:709:709:l=>rgb:709:709:f") 
    bob=RGB.RIFE(gpu_thread=1, model=12, fps_num=60000, fps_den=1001, sc=true, sc_threshold=0.3,sc1=false)
    YV12=bob.z_ConvertFormat(pixel_type="YUV420P8", colorspace_op="rgb:709:709:f=>709:709:709:l")
    
    out=YV12.addborders(12,10,12,10)
    return out
    
    
    ###################################################
    #
    # Build a mask of areas where a pixel has a darker pixel above and below it.
    #
    ##################################################
    
    function FindCombing(clip v, int "threshold")
    {
        threshold = default(threshold, 10)
    
        # find vertical low to high transitions
        Subtract(v, v.blur(1.0, 1.0))
        GeneralConvolution(0, "
            0 -8  0
            0  8  0
            0  0  0", chroma=false, alpha=false)
        lth = mt_lut("x 126 -")
    
        # find vertical high to low transitions
        Subtract(v, v.blur(1.0, 1.0))
        GeneralConvolution(0, "
            0  0  0
            0  8  0
            0 -8  0", chroma=false, alpha=false)
        htl = mt_lut("x 126 -")
    
        # Logical AND(ish)
        Overlay(lth, htl, mode="multiply")
        mt_binarize(threshold)
        mt_expand()
        mt_inpand()
        mt_inpand(chroma="-128")
    }
    
    ##################################################
    Image Attached Files
    Quote Quote  
  11. Small_Deflicker might be worth a try.
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  12. Thanks all for now! Need to assess the mentioned methods in upcoming days to compare them.

    Sharc's RIFE looks best for now so I've ran my whole video with that.
    I had hard time installing RIFE models but managed that by dropping them into Avisynth+\plugin64+ and adding model_path parameter:

    Code:
    bob=RGB.RIFE(gpu_thread=8, model=12, fps_num=60000, fps_den=1001, sc=true, sc_threshold=0.3,sc1=false,model_path="c:\Program Files (x86)\AviSynth+\plugins64+\rife-v4.12_ensembleFalse")
    From your example I've blindly chosen model12 ensembleFalse, not even knowing what this one is best for. That's uncharted Machine Learning territory.

    Also,
    As the video is actually progressive a basic Fieldmatching seems to fix it as well:
    - how could I got that mislead in thinking that was interlaced...

    Again, thanks.
    Quote Quote  
  13. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    I counted 50 unique fields per second. Maybe my understanding of progressive/interlaced is spurious ?
    Quote Quote  
  14. Originally Posted by davexnet View Post
    I counted 50 unique fields per second. Maybe my understanding of progressive/interlaced is spurious ?
    Maybe this explains it: If the fields are grouped correctly (=matched) - using TFM() for example - and we then inspect the fields and see that the 2 fields of a frame are from the same point in time, so it's basically progressive video. Also called PsF or 2:2 pulldown.
    However, if a field gets dropped the subsequent frames look combed because one field is from the current film frame and the other field is from an adjacent film frame. It's called phase-shifted which looks like interlaced (combed), but in fact the video is progressive.
    Such field glitches (VHS is always field based) of progressive film footage can easily be misleading.
    And for more exotic cases see Scharfis Brain's classic:


    https://forum.doom9.org/showthread.php?t=176104
    Image Attached Thumbnails Exotisches_Interlacing(Scharfis_Brain).pdf  

    Image Attached Files
    Last edited by Sharc; 28th Mar 2026 at 13:51. Reason: Link to english translation added
    Quote Quote  
  15. Originally Posted by Forgotten View Post

    From your example I've blindly chosen model12 ensembleFalse, not even knowing what this one is best for.
    That model selection is a trial-and-error scenario for me as well. What is "best" depends on the footage and the kind of interpolation distortions one tolerates for the specific footage/scene.
    A case by case decision.
    Quote Quote  
  16. My 2 cents:
    bobbing the content:
    Frame 6 seems to be a slightly shifted version of frame 5, same for 11 and 10, 16 and 15,...
    So either bobbing + SelectEvery(6, 0, 1, 2, 3, 4) (assuming the pattern is fixed)
    or
    bobbing + TDecimate(clip, cycle=6) (probably the better choice)
    Seems to be the right approach,... (so 50000/1001 fps, assuming header of the file correctly indicates 29.97fps - unsure since the headers also say it's a 2.1gb and 12 min 18 s long file)

    doesn't look like PsF to me,... (but it also doesn't look like a 1st generation vhs capture to me,... but I haven't really worked with vhs for decades,...)
    Last edited by Selur; 28th Mar 2026 at 14:00.
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  17. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    I don't understand. It looks like 50 *unique* fields, how can tfm() match them?
    At least that's what I observe using LWLibAvVideoSource and bob()

    I have not looked at Scharfis Brain's classic: yet 'cause I'm on my phone
    Last edited by davexnet; 28th Mar 2026 at 14:27.
    Quote Quote  
  18. Progressive? I sure don't see that at all.

    I just viewed it again using a one-line script consisting of nothing more than separatefields() and I get double the frame rate; the video is half-height; and every single field is different from both adjacent fields. although every fifth field repeats. I think you may be getting fooled somehow, perhaps by viewing the video after TFM has done something.
    Quote Quote  
  19. Originally Posted by johnmeyer View Post
    Progressive? I sure don't see that at all.

    I just viewed it again using a one-line script consisting of nothing more than separatefields() and I get double the frame rate; the video is half-height; and every single field is different from both adjacent fields. although every fifth field repeats. I think you may be getting fooled somehow, perhaps by viewing the video after TFM has done something.
    See post#7 where I analyzed the fields sequence. We don't disagree there I think. And then apply TFM() and inspect the fields sequence again. Does the result differ significantly from the result of your script for that clip?
    Anyway, even if you prove me (or my interpretation) wrong and my simple TFM() shortcut of my 'Edit' in post #7 fooled me, let's help the OP to fix his issue, whatever method and conclusion one thinks ist "right"

    Edit: I downloaded the clip again. I stand corrected there are distinct fields 59.94fps with these repetitions (but with pattern breaks over the full length). The TFM() acted as a "fake" deinterlacer which has apparently fooled me. My bad, sorry for the confusion.
    Last edited by Sharc; 28th Mar 2026 at 17:01.
    Quote Quote  
  20. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Sharc the video you posted in #7 after tfm() still shows combing in some frames (frame 35 in vdub).
    Something is not right.
    Image Attached Thumbnails Click image for larger version

Name:	fieldmatch.png
Views:	11
Size:	729.2 KB
ID:	91752  

    Last edited by davexnet; 28th Mar 2026 at 16:14.
    Quote Quote  
  21. Originally Posted by Sharc View Post
    Anyway, even if you prove me wrong, let's help the OP to fix his issue, whatever method and conclusion one thinks ist "right"
    Gosh, I am not trying to prove you wrong, and I only posted because I think you confused not only me, but also the OP who, as you point out, we are trying to help.

    I don't see how this could be considered progressive, given what I wrote in my previous post: if you separate into fields and there is movement between (almost) every field (except for the dup every 5th field), then it is interlaced.

    I suppose we could try resizing it without first deinterlacing and then see what happens.
    Quote Quote  
  22. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    I agree. I went back to the sample I posted above; I had assumed the OP wanted an interlaced result.

    I decimated it to 50 fields and reinterlaced , but then I encoded it as progressive!
    This thread is cursed
    Quote Quote  
  23. Originally Posted by davexnet View Post
    This thread is cursed
    Indeed, especially as the OP preferred the final outcome despite my misinterpretation (not to defend it!)
    Quote Quote  



Similar Threads

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