Log in

View Full Version : Equivalent of smart deinterlace in avisynth


Ryo94
20th April 2007, 02:41
I always used "smart deinterlace" and it worked perfect but since I've started to use avisynth (mainly because the speed) I'm wondering how to equal the results obtained with "smart deinterlace" using an avisynth deinterlace filter (I tried decomb with the line FieldDeinterlace() but I get an ugly ghost effect)

These is how I use "smart deinterlace"
http://img244.imageshack.us/img244/4094/picuu2.jpg (http://imageshack.us)

The file to process is an interlaced PAL capture, 640x480.

thanks in advance.

foxyshadis
20th April 2007, 05:54
TDeint, Yadif, or SmoothDeinterlace will get you similar results (probably faster or at least better too). LeakKernelDeint is sort of similar, and much much faster, but suffers from "threshold noise". There are other, even higher quality ones out there, but they're an order of magnitude slower.

Ryo94
20th April 2007, 08:28
Hi foxyshadis,
I tried TDient but is very much slower than Decomb or Smart Deinterlace (6fps) and the results are far to be good (probably I didn't set it rightly)
I get a crash with SmoothDeinterlace (VDub just close suddenly when load the script)
Otherwise LeakKernelDeint it worked very nice, probably better than Smart Deinterlace in terms of results and like you said it's faster, I get 13fps with LeakKernelDeint and 10fps with Smart Deinterlace (no other filters loaded, yeah my pc sucks :))

I tried LeakKernelDeint(Order=1) in a little segment, now I'll try it in the whole movie.
Thanks a lot for your help foxyshadis.

FredThompson
20th April 2007, 08:35
You can also load VirtualDub filters into AviSynth scripts. I don't do that, but it can be done.

Ryo94
20th April 2007, 09:37
Good to know it, thanks for the tip FredThompson.

Blue_MiSfit
20th April 2007, 09:38
If you're a sadist towards your computer, you could always try MVBob.SelectEven or SelectOdd... It's really really nice but murderously slow :)

Guest
20th April 2007, 13:41
I tried decomb with the line FieldDeinterlace() but I get an ugly ghost effect)
You can use this to stop the ghosting:

FieldDeinterlace(blend=false)

You should read the Decomb FAQ. Your issue is covered there.

Ryo94
20th April 2007, 20:26
Yep, my mistake, I should take a look to the FAQ, thanks neuron2.

Ryo94
21st April 2007, 03:57
I found a weirdness using Decomb & LeakKernelDeint.
With Decomb I get dup frames and with LeakKernelDeint I get not deinterlaced frames.
Samples (788KB)
http://rapidshare.com/files/27079099/videos.rar

The video deinterlaced with Decomb has frames 14-15 & 48-49 duplicate.
The video deinterlaced with LeakKernelDeint has frames 1 & 16 not deinterlaced.

I'm using one script with LeakKernelDeint(Order=1) and other with FieldDeinterlace(blend=false)

Any sugestion to to avoid this?
If this has not solution and considering the the problem with each one which deinterlaced is convenient to use?

thanks in advance.

Guest
21st April 2007, 04:02
Post the original, unprocessed video. Having your processed video is useless.

Ryo94
21st April 2007, 04:19
Thanks for reply, here it is:
http://rapidshare.com/files/27080910/unprocessed_video.rar

I see now that the dupes are in the source too :( .

frames duplicates:
29-30
78-79
109-110
120-121
126-127
132-133
147-148
181-182

foxyshadis
21st April 2007, 06:24
Two things: Your capture is field-shifted progressive, it's not truly interlaced and there's no need to deinterlace. You can use Telecide() or TFM() instead.

The duplicates are dropped frames. Take a look at the source in virtualdub, and notice the [D] on some frames. You missed quite a few in your list, too. You can't do anything about those, except get a better capture card, faster/dedicated disk, use a faster encoder like huffyuv (then you'll really need the faster disk), or just leave the computer alone if that's causing the problem. Playing with perfmon during a capture is the only way to tell.

If you can't recapture and have to fix these, you'll probably have to manually single them out and use some sort of compensation; take your pick between blending, motion compensation, or leaving duplicated.

My script:

AVISource("D:\unprocessed video.avi", pixel_type="YUY2")
AssumeTFF()
ConvertToYV12(interlaced=true)
TFM()

There's a lot of chroma problems too. Some come from the camera/editing?, some come from the capture, and some appear to be divx (xvid?) or the preprocessing screwing up the interlaced chroma. It's hard to tell, but working with interlaced chroma with tools that aren't meant to support it can be a huge pain.

Ryo94
21st April 2007, 07:29
Thanks a lot for your answer foxyshadis, you're more than clear. Regarding to the file it was captured from analog TV with an old ATI AIW 7200 in a old PATA HD and using divx 4.12, the only codec I could use cos his low cpu consumtion and even in this way I get 0.3% of frames dropped (I would like to use huffyuv or other lossless codec but unfortunaly don't have enough HD space).
So by the moment I'll use your script (:thanks:) instead decomb and leave the dupes, otherwise looks like I'll have to go for a new pc (my actual pc have 7 years old).

foxyshadis
21st April 2007, 07:51
Try capturing with xvid instead. (Divx 6 would work too, but not free.) The most important reason is that they have an interlaced mode, which will keep the colors from getting all smeared and washed out. Other settings: B-frames off, matrix mpeg, VHQ off, motion 1-4 depending on what's fast enough, chroma motion off. (The quality preset "realtime" forces some of this.) Capture to target quantizer, between 3 and 6 depending on how large you can handle and how fast your drive is. That should be fast enough to capture on your system, and probably in higher quality than old divx 4 could ever achieve.

Any second hard drive, even a pawned-off 40GB from a friend, makes a big difference compared to a single system+data drive, as long as they're on different IDE channels. If that's already what you're using, great.

Ryo94
21st April 2007, 08:58
I tried xvid (default settings) for capture in the past and I got almost 5% of frames droped so that's why I stick to divx 4.12 but I'll try it again with the settings that you mention, many thanks for the tip.
I tried your script but I get lot of these frames
http://img134.imageshack.us/img134/6419/15132395xx5.jpg (http://imageshack.us)
http://img145.imageshack.us/img145/3856/87243043tp2.jpg (http://imageshack.us)

Otherwise In previous scripts I used SwapUV() because the colors appear wrong when I open the file through avisynth (I read that's due to a divx bug), so I add SwapUV() in your script but doesn't work unless I remove "pixel_type="YUY2" from the first line (I really don't know if remove that line was correct, I completely newbie in avisynth)

LoadPlugin("C:\Plugins\TIVTC.dll")
LoadPlugin("C:\Plugins\FluxSmooth.dll")
AviSource("f:\movie.avi")
SwapUV()
AssumeTFF()
ConvertToYV12(interlaced=true)
TFM()
FluxSmoothT(4)

Ryo94
21st April 2007, 09:54
:eek: :eek: :eek: :eek: 10 minutes of capture in xvid using the settings that you recomend me (motion=4 High, B-frames off) and not a droped frame. To the hell with divx 4. Also I don't need to use SwaoUV() anymore in my scripts since the colors are right. Infinite thanks foxyshadis, you're the best.

Leak
21st April 2007, 10:18
Infinite thanks foxyshadis, you're the best.
Careful there... :D

(Just kidding... ;))

np: Radiohead - High And Dry (The Bends)