VideoHelp Forum




+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 48 of 48
  1. Member
    Join Date
    Nov 2006
    Location
    United States
    Search Comp PM
    Originally Posted by Akuma786 View Post
    Originally Posted by Sharc View Post
    or change the order
    Code:
    LWLibavVideoSource("VTS_01_1.VOB")
    assumeTFF()
    Telecide(back=1,guide=2,post=0).Decimate(cycle=25)
    bob().srestore(frate=24)  #removes the ghosts
    Yeah that works for the ghosting, much appreciated. Thanks Sharc.

    I still have the issue with odd frames being removed as mentioned in #18. Any work around that please ?
    Hi Sharc,

    Is it the (bob) or the Telecide(back=1,guide=2,post=0 that helps with ghosting?
    Quote Quote  
  2. Originally Posted by clashradio View Post
    Originally Posted by Akuma786 View Post
    Originally Posted by Sharc View Post
    or change the order
    Code:
    LWLibavVideoSource("VTS_01_1.VOB")
    assumeTFF()
    Telecide(back=1,guide=2,post=0).Decimate(cycle=25)
    bob().srestore(frate=24)  #removes the ghosts
    Yeah that works for the ghosting, much appreciated. Thanks Sharc.

    I still have the issue with odd frames being removed as mentioned in #18. Any work around that please ?

    Hi Sharc,

    Is it the (bob) or the Telecide(back=1,guide=2,post=0 that helps with ghosting?
    - Telecide() or TFM() matches the fields of telecined or phase-shifted video
    - Decimate() or TDecimate() removes duplicates (which may result from the fieldmatching)
    - bob().sRestore() removes ghosts from blended fields (typically originating from framerate conversions)
    All of these filters have settings to optimize their effectiveness, depending on the source
    https://www.rationalqm.us/decomb/decombnew.html
    http://avisynth.nl/index.php/Internal_filters
    http://avisynth.nl/index.php/External_filters
    http://avisynth.nl/index.php/TIVTC
    http://avisynth.nl/index.php/Srestore
    Last edited by Sharc; 17th Mar 2026 at 17:02.
    Quote Quote  
  3. Member
    Join Date
    Nov 2006
    Location
    United States
    Search Comp PM
    Originally Posted by Sharc View Post
    Originally Posted by clashradio View Post
    Originally Posted by Akuma786 View Post
    Originally Posted by Sharc View Post
    or change the order
    Code:
    LWLibavVideoSource("VTS_01_1.VOB")
    assumeTFF()
    Telecide(back=1,guide=2,post=0).Decimate(cycle=25)
    bob().srestore(frate=24)  #removes the ghosts
    Yeah that works for the ghosting, much appreciated. Thanks Sharc.

    I still have the issue with odd frames being removed as mentioned in #18. Any work around that please ?

    Hi Sharc,

    Is it the (bob) or the Telecide(back=1,guide=2,post=0 that helps with ghosting?
    - Telecide() or TFM() matches the fields of telecined or phase-shifted video
    - Decimate() or TDecimate() removes duplicates (which may result from the fieldmatching)
    - bob().sRestore() removes ghosts from blended fields (typically originating from framerate conversions)
    All of these filters have settings to optimize their effectiveness, depending on the source
    https://www.rationalqm.us/decomb/decombnew.html
    http://avisynth.nl/index.php/Internal_filters
    http://avisynth.nl/index.php/External_filters
    http://avisynth.nl/index.php/TIVTC
    http://avisynth.nl/index.php/Srestore
    Thank you. I have trouble with ghosting sometimes. I'm sure this will help
    Quote Quote  
  4. Originally Posted by Akuma786 View Post
    Originally Posted by Sharc View Post
    or change the order
    Code:
    LWLibavVideoSource("VTS_01_1.VOB")
    assumeTFF()
    Telecide(back=1,guide=2,post=0).Decimate(cycle=25)
    bob().srestore(frate=24)  #removes the ghosts
    Yeah that works for the ghosting, much appreciated. Thanks Sharc.

    I still have the issue with odd frames being removed as mentioned in #18. Any work around that please ?
    @akuma786: If you are still here take a look at this post for inserting interpolated frames. Applied to frame 141 of your clip:
    Image Attached Files
    Quote Quote  
  5. I have been meaning to try applying what I suggested earlier in this thread. I did briefly try my various automatic scripts for detecting and correcting field shifts (which is one aspect of the problem) as well as detecting and then dealing with duplicates. The section between frames 563 and 575 is the easy place to figure out the automatic fix. If I get time, I may try to do it, even if the OP has moved on.
    Quote Quote  
  6. This simple script seems to detect and correct the field reversal. It uses the old MugFunky "FillDrops" function to take care of the duplicate which happens at each point where the fields reverse.

    This is the result:

    Automatically Detect and Correct Field Reversal

    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()
    
    # 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
    }
    
    
    #Same as FillDrops, but for interlaced video
    
    function filldropsI (clip c, float "thresh")
    {
      thresh = Default(thresh, 0.1)
      even = c.SeparateFields().SelectEven()
      super_even=MSuper(even,pel=2)
      vfe=manalyse(super_even,truemotion=true,isb=false,delta=1)
      vbe=manalyse(super_even,truemotion=true,isb=true,delta=1)
      filldrops_e = mflowinter(even,super_even,vbe,vfe,time=50)
    
      odd  = c.SeparateFields().SelectOdd()
      super_odd=MSuper(odd,pel=2)
      vfo=manalyse(super_odd,truemotion=true,isb=false,delta=1)
      vbo=manalyse(super_odd,truemotion=true,isb=true,delta=1)
      filldrops_o = mflowinter(odd,super_odd,vbo,vfo,time=50)
    
      evenfixed = ConditionalFilter(even, filldrops_e, even, "YDifferenceFromPrevious()", "lessthan",  String(thresh))
      oddfixed  = ConditionalFilter(odd,  filldrops_o, odd,  "YDifferenceFromPrevious()", "lessthan",  String(thresh))
    
      Interleave(evenfixed,oddfixed)
      Weave()
    }
    Last edited by johnmeyer; 22nd Mar 2026 at 09:46.
    Quote Quote  
  7. Oh yes, thanks, I remember the discussions and links here. So the OP has a full arsenal for addressing his issues - if he returns
    Last edited by Sharc; 22nd Mar 2026 at 06:53.
    Quote Quote  
  8. Hi yeah I tried everything so far, almost gave up.@Johnmeyer I've tried your script above, it seems to work on that segment (between frames 563 and 575) you mentioned but there's many other scenes that it doesnt fix automatically. I noticed on other scenes if I change :AssumeTFF() to AssumeBFF() it fixes some but for others I have to change back to AssumeTFF(). Dont know what else to do.
    Quote Quote  
  9. Here is a short clip:https://www.swisstransfer.com/d/f5c80775-3e2c-424d-a1a5-23b43d57996d

    If i use your script you'll see some parts are not fixed until I change line 10 from AssumeTFF() to AssumeBFF()

    Here is the script, maybe I'm doing something wrong in script:
    Code:
    #Detect and correct field reversal
    #John Meyer March 21, 2026
    
    
    
    #Modify this to point to the video file you use. 
    src =  LWLibavVideoSource("G:\future projects\Dance of the Drunken Mantis proejct\NEW SAMPLE\VTS_01_1.VOB").ConvertToYV12()
    
    # 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
    }
    
    Crop(10, 4, -8, -0, align=true)
    Spline36Resize(704, 284)
    Quote Quote  
  10. deleted; double post
    Last edited by Sharc; 24th Mar 2026 at 03:09.
    Quote Quote  
  11. Originally Posted by Akuma786 View Post
    If i use your script you'll see some parts are not fixed until I change line 10 from AssumeTFF() to AssumeBFF()

    Here is the script, maybe I'm doing something wrong in script: ....
    I didn't try, but as with all threshold based decisions you may not just copy the script 1:1. One usuallly has to adjust the decision thresholds to the particular source for best results.
    Quote Quote  
  12. Or try, (similar to above):
    The script removes most ghost, returning 25fps, preserving the original number of frames (624) with some duplicates. Then duplicates and near duplicates get substituted by motion interpolated frames (labelled "interpolated" for demo). As the number of frames is preseved the audio should stay synched.

    Code:
    LWLibavVideoSource("VTS_01_1.VOB")
    
    #ghosts removal
    QTGMC(preset="fast").SRestore(frate=25)
    
    # followed by replacement of remaining dupes (or near dupes) by motion interpolated frames
    # script based on a proposal by jagabo
    thresh=2.2 #sensitivity for dupes recognition; adjust as needed
    alt = DoubleFPS_RIFE().SelectOdd() # double frame rate, keep only the newly interpolated frames
    alt=alt.subtitle("interpolated",size=24) #for debugging only, disable for real use case
    test = mt_lutxy(last, last.Loop(2,0,0),"x y - abs", chroma="-128") # abs diff between frames, for duplicate detection
    ConditionalFilter(test, alt, last, "AverageLuma", "lessthan", "thresh") # replace nearly identical frames with the motion interpolated frames
    
    AssumeFPS(24.0, synch_audio=true)  #slowdown if really needed
    
    
    function DoubleFPS_RIFE(clip source)
    { 
        source.z_ConvertFormat(pixel_type="RGBPS", colorspace_op="709:709:709:l=>rgb:709:709:f")
        Rife(model=12, sc=true, sc_threshold=0.10)
        z_ConvertFormat(pixel_type="YUV420P8", colorspace_op="rgb:709:709:f=>709:709:709:l")
    }
    Image Attached Files
    Last edited by Sharc; 24th Mar 2026 at 07:38. Reason: aspect ratio 16:9 added
    Quote Quote  
  13. just for fun I used QTGMC(preset="fast") + sRestore(frate=25) + SeedVR2,...
    Image Attached Files
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  14. My script worked fine on the two sections that others had identified and which I also easily found. I did not, however, walk through the entire clip frame-by-frame. As others have suggested, you may need to "tune" the script by adjusting the threshold ("c > 5.0").
    Quote Quote  
  15. Thanks Sharc that works alot better overall. Yeah johnmeyer I tried adjusting threshold coudnt get it to improve other section of movie. I like the upscale Selur, what parameters, settings you used on SeedVR2, I would like to replicate the same results please. I have downloaded ComfyUI and SeedVR2.
    Quote Quote  
  16. Here is an export of the settings: https://pastebin.com/dpkPcqsu
    should be near the defaults, aside from using ffv1 as output.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  17. Thanks Selur, will test it out. Much appreciated.
    Quote Quote  
  18. Much fun, but be aware diffusion based upscalers like SeedVR2 or Topaz Starlight are really slow.
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  



Similar Threads

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