Help - Search - Members - Calendar
Full Version: Smart deinterlace filters for VirtualDub
Hydrogenaudio Forums > Digital Audio/Video > General A/V
tigre
Hi.

The title says it all.

I transcode DV video (720x576, interlaced) to DivX 5.1 with VirtualDub for PC playback, mostly dance rehersals / performances with a lot of movement (see my avatar wink.gif ).

So far I know use a filter called "Deinterlace MAP" with default settings. Any advices how to improve (qualtiy improvements preferred, speed improvement at identical quality would be OK too).

Thanks for your answers.

Cheers tigre
Linkin
afaik the best deinterlace filter is the standard deinterlace that comes with virtualdub with the mode 'blend fields together'...but i would recommend using avisynth as a frameserver.

edit: i just found out that it depends on what dv you have. if you have dv type-2 you just use virtualdub, but if you have dv type-1 avisynth usage is recommend.
mobius
Avisynth has more powerful deinterlacing filters, so it's probably a better way to go than using the default virtualdub filter. Also blending fields in high motion scenes isn't the best way to go. I usually do it because I'm lazy and don't mind a little ghosting.

Here's an excellent page on deinterlacing:

http://100fps.com

Basically, it is suggested that you throw away a field to preserve crispness, or even better, convert the fields to frames for a nice 60p (or 50p) video.


Hope this helps,

mobius
Linkin
indeed interesting page about deinterlacing...

another method would be if you do not deinterlace at encoding, but at decoding with ffdshow. but i don't know how good divx handles interlaced material.
Continuum
QUOTE(Linkin @ Nov 12 2003, 07:18 PM)
but i don't know how good divx handles interlaced material.

Well, Xvid has a switch for interlaced material in the settings. It does cost some bits extra to encode interlaced video, though.
Linkin
QUOTE(Continuum @ Nov 12 2003, 07:02 PM)
QUOTE(Linkin @ Nov 12 2003, 07:18 PM)
but i don't know how good divx handles interlaced material.

Well, Xvid has a switch for interlaced material in the settings. It does cost some bits extra to encode interlaced video, though.

sure xvid has that switch...but tigre is saying that he uses divx 5.1...
getID3()
DivX can both encode interlaced material, or optionally deinterlace the video during encoding.

So first I'd try encoding with no deinterlace filter and only use the DivX codec to deinterlace (Options | Video | Advanced | Deinterlace All Frames). That should be the fastest option, and you can easily check how the quality compares with what you have now.

I also like Donald Graft's "Smart Deinterlace" filter for VirtualDub. You have a number of choices of what deinterlacing method to use:
http://neuron2.net/smart.html

But for encoding from an interlaced DV source, I'd recommend you try the DivX deinterlace method first.
Linkin
if you have no special reason for using divx i would xvid give a try. it is faster than divx 5.1 and it's free...and, at least for me, it looks better...
tigre
Thanks for your answers.

To clarify what I'm talking about here's a picture:
user posted image.


QUOTE(Linkin @ Nov 12 2003, 06:44 PM)
afaik the best deinterlace filter is the standard deinterlace that comes with virtualdub with the mode 'blend fields together'
As visible on the picture, 'Blend fields together' gives good results on still or slightly moving areas (e.g. the dancer's top), but moving areas are unsharp/smeared or even doubled (if the camcorder's shutter speed is high). Moving areas (like the arm) look better using "Dublicate filed 1" (or field 2), but OTH still areas have lower (vertical) resolution/get stairs (top).

Smart deinterlace filters ideally perform "Blend fields together" in still areas and "Dublicate filed 1" in moving areas. As one can see in the 4th picture, the filter called "Deinterlace MAP" performes good on the moving area and is an improvement in the still area compared to "Dublicate field", but could be better there.

QUOTE
edit: i just found out that it depends on what dv you have. if you have dv type-2 you just use virtualdub, but if you have dv type-1 avisynth usage is recommend.
I don't know the difference between type 1 and 2 - and I don't know what avisynth does. Can someone explain, please?

QUOTE(mobius @ Nov 12 2003, 06:56 PM)
Here's an excellent page on deinterlacing:

http://100fps.com
"Kylie's gay dentist" laugh.gif Good page indeed.

QUOTE
or even better, convert the fields to frames for a nice 60p (or 50p) video.
I have some concerns about how much processing power is needed for playback (I'd like to use 640x480 resolution for DivX), so 50fps could cause trouble on not-so-fast PCs compared to 25fps - or no?

QUOTE(Linkin @ Nov 12 2003, 07:18 PM)
another method would be if you do not deinterlace at encoding, but at decoding with ffdshow. but i don't know how good divx handles interlaced material.
As I don't want to create the avis at full DV resolution, this doesn't work, does it?

QUOTE(Continuum @ Nov 12 2003, 08:02 PM)
Well, Xvid has a switch for interlaced material in the settings. It does cost some bits extra to encode interlaced video, though.
What exactly happens if I use this switch - can I resize without trouble? And what kind of deinterlacing is performed on playback?
@Linkin: Using XviD or anything else that gives similar quality at comparable size is OK for me.

QUOTE(getID3 @ Nov 12 2003, 09:01 PM)
So first I'd try encoding with no deinterlace filter and only use the DivX codec to deinterlace (Options | Video | Advanced | Deinterlace All Frames). That should be the fastest option, and you can easily check how the quality compares with what you have now.
Thanks. I'll do that. I'll have to find out if I can resize too directly. (Good idea to resize after deinterlacing. wink.gif )

QUOTE
I also like Donald Graft's "Smart Deinterlace" filter for VirtualDub. You have a number of choices of what deinterlacing method to use:
http://neuron2.net/smart.html
I have this one already installed, but after having tried ~ 20 different settings success I gave up. Any recommendations?

QUOTE(Linkin @ Nov 12 2003, 09:16 PM)
if you have no special reason for using divx i would xvid give a try. it is faster than divx 5.1 and it's free...and, at least for me, it looks better...
I'll give it a try. I haven't used it for quite a while. What version do you recommend? The stable avail. at doom9 or some beta/alpha?
Latexxx
Do it as 50/60 Hz but use half height resolution (like 640/320) and resize it to the real aspect ratio on playback.
tigre
QUOTE(Latexxx @ Nov 12 2003, 09:33 PM)
Do it as 50/60 Hz but use half height resolution (like 640/320) and resize it to the real aspect ratio on playback.

That sounds like a really good approach. Only question I have: How do I resize it to the real aspect ratio on playback? I mean is there any way to add the "real aspect ratio" information to the file (like a tag) so every player on someone else's PC resizes it automatically?
Continuum
QUOTE(tigre @ Nov 12 2003, 09:30 PM)
QUOTE(Continuum @  Nov 12 2003, 08:02 PM)
Well, Xvid has a switch for interlaced material in the settings. It does cost some bits extra to encode interlaced video, though.
What exactly happens if I use this switch - can I resize without trouble? And what kind of deinterlacing is performed on playback?

AFAIK it just makes use of the information that the input is interlaced (thus increasing codec efficiency). The video is stored with the interlace stripes, so you have to take care of deinterlacing at playback time (e.g. use ffdshow) or use a device that supports interlaced video (like your TV). Resizing is only possible if it respects the half frame structure, that is it resizes half frames separately
Continuum
QUOTE(Latexxx @ Nov 12 2003, 09:33 PM)
Do it as 50/60 Hz but use half height resolution (like 640/320) and resize it to the real aspect ratio on playback.

This is good for temporal resolution, but you loose vertical resolution on static scenes (even on interlaced material!).
niktheblak
Ah, deinterlacing, my favourite smile.gif

There exists many good smart deinterlacing filters, but due to the guesswork involved in the deinterlacing process, some deinterlacers work better with some material than others. You're handling PAL DV material which is relatively easy; true deinterlacing hell starts with poor NTSC-PAL (or vice versa) conversion of interlaced material, and of course material with mixed progressive and interlaced frames.

Whereas the idea of keeping and encoding the material in interlaced format is a good one, it's also the more difficult one. If the video is to be watched with a progressive scan device, such as a computer monitor, it has to be deinterlaced during the decoding process. This just shifts the trouble of deinterlacing to the viewer; if the viewer doesn't have ffdshow or a similar utility, the clip is going to be a pain to watch. Also, a proper setup of displaying interlaced material on TV using a computer's TV-out is very difficult to set up. To my knowledge, it's only possible with Matrox cards.

If you plan to stick with VirtualDub filters, I too recommend Donald Graft's Smart Deinterlacer. For AviSynth Tom Barry's TomsMoComp and Donald Graft's Decomb are excellent choices.

You could compare different deinterlacing algorithms before encoding easily with ffdshow since it can decode DV material directly.

Good luck for your encoding wink.gif
niktheblak
QUOTE(tigre @ Nov 12 2003, 10:30 PM)
I'll give it a try. I haven't used it for quite a while. What version do you recommend? The stable avail. at doom9 or some beta/alpha?


Koepi's alpha builds have always been pretty good, and the current 24.06.2003 build is rock stable. Give it a shot, these binaries come with a tutorial called "Xvid options explained."

Koepi's builds are available at Koepi's New Media Development
Kblood
Well, for once I can add something useful...

As some people have said before, Avisynth is, in my opinion, the way to go.

It is some sort of VirtualDub without interface, controlled by scripts. It is a "driver" that allows text files with extension .avs to be interpreted as video files by (almost) any video player or editing software. It is said to be faster than VirtualDub, and there are really interesting filters available for it.

I used in the past GreedyHMA, and it did a nice job, without much hassle. Decomb is said to be a miracle maker, but I never was in need for it.

It is quite easy to find information on it: behold the wiki!

Have fun, it is a really interesting tool.

Edit: At trbarry's webpage he says himself that Decomb pretty much supercedes GreedyHMA, and TomsMoComp looks really interesting indeed...
tigre
QUOTE(niktheblak @ Nov 13 2003, 12:39 AM)
Whereas the idea of keeping and encoding the material in interlaced format is a good one, it's also the more difficult one. If the video is to be watched with a progressive scan device, such as a computer monitor, it has to be deinterlaced during the decoding process. This just shifts the trouble of deinterlacing to the viewer; if the viewer doesn't have ffdshow or a similar utility, the clip is going to be a pain to watch.

That's a very good point. Probably I will store interlaced full resolution high-bitrate versions for my own use (+ archiving) anyway, but if I want others (non-techies) to watch my clips, this needs to work like "insert CD -> doubleclick on clip.avi -> watch". Besides this I want to resize, so storing interlaced is not an option.

QUOTE
If you plan to stick with VirtualDub filters, I too recommend Donald Graft's Smart Deinterlacer. For AviSynth Tom Barry's TomsMoComp and Donald Graft's Decomb are excellent choices.
I'd prefer to try if I get satisfying results with Donald Graft's Smart Deinterlacer before starting to work with a to me so far unknown program. There are many options and I'll start searching + trying, but If anyone could point me to some kind of setup guide or could recommend settings for Smart Deinterlacer I'd appreciate it.

QUOTE
You could compare different deinterlacing algorithms before encoding easily with ffdshow since it can decode DV material directly.
. Good idea. I've just installed ffdshow, but I had already a DV directshow filter installed (don't remember which one), which is still used for DV playback. How can I tell Windows to use ffdshow instead?
niktheblak
QUOTE(tigre @ Nov 13 2003, 02:16 AM)
I'd prefer to try if I get satisfying results with Donald Graft's Smart Deinterlacer before starting to work with a to me so far unknown program. There are many options and I'll start searching + trying, but If anyone could point me to some kind of setup guide or could recommend settings for Smart Deinterlacer I'd appreciate it.


I'd say you can pretty decent results with Smart Deinterlacer. As I said, DV material isn't that hard to deinterlace.

If you still want to research AviSynth say, for fun, a good place to start is AviSynth homepage. They have a complete scripting guide in there with plenty of examples.

Every necessary filter for avisynth can be found at AviSynth filter collection, or directly at Donald Graft's site or Tom Barry's site. The filter distribution packages usually include a tutorial with simple examples.

I unfortunately can't help you with Smart Deinterlacer's settings, since I mostly use the AviSynth stuff. Donald's homepage might have some tips.

QUOTE
How can I tell Windows to use ffdshow instead?


You can set ffdshow's codecs in it's configuration panel. Normally at Start menu, Programs, ffdshow and "Configuration". Then "Codecs" from the left side of the panel, scroll to "DV" and set it to "libavcodec".
kl33per
QUOTE
For AviSynth Tom Barry's TomsMoComp and Donald Graft's Decomb are excellent choices.

I personally really like Donald's Decomb filter as it gives pretty decent results in almost all circumstances. It comes with a half decent tutorial for making it work to. Remember to always deinterlace before you resize. I've heard Tom Barry's filter is pretty good as well, although I've never used it personally.
Linkin
If you are still interested in XviD this might help:

http://webcounter.goweb.de/52555LINK-9&htt...ver20030702.pdf
smok3
edit: allready mentioned smart deiterlacer, so nm.
sh0dan
Donald Graft's KernelDeInt also derserves a mention. I have a clear preference on this, when dealing with "natural" (non-anime/cartoon) images.

It provides very good sharpness and very few artifacts - especially with thresholds around 4-7.

Of course this only goes for pure interlaced (non-telecined) material.
harashin
I don't use VirtualDub's own plug-ins.
I prefer Avisynth filters like AutoDeint which is included in WarpSharp.

example:AutoDeint("")

If you also need IVTC try
Auto24FPS(true,24,16,"",false) (included in WarpSharp)

WarpSharp needs msvcp70.dll and msvcr70.dll. Download at http://www.dll-files.com/ if you don't have them.
avih
hi there fellow video comerads wink.gif iirc, that's my 1st post here, so, hya all wink.gif

i always prefere to preserve the video as close to the source as possible.

obviously, keeping the video interlaced is closest to the source, and brings the generated distortions to minimum, which usually also reduces the required bitrate (per quality). that is' AS LONG as the encoding codec is aware of the interlaced nature of the clip, and can handle it properly (Xvid was mentioned here, and indeed, xvid is able to encode interlaced material properly. and no, it doesn't deinterlace, it only compresses better under the knowledge that it's interlaced, if the relevany checkbox is checked).

one obvious consequence of keeping the encoded video interlaced is that the video is.. ermmm.. interlaced, which causes interlacing artefacts when played on a progressive display (i.e. most normal PC monitors these days). so, one needs to deinterlace the video in real time during playback. DScaler, the win32 TV-viewer ( http://deinterlace.sf.net ) has been able to get excellent results in this area for some time now, but it can only handle TV input (BTxxx chips). however, it has a plugin system, and other projects can use it's DLLs to deinterlace.

one known decoding app for windows is ffdshow, which was mentioned on this thread as well. since some time now, it's able to use these dscaler plugins (among other, inferior imho, deinterlacing methods) effectively.

so what do i recommend? (ONLY if the source material is interlaced, and it's important to keep the hi-motion info, usaually- sports, or wedding clips wink.gif )

1. encode your video interlaced (be aware of your vertical resizing method, it's crucial when the video is interlaced). i.e. xvid can suport interlaced material.

2. playback with a system that can deinterlace in real time. in win32 i recommend ffdshow ( http://ffdshow.sf.net ) using the DScaler plugins (start with the simplest and most theoretically correct method: bob). i know that mplayer (*nix/win32) can support interlaced material, but i haven't tried deinterlacing video with it yet.

what do you gain by using the above method?
1. the clip stays closer to the original.

2. usually less bitrate, since preserving the whole content while deinterlacing generates either extra distortions or extra bits.

3. you'll still be able to play your interlaced content on tv natively.

good luck wink.gif
avih
kennedyb4
I capture with a DC-10+ at 6000kbps mjpeg.

For true interlaced material I fing deinterlace MAP to work the best with the default settings.

Its a bit slower but so are all the filters I have tried. It has worked perfectly for me in circumstances where smart de-interlace has failed.

I even use it on some telecined material with what I think are pretty good results.

It works well with smart smoother especially as long as the thresholds are set low. Trying to sweep out all the noise always leaves me with something tha looks too digitized and obviously processed.

$.o2
Continuum
QUOTE(avih @ Nov 14 2003, 06:21 PM)
2. usually less bitrate, since preserving the whole content while deinterlacing generates either extra distortions or extra bits.

What is a reasonable bitrate for full-PAL interlaced capture? I'm experimenting with Xvid at ~2000 kbit which would give me five hours per DVD+R, but the results are not always good. Maybe this is caused by the noise from my capture card? unsure.gif
fccHandler
I recently discovered the PeachSmoother filter for Avisynth, and was blown away! For noisy captures and VHS, this filter can cut your required bitrate nearly in half, and barely increases the encoding time at all. (It also works with interlaced video.) I can't say enough good things about it. Give it a try! smile.gif
Continuum
Did you use the default settings? How does this filter compare to 3Dconvolution?

I'm still experimenting, but the quality gain seems to be rather small here... tongue.gif
Latexxx
QUOTE(Continuum @ Nov 16 2003, 10:02 AM)
Did you use the default settings? How does this filter compare to 3Dconvolution?

Last time I heard of it, it was convolution3d. laugh.gif
fccHandler
QUOTE(Continuum @ Nov 16 2003, 01:02 PM)
the quality gain seems to be rather small here...

I used it with the default settings, and XviD encoding in 1-pass quantizer mode, but I wasn't aiming to improve the quality (I've come to believe that's kind of an impossible dream). My primary concern was finding a filter to help reduce the bitrate without hurting the quality. The bitrate did reduce by a huge amount when I added PeachSmoother, and I could see no visible artifacts from the filter (unlike some other NR filters). But as always, YMMV...

P.S. I've never used convolution3d, but I will certainly try it. smile.gif
niktheblak
QUOTE(fccHandler @ Nov 17 2003, 05:00 AM)
P.S.  I've never used convolution3d, but I will certainly try it. smile.gif

Go ahead, there are simple presets for operation with "movieHQ" being the most common. The additional benefit of Convolution3d versus PeachSmoother is that the former supports YV12 colourspace; when doing the encoding in YV12 format (such as DVD-to-MPEG4) you gain about 30% encoding speed.

On the other hand Convolution3d is very slow, so that pretty much negates the speed increase smile.gif
tigre
Thanks for the answers. It seems like this thread develops to a valuable resource.
Anyway, since I didn't want to spend much time on figuring out how avisynth works this time, I did some tests with Vdub Smart Deinterlace filter. I got the best results with these settings:
[x] Frame-nly differencing
[x] Use cubic for interpolation
[x] Motion map denoising
Motion treshold: 8 (higher values resulted in remaining interlace artifacts in low contrast background areas)
Scene change treshold: 100 (no scene changes in the clips I encoded)

As recommended I used XviD. Settings: Quality-based (95%), 1-pass.

Next time I'll probably try avisynth. - Anyway, from my understanding how smart deinterlacing works (motion detection, discard 1 field and interpolate in moving areas, blend fields in still areas) I don't see much room for improvement over the result I got with Smart Deinterlace filter this time.
Kblood
Well, there is certainly room for improvement. One clear advantage that is very important in this case is that Avinsynth filter can work with a wider range of frames, that is, an Avisynth filter can look at future frames of the video, not only at the previous and current frames.

This is specially useful in deinterlacing.

Then again, I have this information in my head since quite a while, so I might be mistaken, and I would like something about this to be confirmed or corrected smile.gif
Artemis3
Hello: I got this information sometime ago off doom9's forums, i think before they switched forum software or something. It is a deinterlacing technique posted by an user with the nick "Morello". According to his findings, the following chaining of 2 filters seemed to provide the best results:

QUOTE
IMO the best/Ultimate settings for deinterlacing are:

1)Area Based Deinterlacer, edge detect 50, threshold 27
+
2)Smart Deinterlacer, fram and field differencing, blend, cubic, motion threshold 20, scene change 100, field swap before and after.


These are VirtualDub filters, i use Avisynth for other things (like cleaning the video), but you can load most virtualdub filters from avisynth as well, and i use exactly this same method when i need deinterlaced output. I use NTSC, and mostly capture from broadcast or VHS sources.


PS: Capturing at half vertical resolution is the same as dropping a field altogether, and capturing at double speed achieves the same thing of doing a normal capture and apply bob filter afterwards (except you won't need double space when capturing...).

PS2: My hardware is a Hauppauge WinTV-PCI 404 (BT878), i also have a studio DC10 almost new in its box, didn't like it, but i know how to use it... (forces you to use mjpeg and fixed res, like 640x480, at least with the original drivers).
tigre
QUOTE(Artemis3 @ Nov 19 2003, 09:31 AM)
IMO the best/Ultimate settings for deinterlacing are:

1)Area Based Deinterlacer, edge detect 50, threshold 27
+
2)Smart Deinterlacer, fram and field differencing, blend, cubic, motion threshold 20, scene change 100, field swap before and after.

I just tested these settings and the result was worse IMO than Smart Deinterlacer alone with the settings I used (Remaining visible lines in still/slooow moving areas, stairs in medium moving areas) . I also don't understand the sense of this approach theoretically. What happens should be this (correct me if I'm wrong):

There are 4 cases:

1. 1st filter detects motion, 2nd does too.
=> there's interpolation applied (seems like linear, not cubic resulting in stairs), then blending, resulting in unnecessary vertical smoothening is applied.

2. 1st filter detects motion, 2nd does not.
=> Like 1. but no blending, these areas will be sharper than "1." areas.

3. 1st filter doesn't detect motion, 2nd does.
=> On these hopefully not much moving areas blending is applied which should be OK

4. both filters don't detect motion
=> No processing. Hopefully the movement/brightness change is small enough to avoid visible lines.

This (espacially what happens in 1.) doesn't make much sense IMO. What would be best IMO:
A filter with 2 tresholds:

1. Fast moving areas: Discard 1 field + interpolate (cubic)

2. Medium to slow moving areas: Blend fields

3. No movement: No processing.

Ideally the should be somehow fluent transitions between the three ways of processing.
mobius
QUOTE(Kblood @ Nov 12 2003, 05:53 PM)
It is quite easy to find information on it: behold the wiki!

Broken down. Can anyone point to any other avisynth info?
i4004
QUOTE(fccHandler @ Nov 14 2003, 09:01 PM)
I recently discovered the PeachSmoother filter for Avisynth, and was blown away!  For noisy captures and VHS, this filter can cut your required bitrate nearly in half, and barely increases the encoding time at all.  (It also works with interlaced video.)  I can't say enough good things about it.  Give it a try! smile.gif

fcc,now tell everyone who loves peaches the best ( cool.gif )
(btw.now try to asses the noise manually and enter the numbers into peach settings;
CODE
#peachsmoother(readout = true, dot = true)  #noise estimation

if you already didn't...i also tried it like _separatefields()-peach-weave_....and I was impressed!)

@avih;how is xvid laced encoding compared to mpeg2?
if it's worthy i'll do the test(fields quality compared),but i'm not quite blown away with ffvfw's laced stuff (although i havent tried recent build of ffvfw)....
in fact i believe mpeg2 looked better...

@all;
vdub users should try graft's "smartdeinterlace" or thalin's "deinterlace area based"
avs users shoudl try graft's kerneldeinterlace....
(i have done quite an extensive tests with lots of screenshots,and these came as winners...MAP was not that good...)
be carefull NOT to use "use chroma" option in smartdeinterlace;it was ment for toons...(if that)

all of these filters are "clever" ie. they leave uncombed parts of the image alone..(to preserve their vertical resolution)

c3d?
don't bother for analog capturings.....very poor temporal denoising component...(last time i tried it..)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.