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 23 of 23
Thread
  1. Hi, fellas. First post here.

    While deinterlacing 29.97i footage to 59.94p using SeparateFields(), I noticed some vertical jitter(?) on the footage, as if there is a difference of one vertical pixel between the even and odd frame Y-positions. (Things appear to be moving up-down-up-down-up-down... by 1px).

    I know that offsetting just the odd or just the even frames by a pixel will compensate for this, but I want to do it in AVISynth without going into an NLE. My guess is that this is in part accomplished using the SelectOdd()/SelecEven() command, but I don't know where to go from there. Would someone be kind enough to provide the finishing lines to this here poem:

    Code:
    AVISource("video.avi").AssumeFPS(30000,1001)
    AssumeTFF()
    SeparateFields()
    #???
    Thanks in advance!
    Quote Quote  
  2. Since you're not going to encode that script (are you?) why do you care if it bobs up and down? If you want to bob deinterlace then use Yadif(Mode=1) or the better QTGMC and no more bouncing.

    If you really do want to encode that script, maybe explain why and we can help.
    Quote Quote  
  3. Thanks for the reply, manono. Mind providing a snippet, please.
    Thank you again.
    Quote Quote  
  4. Originally Posted by IllusionSector View Post
    While deinterlacing 29.97i footage to 59.94p using SeparateFields(), I noticed some vertical jitter(?) on the footage, as if there is a difference of one vertical pixel between the even and odd frame Y-positions. (Things appear to be moving up-down-up-down-up-down... by 1px).

    I know that offsetting just the odd or just the even frames by a pixel will compensate for this, but I want to do it in AVISynth without going into an NLE. My guess is that this is in part accomplished using the SelectOdd()/SelecEven() command, but I don't know where to go from there. Would someone be kind enough to provide the finishing lines to this here poem:
    The even and odd fields in interlaced video are not only taken at different moments in time, but also different places in space. Thus, the odd fields are actually "seeing" additional detail that are not in the even fields. Since they are taken from different places in space, when you do a "separatefield()" operation, you will see movement up and down by one scan line (i.e., one pixel) as you go from the even to the odd fields, to the even fields, etc.

    So, what you are seeing is exactly as it should be.

    Unless you want to re-size the video or unless you want to apply certain filters which require that the two fields be aligned in time (this is called "deinterlacing"), you don't need to do anything. You sure as heck don't want to do anything to try to line them up in space because at that point you will throw out half of your vertical resolution. Even if the resulting video is still 1920x1080, the effective resolution will now be 1920x540.

    Let us know what you're really trying to do. If you are indeed really trying to deinterlace, then "separatefields()" is not what you want to be using. Do a quick search in this forum or doom9.org (or better yet, just do a Google search) for "AVISynth" and "deinterlace". You will find lots of scripts that will deinterlace.

    FWIW, I never deinterlace unless I need to do it (you must do it when re-sizing interlaced video, for instance).
    Quote Quote  
  5. Originally Posted by johnmeyer View Post
    The even and odd fields in interlaced video are not only taken at different moments in time, but also different places in space. Thus, the odd fields are actually "seeing" additional detail that are not in the even fields. Since they are taken from different places in space, when you do a "separatefield()" operation, you will see movement up and down by one scan line (i.e., one pixel) as you go from the even to the odd fields, to the even fields, etc.

    So, what you are seeing is exactly as it should be.
    I understood that much, for sure.
    Originally Posted by johnmeyer View Post
    You sure as heck don't want to do anything to try to line them up in space because at that point you will throw out half of your vertical resolution. Even if the resulting video is still 1920x1080, the effective resolution will now be 1920x540.
    Well, after collapsing the fields into frames, the vertical resolution is technically halved anyway, no?
    Originally Posted by johnmeyer View Post
    Let us know what you're really trying to do. If you are indeed really trying to deinterlace, then "separatefields()" is not what you want to be using. Do a quick search in this forum or doom9.org (or better yet, just do a Google search) for "AVISynth" and "deinterlace". You will find lots of scripts that will deinterlace.
    I wanted to deinterlace and interpolate the vertical resolution, but I wasn't quite fond of the results yielded by the internal resizers, so I used nnedi3

    After some fiddling about here's what I did:

    Code:
    LoadPlugin("Release_Intel_W7_Core2_AVX2\nnedi3.dll")
    v=AVISource("video.avi", audio=true).AssumeFPS(30000,1001).AssumeTFF().SeparateFields()
    v=v.nnedi3_rpow2(2,0).PointResize(1920,1081)
    vEven=v.SelectEven().Crop(0,1,0,0)
    vOdd =v.SelectOdd().Crop(0,0,0,-1)
    return Interleave(vEven,vOdd).AssumeFPS(60)

    If there's a better way of accomplishing something similar, I'd like to see a snippet, please.
    Quote Quote  
  6. Originally Posted by IllusionSector View Post
    Thanks for the reply, manono. Mind providing a snippet, please.
    AVISource("video.avi").AssumeFPS(30000,1001)
    Yadif(Mode=1)###or QTGMC

    If there's a better way of accomplishing something similar, I'd like to see a snippet, please.
    What do you want to do? Are you trying to upsize an interlaced source? Then, yes, there's a better way. That script won't work anyway, unless you're in RGB. And if you are, one can only wonder why.
    Quote Quote  
  7. Originally Posted by IllusionSector View Post
    Well, after collapsing the fields into frames, the vertical resolution is technically halved anyway, no?
    Yes it is, but no, you most definitely do not want to "deinterlace" this way. It is the worst possible way to do it. Manano is giving you the correct guidance, so I won't try to add anything.
    Quote Quote  
  8. Originally Posted by IllusionSector View Post
    I know that offsetting just the odd or just the even frames by a pixel will compensate for this
    No it won't. Whether a horizontal edge bounces or not depends on which scan line it's on. Some edges within the file are bouncing up and down relative to the other field, but some are not. If you you move the field down to fix the edges that were bouncing the edges that were not bounce will start bounding.

    For example, a frame with a sharp horizontal edge:

    Image
    [Attachment 40051 - Click to enlarge]


    after SeparateFields():

    Image
    [Attachment 40052 - Click to enlarge]


    Note how the first quarter of the top edge is not bouncing, the second quarter is, etc. If you move the field down by a scan line so the second quarter is no longer bouncing, the first quarter will bounce.
    Last edited by jagabo; 26th Dec 2016 at 17:50.
    Quote Quote  
  9. Thank you, gentlemen, so much for the help. Thanks for the illustration. jagabo.
    Let me chew on this for a while and I'll get back.

    Thanks again.
    Quote Quote  
  10. manono already gave you the best solution for most cases: QTGMC(). Unfortunately, it's pretty slow, even at the faster presets. I find QTGMC(preset="fast") to be bearable while still giving decent results.
    Quote Quote  
  11. So, anyway, gents.

    Manono's Yadif(Mode=1) tip worked great! (And there I was with my silly acrobatics.)
    Had I RTFMed Yadif, I guess I wouldn't have been confusing Mode=1 with Order=1, so thanks.

    Final question: For this particular scenario, would you say QTGMC() results are marginally or substantially superior to Yadif(Mode=1)?

    Thanks.
    Quote Quote  
  12. Originally Posted by IllusionSector View Post
    Final question: For this particular scenario, would you say QTGMC() results are marginally or substantially superior[/FONT]?
    It kind of depends on the content. For animations or anything else with thin lines or diagonals, Yadif aliases, sometimes pretty badly. But QTGMC in many instances is only marginally better. Somewhere in between the two in both quality and speed is this:

    yadifmod(mode=1, edeint=nnedi3(field=-2))

    You'll need both YadifMod and NNEDI3. For the kind of work I do it's closer in quality to QTGMC and much faster than the QTGMC default settings. Not much beats Yadif in sheer speed, though, if that's a factor in your decision.
    Quote Quote  
  13. Originally Posted by manono View Post
    yadifmod(mode=1, edeint=nnedi3(field=-2))
    You'll need both YadifMod and NNEDI3.
    Is that all I'll need?

    Tried this:
    Code:
    Load_Stdcall_Plugin("H:\apps\MeGUI\tools\avisynth_plugin\yadif.dll")
    LoadPlugin("H:\apps\MeGUI\tools\avisynth_plugin\nnedi3.dll")
    AVISource("video.avi", audio=false).AssumeFPS(30000,1001)
    yadifmod(mode=1, edeint=nnedi3(field=-2))
    and got:
    Script error: There is no function named 'yadifmod'.
    (script.avs, line 4, column 13)


    r am I missing something?

    Thanks.
    Quote Quote  
  14. Originally Posted by IllusionSector View Post
    r am I missing something?
    Yes, you're missing YadifMod. I'll enclose it for you.
    Image Attached Files
    Quote Quote  
  15. Thanks, manono.

    While this did solve the error message, I have a different problem now. What I think now happens is that rather than in sequence, the deinterlaced frames play in what appears to be the following order: 0,2,1,3,4,6,5,7, etc... You know what I mean, right? It's that effect where the person in the video looks like he's having tremors or something.

    Could it be that the functions needs a different argument?

    I'm 100% sure there are no problems with the file itself, but here's the MediaInfo reading, just in case:

    Code:
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    Format profile                           : OpenDML
    File size                                : 8.30 GiB
    Duration                                 : 11 min 36 s
    Overall bit rate                         : 102 Mb/s
    
    Video
    ID                                       : 0
    Format                                   : JPEG
    Codec ID                                 : MJPG
    Duration                                 : 11 min 36 s
    Bit rate                                 : 100 Mb/s
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 29.970 (30000/1001) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:2
    Bit depth                                : 8 bits
    Scan type                                : Interlaced
    Scan order                               : Top Field First
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 1.609
    Stream size                              : 8.11 GiB (98%)
    Quote Quote  
  16. mediainfo doesn't necessarily give you the correct field order

    fwd,back,fwd,back jerky suggests wrong field order

    for yadifmod + nnedi3

    TFF is
    yadifmod(order=1, mode=1, edeint=nnedi3(field=3))

    BFF is
    yadifmod(order=0, mode=1, edeint=nnedi3(field=2))
    Quote Quote  
  17. Originally Posted by poisondeathray View Post
    MediaInfo doesn't necessarily give you the correct field order
    Well, holy hot damn, 'aint that good to know. I've been swearing by it up 'till now.
    Originally Posted by poisondeathray View Post
    for yadifmod + nnedi3
    TFF is
    yadifmod(order=1, mode=1, edeint=nnedi3(field=3))
    Yup, that's it! field had to be =3.

    Thanks!

    All said and done though, at least for this particular piece of footage, I could barely notice the difference in quality between yadifmod+nnedi3 and plain yadif.

    Still, thanks all!
    Quote Quote  
  18. Hehe, maybe I should have mentioned about getting the field order right. I just gave a script I've used most recently and that I usually use. If you don't know about right or wrong field order then the explanation in the doc I included might not help much. But now you know and now you know what to do if it happens again. Thanks to pdr.
    Quote Quote  
  19. Originally Posted by poisondeathray View Post
    mediainfo doesn't necessarily give you the correct field order.
    Yup: it is just a flag. There are many AVISynth scripts that can produce field order reversal. I know because I've created dozens of them myself (by accident, of course) and then had to figure out what the heck was going on. The usual culprit is the SelectEvery() statement, although there are other ways to cause the problem.

    Fortunately, it is easy to fix field reversal, if it is already baked in, but you can't (usually) just simply change the field order flag.
    Last edited by johnmeyer; 5th Jan 2017 at 16:13. Reason: added "by accident"
    Quote Quote  
  20. Originally Posted by manono View Post
    That script won't work anyway, unless you're in RGB. And if you are, one can only wonder why.
    manono, sorry for returning to this thread after such a long time, but how come this is inevitable? The source is not in RGB and I don't explicitly convert to it. Upon encoding, however, I'm prompted to ConvertToYV12(). Does YADIF automatically convert the video to RGB or something. Is there no way to do it while simply staying in YV12?

    Again, my apologies for these novice questions. I am confused.

    Thanks.
    Quote Quote  
  21. Originally Posted by IllusionSector View Post
    Originally Posted by manono View Post
    That script won't work anyway, unless you're in RGB. And if you are, one can only wonder why.
    manono, sorry for returning to this thread after such a long time, but how come this is inevitable? The source is not in RGB and I don't explicitly convert to it. Upon encoding, however, I'm prompted to ConvertToYV12(). Does YADIF automatically convert the video to RGB or something. Is there no way to do it while simply staying in YV12?

    Again, my apologies for these novice questions. I am confused.

    Thanks.
    Yadif doesn't convert to RGB

    He was referring to 1 pixel or odd numbered height dimensions. Your earlier proposal of PointResize(1920,1081) in post 5

    You can't have that with subsampled chroma . So it won't work with YUV 4:2:0 (YV12 is planar 4:2:0) or 4:2:2 . 1 pixel values will work with 4:4:4, because Y, U, V are all the same dimensions . RGB is not subsampled either, so you can crop in 1 pixel values too
    Quote Quote  
  22. Originally Posted by poisondeathray View Post
    You can't have that with subsampled chroma . So it won't work with YUV 4:2:0 (YV12 is planar 4:2:0) or 4:2:2 . 1 pixel values will work with 4:4:4, because Y, U, V are all the same dimensions . RGB is not subsampled either, so you can crop in 1 pixel values too
    Thanks for the clarification, poisondeathray. Still, how come MeGUI prompts me to add the ConvertToYV12() statement at the end upon encoding? Aren't I in YV12 to begin with? I don't resize anything, see, I just use Yadif mode 1.
    Quote Quote  
  23. Originally Posted by IllusionSector View Post
    Originally Posted by poisondeathray View Post
    You can't have that with subsampled chroma . So it won't work with YUV 4:2:0 (YV12 is planar 4:2:0) or 4:2:2 . 1 pixel values will work with 4:4:4, because Y, U, V are all the same dimensions . RGB is not subsampled either, so you can crop in 1 pixel values too
    Thanks for the clarification, poisondeathray. Still, how come MeGUI prompts me to add the ConvertToYV12() statement at the end upon encoding? Aren't I in YV12 to begin with? I don't resize anything, see, I just use Yadif mode 1.
    If this is the same video in that mediainfo post, it says 4:2:2 , and mjpeg . So it depends on what your source filter is decoding it as. Some decoders might return YV12, others might even return it as RGB (bad) . A lot of things can go wrong if the chroma isn't treated properly as interaced

    You can check with info() right after the source filter (comment everything else out below) to see what it's decoding as

    But yadif can work with YUV 4:2:0 or 4:2:2 , so even if you're decoding 4:2:2, yadif itself will still work

    However, if the desired destination format was 4:2:0 , and you were decoding as 4:2:2, then that might explain it.
    Quote Quote  



Similar Threads