VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    I don't have samples yet, but this is the problem:

    FIELD A is fine
    FIELD B is several interlace even-numbered lines below FIELD A.
    It's almost looks like double vision.

    Normally you have this (O=odd, E=even)
    O1
    E1
    O2
    E2
    O3
    E3

    But this file is like this:
    O1
    E2
    O2
    E3

    When you run separatefields(), the problem is obvious. One of the fields is downshifted by at least 2, maybe 4, lines. Drop-field deinterlace "fixes" it, but you get loss of detail (and jaggies, but santiag can fix those). Avisynth can probably repair this, but my attempt at syntax is wrong.

    Help?

    Anybody know why this happens? In the past 25 years, I've seen this issue maybe 5 times total.
    Last edited by lordsmurf; 3rd Jan 2018 at 01:07.
    Quote Quote  
  2. Originally Posted by lordsmurf View Post
    Normally you have this (O=odd, E=even)
    O1
    E1
    O2
    E2
    O3
    E3

    But this file is like this:
    O1
    E2
    O2
    E4
    This implies missing even fields ? Where is E3 ?

    If so, what is the pattern of drops ?

    If there was nothing missing , and the relationship was constant, then you could just shift the even fields by "x" amount
    Quote Quote  
  3. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Nothing is missing, just typo on my part. E3, not E4.

    Shifting was my idea as well.
    But Avisynth syntax is my issue. What would a script look like?
    Quote Quote  
  4. I'm still not entirely sure I understand your problem, but here is code I used for video in which one field was shifted vertically relative to the other. You can enter your own "VShift" amount and see if this code helps. I wrote this to only apply the fix when it looks like there is a problem because I had a source where it didn't happen all the time. You can remove the conditional code (all the YDifference stuff) if you instead want to do the shift on every frame. If that is what you want, you delete everything between the output and weave lines so that the last two lines in the script are these:

    output = interleave(even,odd)
    weave()
    ===============
    Code:
    # Script to both detect, and then fix, video in which one field has been shifted up by one line.
    # June 4, 2013
    
    source=AVISource("e:\fs.avi").assumetff().bob(0,1)
    
    #Perform the shift on bobbed source by first cropping and then adding border
    Hshift = 0
    Vshift = 2
    
    even = selecteven(source)
    odd  = selectodd (source)
    
    even = crop(even,Hshift,Vshift,0,0)
    even = addborders(even,0,0,Hshift,Vshift)
    
    #Alternate fix. Comment out two lines above, and remove comment from these lines.
    /*
    odd = crop(odd,Hshift,Vshift,0,0)
    odd = addborders(odd,0,0,Hshift,Vshift)
    */
    
    output = interleave(even,odd)
    
    #The next two lines are used during debugging to make sure YDifference metrics
    #really do detect field shift reliably
    #script = """Subtitle("\nsource = " + String(YDifferenceFromPrevious(source)) + \
    #         "\noutput = " + String(YDifferenceFromPrevious(output)), lsp=0)"""
    #Scriptclip(output, script)
    
    fixed = output.scriptclip("""YDifferenceFromPrevious(source) > \
            YDifferenceFromPrevious(output) ? output : source""")
    
    #Convert back to interlaced
    evenbob = selecteven(fixed)
    oddbob = selectodd(fixed)
    EvenOrig = separatefields(evenbob).selecteven()
    OddOrig =  separatefields(oddbob).selectodd()
    interleave(EvenOrig,OddOrig)
    weave()
    Quote Quote  
  5. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Sample attached.

    Although it appears to be 2 or 4 fields deep. it was actually only 1 pixel off.
    This worked:
    Code:
    SeparateFields()
    e=SelectEven().crop(0,1,0,0).AddBorders(0,0,0,1)
    o=SelectOdd()
    Interleave(e,o)
    Weave()
    BTW: For some dumb reason, I forget to include "e,o" in interleave. Oops. There was my syntax issue.
    Image Attached Files
    Last edited by lordsmurf; 3rd Jan 2018 at 01:08.
    Quote Quote  
  6. Or

    Code:
    AviSource("sample.avi") 
    AddBorders(0,0,0,1).Crop(0,1,0,0) # shift frame up (or down) by one scan line
    SwapFields()
    Last edited by jagabo; 3rd Jan 2018 at 08:20.
    Quote Quote  



Similar Threads