View Full Version : artifacts-free deinterlacing in ffdshow with 29.97fps DVD ?
pitch.fr
25th August 2008, 12:57
I've read quite a lot about interlaced streams, and basically the 2 fields you get are not from the same original frame.....so perfect IVTC requires to do some time based computing and join back each FULL frame together by putting them back in the right order.
it seems that BOB based deinterlacing schemes basically divide the vertical resolution/2, so blending is not quite an option as it ruins the original sharpness ?!
which leads to my original question : is there a way to get artifacts-free deinterlacing in ffdshow with 29.97fps NTSC Video DVD ?
apart from doing some dirty blending that will create artifacts and divide the vertical resolution/2 ?
I've tried the BOB thingies with a refresh rate that's the double of the frame rate, but that didn't yield good results.
I've also tried several Avisynth deinterlacers......they prolly work really well, but they're really not meant for real time use.
I'm using the built-in MPEG2 decoder of ffdshow, and I'd love to get no combing artifacts and full vertical resolution :(
I've got a 3.3Ghz Q6600, so I can manage strong post-processing :)
Thanks,
ranpha
25th August 2008, 13:52
ffdshow has a lot of deinterlacers. TomsMoComp, 5-tap lowpass and kernel deinterlacer are good. If they do not satisfy you, install DScaler and load their deinterlacers via ffdshow. If that also do not work for you, ditch ffdshow, enable DXVA (with Microsoft codec or Cyberlink PowerDVD) or set the interlaced flag in the MPC-HC decoder and let the video card do it for you.
if those steps above do not work, you really need to use Avisynth. For DVD, real-time processing should be doable.
LoRd_MuldeR
25th August 2008, 14:46
Use the "Avisynth" filter in ffdshow and load the "Yadif" deinterlacer (in "Bob" mode). For me this one gives the most satisfying results for a real-time deinterlacer.
I use this code in ffdshow-tryouts:
LoadCplugin("D:\Avisynth 2.5\Plugins\yadif.dll")
AssumeTFF().Yadif(mode=1)
Get the "Yadif" port for Avisynth at this location:
http://avisynth.org.ru/yadif/yadif.html
Latest Avisynth can be found here:
http://sourceforge.net/project/showfiles.php?group_id=57023&package_id=105994&release_id=616887
KernelBob (not KernelDeint) is also pretty good, but you must use a very low threshold (~3) to get grid of all artifacts ...
pitch.fr
25th August 2008, 16:13
OK thanks for the suggestions.
YADIF doesn't work too well in realtime here, but I already got LSF/ConvertToRGB32 and DDCC running in ffdshow :D
I will experiment with TomMoComp as you suggested.
I've found some FLT_* Dscaler plugins in Dscaler4 that are compatible with ffdshow, but the deinterlace filters are DI_* and these can't be opened in ffdshow ?! :(
I will also try Decomb/Uncomb and KernelBob in AVS.
so BOB will divide the vertical resolution/2 I guess ?!
khagaroth
25th August 2008, 16:19
If you need it only for watching the video and not for encoding and you have a recent graphic card (I tested it only with ATI cards, but nVidia cards should work too), force the output color space in ffdshow to NV12 (read uncheck everything except nv12) and enable Set interlace flag... This way you will get hardware deinterlacing, the PixelAdaptive deinterlacer in ATI cards does have pretty good results.
LoRd_MuldeR
25th August 2008, 16:29
so BOB will divide the vertical resolution/2 I guess ?!
Bob(bing) will double the framerate (e.g. 25i -> 50p), while "normal" deinterlacing will keep the framerate (e.g. 25i -> 25p).
For "deinterlacing at playback" I'd definitely use a bobber (Yadif, KernelBob), because it's the only way to keep all temporal information and get fluid motion.
KernelDeint or TomsMoComp don't bob, so you will get jerky motion ...
pitch.fr
25th August 2008, 16:30
yeah I thought about ATI hardware deinterlacing, but I use HR :)
also this 29.97 DVD is 720*480 with a DAR of 4:3
yet it doesn't fill the screen vertically....it needs one notch of horizontal expanding in MPC(which gives ghost lines in HR with ATi cards), can I somehow patch the file so it outputs as 720*540 with square pixels ?
I've tried to set 1.35/720*534 AR in MKVtoolnix/ReStream to no available..
goddamn, I hate DVD :(
pitch.fr
29th August 2008, 10:08
ffdshow has a lot of deinterlacers. TomsMoComp, 5-tap lowpass and kernel deinterlacer are good. If they do not satisfy you, install DScaler and load their deinterlacers via ffdshow. If that also do not work for you, ditch ffdshow, enable DXVA (with Microsoft codec or Cyberlink PowerDVD) or set the interlaced flag in the MPC-HC decoder and let the video card do it for you.
if those steps above do not work, you really need to use Avisynth. For DVD, real-time processing should be doable.
well "5-tap lowpass and kernel deinterlacer" still make ugly artefacts...
TomsMo with a search effort of 0 seems to work pretty well, even though there is still some combing......but I get full vertical resolution :)
I've tried to open the Dscaler plugins in ffdshow, but I'm interested in the DI_* and ffdshow can only open the FLT_*
LoRd_MuldeR
29th August 2008, 21:32
well "5-tap lowpass and kernel deinterlacer" still make ugly artefacts...
Try Kernel Bob with a threshold of 5 or even 3. Also "DScaler: Greedy 2 Frame" is worth a look. But still Yadif Bob beats them both...
pitch.fr
29th August 2008, 22:11
ok thanks for the reply.
well atm I've got this in ffdshow :
1)deinterlace
2)resize to native res in spline
3)lsf/Ulevels/DDCC in the avisynth filter
doing deinterlace in AVS after resizing is not a good idea I think, besides Yadif seems to suck too much CPU
how do u guys use Dscaler Deinterlace filters in ffdshow ? I don't understand :(
ffdshow can only open the FLT_* Dscaler plugins, but the deinterlacing plugins are DI_*
LoRd_MuldeR
29th August 2008, 22:26
1. You must always deinterlace before resizing, otherwise you get complete crap!
2. ffdshow lists all DSclaer Deinterlacers, you must simply tell ffdshow your DScaler install folder...
3. What about Kernel Bob ???
http://img222.imageshack.us/img222/6589/ffdscaler2td3.png http://img385.imageshack.us/img385/2300/ffdscaleris6.png
pitch.fr
29th August 2008, 23:12
ahhhhhhhhhh, I overlooked that I guess :D
yeah, that's what I thought you have to deinterlace prior to resize.
but you can't resize and keep the AR intact in AVS, can you ?
anyhow, thanks to you I've found a lot of new toys to play around with :p
LoRd_MuldeR
29th August 2008, 23:15
but you can't resize and keep the AR intact in AVS, can you ?
Why not? If you multiply the width and the height with the same factor, then the AR won't change!
e.g. 320x240 -> 640x480 -> 800x600 -> 1024x768 -> 1280x960 ...
pitch.fr
30th August 2008, 00:20
yeah but I mean "automatically"
at this point I got ffdshow resize set to 1280*720 with "keep OAR" checked.
if I resize in Avisynth, there's no way to enforce the OAR, is there ?
or maybe with ffdshow_dar_x/ffdshow_dar_y ?
http://ffdshow-tryout.sourceforge.net/html/en/avisynth.htm
ok Kernel Bob seems to suck too much CPU, and the artifacts look pretty ugly.
and If I use the Dscaler plugins, I cannot add the ffdshow resize filter afterwards....or I get a black screen.
the built-in mocomp looks pretty good when set to 0/vertical filter :)
still some combing, but the best results I've seen so far.
and the damn video is 720*480, when resized to 1024*768 it doesn't fill the screen horizontally....I have to stretch it one notch(but HR makes ghost lines on ATi cards)
ranpha
30th August 2008, 06:58
I think you should run the Yadif Avisynth before resizing, instead of the ffdshow deinterlace--->resize--->Avisynth chain that you are using now. With Q6600 overclocked, there is no way you will fail to do that properly.
pitch.fr
30th August 2008, 17:57
if there was a way to enforce the ffdshow OAR, that might sound like a plan :)
Snowknight26
30th August 2008, 19:14
Try Kernel Bob with a threshold of 5 or even 3. Also "DScaler: Greedy 2 Frame" is worth a look. But still Yadif Bob beats them both...
I just tested Yadif(mode=1) and it made some pretty major artifacts.
pitch.fr
30th August 2008, 19:23
yeah I also tried it on some 29.97 interlaced HD bits :D
Leak
30th August 2008, 20:34
if there was a way to enforce the ffdshow OAR, that might sound like a plan :)
Unless you change the aspect ratio using the ffdshow_setDAR(x,y) function AviSynth will use the input aspect ratio as the output aspect ratio.
If you resize equally in both directions this should be exactly what the doctor ordered. If you resize differently, you'll have to do the math and calculate the proper output ratio yourself and set it with ffdshow_setDAR()...
np: 808 State - In Yolk (Quadrastate)
pitch.fr
30th August 2008, 20:40
if I do
spline36resize(1280,720)
AR is ignored, so 4:3 source material is horizontally stretched.
is there a way to enforce the ffdshow OAR ?
LoRd_MuldeR
31st August 2008, 14:25
I just tested Yadif(mode=1) and it made some pretty major artifacts.
I'm yet to see the first combing artificial with Yadif. Maybe you used incorrect field order?
Snowknight26
31st August 2008, 22:46
http://www.stfcc.org/misc/yadif.png
http://www.stfcc.org/misc/mcbob.png
Left side instruments close to the edge of the picture.
LoRd_MuldeR
1st September 2008, 00:27
http://www.stfcc.org/misc/yadif.png
http://www.stfcc.org/misc/mcbob.png
Left side instruments close to the edge of the picture.
Well, I see some kind of (very minor) interpolation artifacts in the Yadif version, but I do not see any combing artifacts!
In my previous post I was speaking about combing artifacts. Combing artifacts look like this (see the hand in the pic below) and you often see them with Kernel Deint/Bob and even TDeint.
You never see that kind of artifacts with Yadif. There are other (less annoying) artifacts though...
http://guru.multimedia.cx/wp-content/kerndeint.jpg
While the "mcbob" version of your sample definitely looks better, can it work in real-time on a "normal" system? Yadif can! (~15% CPU usage on my Q6600)
Snowknight26
1st September 2008, 00:49
The artifacts did look much like those but way smaller. Shows you how much I know about the different artifact types. :p
And no, MCBob runs at about 10fps on my rig. :\
LoRd_MuldeR
1st September 2008, 00:59
"Combing" artifacts occur when the deinterlacer detects an area to be static (no motion) and thus simply weaves the fields (pass-through), although there is motion in that area in fact. As a result the fields (odd lines and even lines) don't match and cause those comb-like artifacts. It's exactly the same artifacts you see all over the image when not using a deinterlacer at all (see picture below). And those artifacts have a "dimension" of exactly one line, not more and not less. Of course they can happen across several lines. In contrast to "combing", the artifacts in your sample (Yadif version) apparently are the result of Yadif trying to interpolate the "missing" lines. So Yadif does detect the motion properly, it only doesn't interpolate as nice as "mcbob" does (in this specific sample).
http://100fps.com/distortion2.jpg
STaRGaZeR
1st September 2008, 03:24
What about using "Set interlace flag in output media type" and Method to "Bob"? After trying ATi's vector adaptive deinterlacer I can only say: forget about ffdshow deinterlacers (and software deinterlacers in general), use hardware ones if you can. Absolutely 0 artifacts, 0 combing, the image is just perfectly deinterlaced. And no extra CPU usage whatsoever.
LoRd_MuldeR
1st September 2008, 03:56
The last time I tried to use "Hardware Deinterlacing", it didn't deinterlace at all with any Video Renderer, except for the Overlay Mixer.
Also it looked like "dumb" bobbing, giving ugly flickering in all static areas -- I tried all Deinterlace settings in CCC, including "vector adaptive" and "auto" mode.
So far, the most satisfying "real-time" deinterlacer for me is Yadif, followed by KernelBob and Greed2Frame.
wozio
1st September 2008, 09:47
Output color space must be set NV12 for hardware deinterlacing to work best. It gives me really good results.
STaRGaZeR
1st September 2008, 10:33
The last time I tried to use "Hardware Deinterlacing", it didn't deinterlace at all with any Video Renderer, except for the Overlay Mixer.
Also it looked like "dumb" bobbing, giving ugly flickering in all static areas -- I tried all Deinterlace settings in CCC, including "vector adaptive" and "auto" mode.
So far, the most satisfying "real-time" deinterlacer for me is Yadif, followed by KernelBob and Greed2Frame.
Use NV12 colorspace as wozio says. I don't know what card you have, but since the HD2000 series of cards it's just perfect.
pitch.fr
1st September 2008, 10:35
What about using "Set interlace flag in output media type" and Method to "Bob"? After trying ATi's vector adaptive deinterlacer I can only say: forget about ffdshow deinterlacers (and software deinterlacers in general), use hardware ones if you can. Absolutely 0 artifacts, 0 combing, the image is just perfectly deinterlaced. And no extra CPU usage whatsoever.
yeah, but no more ffdshow post-processing because deinterlace has to be done prior to anything else.
I've already used hardware IVTC, and it worked pretty well.
so anyone knows how to resize to 1280*720 and keep the OAR in Avisynth ?
LoRd_MuldeR
1st September 2008, 15:23
Use NV12 colorspace as wozio says. I don't know what card you have, but since the HD2000 series of cards it's just perfect.
It's an old "Radeon X1950 Series" card. However NV12 seems to do the trick -- thanks for the tip :thanks:
BTW: Do you have any experience how "save" hardware deinterlacing is for "film" material? I ask because I can't turn it off as easy as I can toggle SW deinterlace...
yeah, but no more ffdshow post-processing because deinterlace has to be done prior to anything else.?
Well, "color correction" filters should be safe to use before deinterlace. I'm not so sure about "sharpen" filters, as they might amplify the combing and thus effect the deinterlacer. Using a "soften" or "resize" filter before deinerlace will almost certainly destroy the video! However there is a simple trick to apply any filter before deinterlace: StackFields -> SomeFilter -> UnstackFields -> Deinterlace ...
STaRGaZeR
1st September 2008, 21:27
It's an old "Radeon X1950 Series" card. However NV12 seems to do the trick -- thanks for the tip :thanks:
BTW: Do you have any experience how "save" hardware deinterlacing is for "film" material? I ask because I can't turn it off as easy as I can toggle SW deinterlace...
This is pure speculation, so don't quote me on this one :p
For what I've seen, if you want some sort of hardware assistance you need something like a direct path to it. Like when you use DXVA. I don't know why, but as you can see from numerous DXVA compatibility checkers both NVIDIA and ATI cards use the NV12 colorspace for their DXVA abilities. So we can conclude that when you use NV12 you are creating an output that is compatible with all the hardware postprocessing options and video acceleration of the card. Maybe that's why they work with Overlay, because it's a renderer that is very close to the hardware layer.
Regarding your last question about film material I've experienced only one issue. The video is deinterlaced correctly, but it's a bit "jumpy" in certain scenes. This only happens with telecined material, and it may vary depending on the source. I prefer the jumps over the artifacts, so I use HW deinterlace always. No problems with European DVDs or DVB.
LoRd_MuldeR
1st September 2008, 21:33
Since I want to be able to enable/disable the deinterlacing manually for Video/Film and I want to use software YUV -> RGB conversion for correct levels, I'll stick to Yadif software deinterlacing...
wozio
2nd September 2008, 09:01
Well as far as I know from reading, gpu deinterlacers handle almost every situation at least good, in benchmarks (hqv for example) they match high end deinterlacers. They handle film/video deinterlacing automatically without any problem. From my experience (x1650 pro) I have no problems with deinterlacing my gpu is much better than my samsung lcd tv. And I hate manuall switching setting when I change sources so for me all must be automatic.
I saw only one problem. For NTSC dvds frames are always rendered in 60 Hz regardless source if it is video or film. This gives problem with elecine judder. But it is quite normal for dvds, there is no dvd player that renders frames at 24 Hz.
Levels are handled correctly by current drivers so using RGB output from ffdshow is not needed.
IanD
12th October 2008, 02:46
It was my previous understanding that one required a software application to make use of DXVA hardware deinterlacing (eg PowerDVD), but you guys seem to be suggesting that the renderer will actually perform that function if ffdshow sets an interlaced flag and outputs in NV12 colourspace.
If this is true, how does one set the type of hardware deinterlacing to be performed (ie bob, weave, vector adaptive, pixel adaptive, etc) with Nvidia GPUs? It sounds like ATI has a control panel setting to determine this, but AFAIK Nvidia doesn't have an equivalent place to set the deinterlacing method to be used.
LoRd_MuldeR
12th October 2008, 03:11
Well, the video decoder (e.g. ffdshow) can keep the video interlaced and label the outgoing video stream as "interlaced". In that case the next filter in the chain might (or might not) respect the "interlaced " flag and take care of the deinterlacing. If the next filter is a video renderer, then "hardware" deinterlacing will be used. Not sure which renderers support this though - try VMR7, VMR9 or Overlay Mixer. The method that will be used for "hardware" deinterlacing depends on the video hardware and on the drivers. If the Nvdida drivers don't offer any options, I'd assume there is no way to choose between different methdos (except for registry hacks maybe ?!?). However if no method is specified, then "dumb" bobbing will be used most likely...
wozio
13th October 2008, 14:28
As for the ati and I believe nvidia is the same in this matter, drivers automatically switches between deinterlacing methods on the fly. One thing must be noted: each individual frame is marked as interlaced or progressive not only stream as a whole. This info comes from decoder and allows drivers to decide if to deinterlace frame or not.
Basically thee is no need to set deinterlacing method manually, set it once to best method and forget. Both ati and nvidia has options in driver control panels to manually control deinterlacing if someone want to tweak it anyway. In ati it is usefull since pulldown detection is off by default.
IanD
14th October 2008, 10:03
As for the ati and I believe nvidia is the same in this matter, drivers automatically switches between deinterlacing methods on the fly. One thing must be noted: each individual frame is marked as interlaced or progressive not only stream as a whole. This info comes from decoder and allows drivers to decide if to deinterlace frame or not.
Basically thee is no need to set deinterlacing method manually, set it once to best method and forget. Both ati and nvidia has options in driver control panels to manually control deinterlacing if someone want to tweak it anyway. In ati it is usefull since pulldown detection is off by default.
Maybe the drivers do switch between film and video mode automatically, but unless they default to the best supported deinterlacing method of the card (which I doubt), then there must be a way provided to set the deinterlace method. AFAIK, Nvidia doesn't have a way to set the deinterlace method in the driver.
You mention setting deinterlace method to best, once, and then forgetting about it. Unless I have missed something, Nvidia doesn't provide this option in the driver control panel.
As for manually controlling deinterlacing, Nvidia only has an IVTC option. I consider IVTC to be far more than simply turning deinterlacing on or off, so it seems as though Nvidia doesn't provide a tweaking ability to the consumer to determine important fine settings for how deinterlacing is supposed to operate.
My understanding is that ATI exposes all the controls one way or another, but Nvidia is very different.
wozio
15th October 2008, 08:42
OK, maybe nvidia doesn't expose deinterlacing options in control panel but why you would want to change it? I assume that when nvidia doesn't expose setting in control panel that means it is always set ot best method, or only one method is implemented.
I never change deinterlacing options in ati control panel just because it is set to best method and why would I want it different?
Actually I try today to check what effect changing these settings gives on ati. I never did this ;)
IanD
18th October 2008, 15:30
I don't seem to be able to use hardware deinterlacing with MPC and the ffdshow interlaced method when playing back a DVD structure: MPC always uses the internal mpeg decoder filter (low merit), even if mpeg2 has been disabled in the internal filters.
If I try playing back a vob from the DVD structure, ffdshow gets used.
Leak
18th October 2008, 18:24
If I try playing back a vob from the DVD structure, ffdshow gets used.
Have you checked the "DVD decoding" checkbox that appears below the codecs list when you select the MPEG2 line in ffdshow's configuration panel?
It's disabled by default IIRC, and without it ffdshow (not surprisingly) won't decode DVDs...
np: The Matthew Herbert Big Band - The Yesness (There's Me And There's You)
IanD
19th October 2008, 07:54
Have you checked the "DVD decoding" checkbox that appears below the codecs list when you select the MPEG2 line in ffdshow's configuration panel?
It's disabled by default IIRC, and without it ffdshow (not surprisingly) won't decode DVDs...
No, I didn't even realise it was required: had thought ffdshow would just use the standard DVD navigator filters that most other directshow codecs use.
I must be using an old version of ffdshow, because it says DVD Decoding (not working yet). What version is recommended at the moment?
Okay, I seem to have it working, but I had to set the ffdshow HW deinterlacing method to Weave as Bob looked very bobbed.
How does one tell if hardware deinterlacing is being used and which method is being applied?
Leak
19th October 2008, 12:11
No, I didn't even realise it was required: had thought ffdshow would just use the standard DVD navigator filters that most other directshow codecs use.
That's up to the player app you're using, the "DVD decoding" checkbox just toggles whether ffdshow accepts MPEG2 video streams coming from a DVD (which have their own GUID) - navigation filters et al come long before that.
I must be using an old version of ffdshow, because it says DVD Decoding (not working yet). What version is recommended at the moment?
I've been using ffdshow-tryouts beta 5 (build 2033) (http://sourceforge.net/project/showfiles.php?group_id=173941&package_id=199421) for some time now.
Okay, I seem to have it working, but I had to set the ffdshow HW deinterlacing method to Weave as Bob looked very bobbed.
How does one tell if hardware deinterlacing is being used and which method is being applied?
One thing you need to do is select just the NV12 colorspace on the Output page in ffdshow, or you'll likely get dumb bobbed video output instead of any advanced hardware deinterlacing.
"Weave" is just shorthand for "don't apply any deinterlacing at all", so if the video is fine that way you shouldn't have to deinterlace at all...
np: New Order - Elegia (Low-Life)
IanD
20th October 2008, 03:19
One thing you need to do is select just the NV12 colorspace on the Output page in ffdshow, or you'll likely get dumb bobbed video output instead of any advanced hardware deinterlacing.
I was using just NV12, but with Bob set, it looked terrible as though the field order was permanently reversed: much worse than even a Bob should look. Changing to Weave and it looked perfect.
The other thing I noticed was that MPC said the DVD was 720x480 60Hz, but the renderer output pin said 25fps. I'm running my Nvidia 7600GS at 75Hz refresh as it seems to give the best overall result for both PAL and NTSC sources, so could this be having an effect? I can change it to 72Hz refresh if required.
pitch.fr
24th November 2008, 03:23
I've tried YADIF from within ffdshow on some 29.97 NTSC DVD, and the result was pretty poor :(
TomsMoComp seems to achieve better results, even if not perfect.
LoRd_MuldeR
24th November 2008, 03:29
I've tried YADIF from within ffdshow on some 29.97 NTSC DVD, and the result was pretty poor :(
TomsMoComp seems to achieve better results, even if not perfect.
Did you check the "Double Framerate" option? With that option checked, you will get MUCH smoother motion compared to TomsMoComp...
(BTW: Sure your NTSC DVD is "true" interlaced and not telecined?)
pitch.fr
24th November 2008, 10:40
yes it's interlaced.
well double framerate is not quite an option, as I'm using several AVS scripts in ffdshow and I can't quite process 59.94 fps..
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.