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:
Thanks in advance!Code:AVISource("video.avi").AssumeFPS(30000,1001) AssumeTFF() SeparateFields() #???
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 23 of 23
Thread
-
-
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. -
Thanks for the reply, manono. Mind providing a snippet, please.
Thank you again. -
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). -
I understood that much, for sure.
Well, after collapsing the fields into frames, the vertical resolution is technically halved anyway, no?
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. -
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. -
-
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:
[Attachment 40051 - Click to enlarge]
after SeparateFields():
[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 18:50.
-
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. -
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.
-
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. -
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. -
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))
Script error: There is no function named 'yadifmod'.
(script.avs, line 4, column 13)
r am I missing something?
Thanks. -
-
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%)
-
Well, holy hot damn, 'aint that good to know. I've been swearing by it up 'till now.
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! -
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.
-
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 17:13. Reason: added "by accident"
-
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 -
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.
Similar Threads
-
Removing vertical "dot crawl" stripes?
By skerit in forum RestorationReplies: 27Last Post: 18th Jul 2021, 22:56 -
Green vertical line on left side of the screen after filtering in Avisynth?
By Srivas in forum RestorationReplies: 2Last Post: 19th Feb 2016, 01:03 -
AVISynth / sRestore not removing duplicate frames
By bvdd in forum Video ConversionReplies: 4Last Post: 23rd Nov 2015, 08:08 -
How to Fix Horizontal Jitter with AviSynth?
By VideoFanatic in forum RestorationReplies: 2Last Post: 26th Jan 2014, 23:52 -
Panasonic 1980P and vertical jitter on EP playback
By justin81 in forum RestorationReplies: 10Last Post: 12th Oct 2012, 16:40