VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. Member
    Join Date
    Jun 2016
    Location
    India
    Search PM
    Please can anybody help adapt the following script (poisondeathray & gavino i believe are the originators) for Interlaced Video? Am quite new into avisynth (just one week ). I have looked into john meyers script for filldropI but cannot figure out how to integrate it into this particular script. I do not need automatic detection as I have already marked the bad frames physically ranging from 1 - 10 frames. Have also tested Morph function which seems to work well but it has been suggested for use only with progressive video. Thanks beforehand for any help this newbie can get


    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)
    }






    ###
    #####interpolate bad frames and residual cleaning
    ###

    Super = msuper()
    bv1 = manalyse(Super, isb=true, delta=2)
    fv1 = manalyse(Super, isb=false, delta=2)
    bv2 = manalyse(Super, isb=true, delta=3)
    fv2 = manalyse(Super, isb=false, delta=3)
    global CandidatesForN = mflowinter(Super, bv2, fv2, time=33.3, ml=100)
    global CandidatesForO = mflowinter(Super, bv2, fv2, time=66.7, ml=100)
    global CandidatesForC = mflowinter(Super, bv1, fv1, time=50.0, ml=100)

    last
    #rx(104,12) #104-115 replaced
    Quote Quote  
  2. You cannot use it on interlaced video directly. Because each frame consists of 2 separate fields which are 2 separate moments in time.

    You have to apply to grouped even and odd separated fields , then weave ; or smart bob deinterlace, then apply the filter, then re-interlace (if you wanted to keep interlace, or just leave it bobbed)
    Quote Quote  
  3. This function is an adaptation of an old script written by MugFunky to fill in the gap created by a duplicate frame. I updated it to use MVTools2 and then changed it to work on interlaced video. It replaces a duplicate frame by using MVtools2 motion estimation. You will have to adapt (or remove) the two conditional logic statements at the end of the script so that the function only works for the frames you select. Probably the easiest thing to do is simply remove the two conditional lines, change the interleave statement so it interleaves even and odd, rather than the output of the two conditional logic statements, and then call the function from your own conditional logic.

    Even if you don't use this code, it illustrates how you can adapt your code to work on interlaced video: you separate fields and then perform one set of operations on the even fields and the exact same operations on the even field, treating the fields as though they were frames. Then, at the end of the script you interleave the even and odd fixed fields and weave to put them back together into a frame.

    Make sure to test this on a short clip and use bob() or separatefields() on that clip to make sure you didn't reverse the field order. That is really easy to do with a script like this, depending on the field order coming into the script.

    Code:
    function filldropsI (clip c)
    {
      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", "0.1")
      oddfixed  = ConditionalFilter(odd,  filldrops_o, odd,  "YDifferenceFromPrevious()", "lessthan", "0.1")
    
      Interleave(evenfixed,oddfixed)
      Weave()
    }
    Quote Quote  
  4. Member
    Join Date
    Jun 2016
    Location
    India
    Search PM
    Originally Posted by poisondeathray View Post
    You cannot use it on interlaced video directly. Because each frame consists of 2 separate fields which are 2 separate moments in time.

    You have to apply to grouped even and odd separated fields , then weave ; or smart bob deinterlace, then apply the filter, then re-interlace (if you wanted to keep interlace, or just leave it bobbed)
    I understand, the problem was i unfortunately am not yet versed enough in avi scripting to be able to adapt it for usage. This was the reason i had also quoted john's script where he had done it but only for identification of duplicate and removal. I however found the following script in one of the various postings which can call for the functions of the earlier script.

    Super_Even = even.msuper()
    bv = manalyse(Super_Even, isb=true, delta=3)
    fv = manalyse(Super_Even, isb=false, delta=3)
    bv1 = manalyse(Super_Even, isb=true, delta=2)
    fv1 = manalyse(Super_Even, isb=false, delta=2)
    global CandidatesForN = mflowinter(Super_Even, bv, fv, time=33.3, ml=100)
    global CandidatesForO = mflowinter(Super_Even, bv, fv, time=66.7, ml=100)
    global CandidatesForC = mflowinter(Super_Even, bv1, fv1, time=50.0, ml=100)

    Same thing would go for the odd.
    This script manages upto 7 frames but above that causes just freeze frames while the morph function seems to be able to manage upto 10 frame range and even more nicely. How would i adapt this script to call for the morph function?

    And thanks for the quick replys. Really appreciate the guidance. A couple of weeks back at Videofaq Sanlyn in one of his comments hinted that easier way to solving frame replacement would be motion based interpolation which made me start searching for possible solutions.
    Quote Quote  



Similar Threads