View Full Version : De-interlacing options
gumballguy
6th October 2005, 07:40
Can anybody offer advice on the deinterlacing options? I have tried research and understand some are better for fast or slow motion, but the urls I found ended up in detailed discussion of convolution matrices, which is beyond my comprehension.
Question 1:
The GK deinterlacing options are kernel, field, field no blend, smart bob, tomsmocomp. Which would be appropriate for fast motion, slow motion, or do you have other advice?
Question 2/3:
Using avisynth, what other (well tested) options are available for deinterlacing? Can i simply use GK as normal, then edit the .avs produced by GK to add the filter in, then click 'start project'?
Purely for interest:
I had considered whether it would be possible to link the deinterlacing filter to the % change in bitrate (assuming a 2 pass encoding).. mayhaps its possible to link different deinterlacing methods to different sections of the movie this way (relatively high bitrate implying fast motion, thus using a deinterlacing method for fast motion). The thought is interesting, but once again far beyond my ability. I am not convinced it would look right with a sudden 'shift' in the interlacing method either, but of course I cant test that.
manono
6th October 2005, 12:43
Hi-
1) Of the deinterlacers offered by GKnot, KernelDeint is the best of the bunch.
2) Tdeint can in some cases be better, but slower, than KernelDeint. Yes, you can edit the .avs to load the TDeint.dll plugin and the line TDeint(), or whatever. If you edit it though, maybe test it out in VDubMod first before doing the encoding, to make sure you did it right.
As far as I know, the amount of motion, or the bitrate needed, has nothing to do with the deinterlacer chosen. Admittedly, a blend deinterlacer may not look so good when there's movement, but neither of the 2 mentioned above are blend deinterlacers. And before you go around blindly deinterlacing anything, you'd better make sure that the source is truly 30fps interlaced, rather than 24fps film either encoded progressively, in which case you choose Force Film in DGIndex, or hard telecined to 30fps, which should be IVTC'd instead. That's for NTSC. If PAL, although often encoded as interlaced, more often than not the source is progressive, and you don't want to deinterlace that.
gumballguy
6th October 2005, 13:48
Hm, I am in australia, and had assumed 1080i would always be interlaced.
Turns out it is for this file anyway, DGIndex give 25fps pal interlaced, and reports 0% film at the end of the d2v file.
I dont think Ive ever seen anything reported as >0% film in australia.
On a side note, is deinterlacing always removing every second line, or can it be removing every third, etc? Im sure its every second line, always, and that implies to me that a 1080i stream has a max height of 540p when encoded to xvid. So then recording a hdtv channel with 576p would be a better choice than recording the same tv show in 1080i? Those 1080i streams sure look a LOT clearer than the 576p streams.
manono
6th October 2005, 14:58
PAL is always 0% film. Only progressively encoded 24fps is film.
On a side note, is deinterlacing always removing every second line
That's just one deinterlacing strategy, and usually one of the worst. However, if your final height is half or less than the source height, it can work very well. So, if your source is 1080, and your final is 540 or less, it'll work well. You'd add this to the .avs:
Crop(x,x,x,x)
SeparateFields().SelectEven()
LanczosResize(xxx,xxx)
I don't know what your stream looks like. Maybe someone else that has captured HDTV 1080i streams can help (neuron2, Wilbert, jggimi?). You can probably get some more informed help in the capturing forum. They also have a good sticky tutorial that may help you.
Turns out it is for this file anyway,
I was talking about DVD backups. I didn't know this was a capture.
phædrus
4th January 2006, 04:25
I dunno, maybe I should start a new thread, but my question seems to fit in here. I have a source which I am quite sure is film 24fps which has been hard telecined to 29.9xx fps progressive -- at least this is the result I get when I run the VOB through DGIndex. And the source is film.
What do I use to IVTC this back to progressive film frames at 23.9xx fps? It seems to me I would have to turn the progressive frames into fields first and then run telecide and decimate. Is that right? I've never done this before. Would the script go something like this:
SeparateFields()
Telecide(Order=1,Guide=1).Decimate()
Do I need a command in between SeparateFields and Telecide to specify top or bottom field first? I saw a script in another thread that looked that way, but I don't know if it applies in this situation. Please advise.
manono
4th January 2006, 07:28
Hi-
I have a source which I am quite sure is film 24fps which has been hard telecined to 29.9xx fps progressive
If it's hard telecined, then by definition it's not progressive, but interlaced. Open the D2V you made with "Honor Pulldown Flags" in GKnot, or make a small .avs with no filtering and open it in VDubMod. Scroll to a place with movement and start advancing a frame at a time. Is every frame progressive? Then you do nothing to it. Is every frame interlaced? Then you deinterlace it if for AVI. If for DVD, then most likely you leave it interlaced with no further filtering. Do you see the hard telecine pattern of 3 progressive frames followed by 2 interlaced frames? Then you IVTC it. You IVTC with:
AssumeTFF()#if that's what it is
Telecide(Order=1,Guide=1).Decimate()
No SeparateFields.
I have seen a few DVDs that were hard telecined and then deinterlaced, making them progressive 29.97fps. They were complete and utter garbage, and if that's what you have it should be deleted from the hard drive as soon as possible. When being examined in VDubMod, they show 3 good frames followed by 2 blended blurry frames. There is a filter that's supposed to fix them, restoring them to 23.976fps. If that's what you have, report back and I'll go track it down. These are very rare, and only put out by bottom-of-the-heap DVD production companies.
And if you have a field blended DVD, you diagnose it by putting on a smart bobber, such as KernelBob(Order=1), or TDeint(Mode=1). That'll make it full frame 59.94fps. You scroll through that and if you see blended fields, then you have problems that may or may be able to be improved, if not fixed entirely.
Go figure out what you have and report back. The name of the DVD might help. Maybe I or someone else has worked on it before.
phædrus
5th January 2006, 06:12
Well yes, I see what you mean -- in my clip, the frames are 29.9fps NTSC progressive (DGIndex says so) but as it was film that was hard telecined, that means the frames are combed. At least some of them are combed. There's a lot of noise in the source and something that looks like a very light ghost image from a previous frame, but I don't think it is actually the blending associated with a blended hard telecine. Probably this movie was mastered from (PAL?) video, which was sourced from film at some point.
After some fussing around with different parameters and examining sections of the clip frame by frame in VDubMod, I did a test on the whole clip with Telecide(Order=1,Guide=3).Decimate(6) and this seems to recover the original film frames, for the most part. The pattern changes from time to time and you get some funny looking frames. It still looks mediocre on an absolute basis, but on a relative basis, it is cleaner. There was combing on almost every frame before. Considering the source, I think this is the best that can be expected. I guess I did not understand that you could just take combed progressive frames like this and apply telecide to fix them.
I'm not using GKnot, BTW. OK, next I have to figure out how to do the subtitles, which I have not done before. Oy Vey.
manono
5th January 2006, 08:10
OK, if what you say is correct, then there is a pretty good fix for it. You seem to have discovered the all too common problem of using a PAL master for the NTSC DVD. The fact that you found a 6 frame pattern is a good clue. I don't think you put on a smart bobber to confirm blended fields, but you did say you may have noticed ghosting. There's a very nice filter for that called RePAL. You can get it here:
http://www.avisynth.org/warpenterprises/
You load a deinterlacer capable of smart bobbing (I'm going to use KernelDeint), and the RePAL filter, and use it like this:
KernelBob(Order=1)#if TFF
RePAL()
You'll get much better results than using Decomb for it. That will give you 24.975fps output. If you want to keep that, then the audio doesn't have to be stretched. If you want to make it 25fps, then you add AssumeFPS(25) to the script and stretch the audio. If for DVD, you can keep the framerate and the audio and afterwards use DGPulldown with a custom setting of 24.975->29.97 if for NTSC, or 24.975->25 if for PAL.
And if someone encoded that as progressive, then they messed up badly. The DVD will play back very badly on any sort of a progressive display, such as a computer monitor or HDTV.
phædrus
5th January 2006, 19:44
Thank you for the suggestion, manono. I just downloaded the KernelDeint140 dll and the RePal plugin. Do I have to do anything special other than putting those dll files in a directory and loading them in the script to use them as per your suggestion ,i.e. KernalBob(Order=1).RePAL() ??
I can try a test run to see if I get even better results. I suspect I will.
I have no problem with 24.975fps. As long as it will play back cleanly. If I turn my clip into a DivX file, I assume the DivX player/codec will have no problem with that framerate. If I turn it into an mpeg2 file with CCE, I assume that WinDVD or similar software would play it cleanly too, no? I guess I don't have any other files at that framerate that I know of, but I don't see that it would be any problem.
manono
5th January 2006, 20:48
Yeah, you load the 2 plugins (or have them in your AviSynth Plugins directory), and use them as I wrote. Always test the script in VDubMod before doing any actuall encoding, no matter the destination format. The reason for that is, if there's something wrong, VDubMod will give you a clue in the error message.
There won't be any problem with the framerate, no matter if AVI or DVD (for DVD, you'll have to use DGPulldown on it for 29.97 NTSC output).
If you have GKnot, then you already have KernelDeint.
phædrus
6th January 2006, 04:25
1. No I don't have GKnot. I used it at one time, but since freshly installing my OS, I've only been using DGIndex and VDubMod with AviSynth.
2. I tried your suggested script, but when I open the avs script with VDubMod it throws a fault "there is no function kernelbob". I do not understand this.
LoadPlugin("C:\Program Files\dgmpgdec140\DGDecode.dll")
LoadPlugin("C:\Program Files\UNDOT\UnDot.dll")
LoadPlugin("C:\Program Files\COLORMATRIX\Release\ColorMatrix.dll")
LoadPlugin("C:\Program Files\kerneldeint.dll")
LoadPlugin("C:\Program Files\REPAL.dll")
mpeg2source("D:\TEMPRIP\movie.d2v")
kernelbob(order=1)
RePAL()
crop(0,0,720,480)
ColorMatrix()
Undot()
LanczosResize(640,352)
I'm a little puzzled here. Maybe I did something stupid. Thanks in advance for any suggestions.
manono
6th January 2006, 06:10
You got the KernelDeint140 dll, so wouldn't it make more sense to load it this way:
LoadPlugin("C:\Program Files\kerneldeint140.dll")
Either that or rename it.
phædrus
6th January 2006, 07:57
Um, I tried the kerneldeint140.dll, and that didn't work (same fault), so I downloaded a different version from neuron2's site, and that one is named kerneldeint.dll (though I think it is version 1.4.1). Thus the script as it is ought to work. I tried putting the plugin in the Avisynth plugins directory and then not specifically loading it with a LoadPlugin command. That didn't work. So I moved it to the Program Files directory and put LoadPlugin in the script as shown. Anyway, I've tried a few different things. Can't quite understand what is going wrong. Is there another filter I can try that will do a "smart bob" (which I don't know what that means, but who cares as long as it works) just as well?
manono
6th January 2006, 12:53
Hi-
Gee, if I've used RePAL once I've usd it a hundred times, and never with any problems. But I rename the filters sometimes and then forget what I did. Probably my fault. Don't worry, we'll get you going. First, get LeakKernelDeint at the bottom of this page:
http://neuron2.net/kerneldeint/kerneldeint.html
Load it like so:
LoadPlugin("C:\Program Files\LeakKernelDeint.dll")
Does it really have to be in the Program Files? Maybe that's what's throwing it off. Maybe point the path to the AviSynth Plugins folder.
And use it like this:
LeakKernelBob(Order=1)
If that doesn't work, then maybe you can use the smart bobber in TDeint. You get TDeint here:
http://www.avisynth.org/warpenterprises/
Load it like this:
LoadPlugin("C:\Program Files\TDeint.dll")
and use it like this:
TDeint(Mode=1)
Followed by the RePAL filter. LeakKernelDeint is a bit faster than KernelDeint. TDeint is slower, but maybe has slightly better quality.
phædrus
6th January 2006, 16:40
OK. Thanks for the suggestions. I especially appreciate the script advice, because I don't know the parameters for these other filters.
Hopefully I will have success to report in a day or so.
phædrus
7th January 2006, 03:42
Yes, the LeakKernelBob and RePAL seems to have done the trick. Thank you, manono, for the guidance. I think this same script might work well for other projects, too. The R1 Grenada Sherlock Holmes series comes to mind. As I recall it had a similar pattern.
manono
7th January 2006, 13:42
Whew, I'm glad. :)
To be sure that RePAL is the right way to go about it after noting that 6-frame pattern, you have to make sure you have blended fields. You do that by putting on LeakKernalBob by itself and stepping theough some motion part of the video. If you see the blends/ghosts/double images, then you're OK. Some 6-frame patterns can be sorted out with Telecide/Decimate(6), and won't have blended fields.
And blended fields don't always mean you can use RePAL successfully. There are also quite a few DVDs where they've gone from 23.976fps to 29.97fps by blending the heck out of it. Nasty stuff that.
phædrus
11th January 2006, 07:28
Manono, Since this is the newbie forum, I think I'll just continue this thread by asking a related question - a more general one. Since I began to make DivX backups with VDub, I've used telecide for telecined TV shows that were derived from film. This works fine most of the time but can still be tripped up when the pattern is not consistent.
The problem you helped me with above was the first time I had used kernel deinterlacing. I think I understand a little about DG's decomb, that it tries to match up fields, using specific parameters, which can be varied in the script if desired. Kernel deinterlacing works differently I take it. Generally speaking, how is kernel deinterlacing different from Decomb? And under what conditions would I get better results using a kernel deinterlacer?
I guess I'm not even sure what is meant when you talk about a "bob." Is there a guide somewhere that would explain what kernel and bob mean? I think I understand telecine and IVTC pretty well. I just don't understand the IVTC methods very well.
When I read the forums, it seems to be assumed that people know what these terms are, but I don't. Let alone the theory behind different algorithms for dealing with combed frames.
manono
11th January 2006, 11:12
A bobber doubles the framerate by dividing each frame into its 2 fields and resizing them to the original resolution. A dumb bobber, like AviSynth's Bob() command just interpolates the entire field, loses fully half the resolution, and it can look pretty nasty with aliasing/shimmering on fine lines. A smart bobber such as LeakKernalBob Or TDeint's Mode=1 is motion adaptive. The static portions of the scene remain unchanged and only the motion parts are interpolated. As I understand it, it's better than a straight interpolation, and can include some sharpening for slightly better resolution retention. The entire frame is divided into little squares or kernels, and it's then decided whether there's motion in each kernel, in which case that kernel is interpolated, or if it's static, in which case the full resolution kernel is grabbed from the original frame. Smart bobbing looks much better. A filter like RePAL often has to replace a blended frame with a clean bobbed frame, so the better the resized field looks, the better the result of using RePAL or other filters that also use bobbers to replace blended frames or orphaned fields. However, you can still get shimmer. Say you have a moving or panning camera looking up at some electric wires. They might not look so good after coming out of RePAL, no matter how good the bobber used. Still better than the blended mess you started with though. And if any expert on this, such as neuron2 or scharfis_brain, happens to read this and want's to correct me or add something, then be my guest.
Kernel deinterlacing works differently I take it.
Strictly speaking, IVTCs, such as Decomb, TIVTC, SmartDecimate, etc., aren't deinterlacers at all. Telecide matches up fields and Decimate removes the dupes. No deinterlacing there. Telecide does have a conditional deinterlacer on by default to deinterlace any few remaining interlaced frames. By the way, IVTCing TV series can be tricky stuff. They usually edit on video and don't care where they make their cuts and splices. As you've noticed, the cadence or pattern can often be broken, leaving behind orphaned fields for which there is no proper match. They can be deinterlaced, but in general, it's my opinion that Decomb doesn't handle orphaned fields all that well. You might try one of the other IVTCs and see if they handle them any better. You might also set the Telecide deinterlacer for Blend=False to see if you like it better than the blended frames it hands you when being used at the default setting.
When being used, the 2 methods of deinterlacing within Decomb are very different from kernel deinterlacing. Blend=True (the default) blends 2 fields together to give you a blended or ghosted frame. Blend=False interpolates, creating a full frame from a field and losing half the resolution. If the deinterlacer isn't used all that often, then you might not notice if something has been deinterlaced. It sure beats having interlaced frames slip by, since they're much more obvious.
Edit later: I was probably off in my description of how KernelDeint works. Forgive me, neuron2. I was reading a bit and this may explain it better:
http://neuron2.net/journal/journal2003.html
gastorgrab
12th January 2006, 05:12
A bobber doubles the framerate by dividing each frame into its 2 fields and resizing them to the original resolution. A dumb bobber, like AviSynth's Bob() command just interpolates the entire field, loses fully half the resolution, and it can look pretty nasty with aliasing/shimmering on fine lines. A smart bobber such as LeakKernalBob Or TDeint's Mode=1 is motion adaptive. The static portions of the scene remain unchanged and only the motion parts are interpolated. As I understand it, it's better than a straight interpolation, and can include some sharpening for slightly better resolution retention. The entire frame is divided into little squares or kernels, and it's then decided whether there's motion in each kernel, in which case that kernel is interpolated, or if it's static, in which case the full resolution kernel is grabbed from the original frame. Smart bobbing looks much better. A filter like RePAL often has to replace a blended frame with a clean bobbed frame, so the better the resized field looks, the better the result of using RePAL or other filters that also use bobbers to replace blended frames or orphaned fields. However, you can still get shimmer. Say you have a moving or panning camera looking up at some electric wires. They might not look so good after coming out of RePAL, no matter how good the bobber used. Still better than the blended mess you started with though. And if any expert on this, such as neuron2 or scharfis_brain, happens to read this and want's to correct me or add something, then be my guest.
Kernel deinterlacing works differently I take it.
Are there guides to suggest which method would be best for which source?
I typically have used deinterlacers on rare occasions, and usually only on NTSC material. KernelDeint worked very well in the past for this. I noticed that some interlace lines remain on the hybrid clips i've been trying lately.
*Hybrid, as in telecined material, edited with NTSC material with progressive banners flashing about.
After thinking long and hard about the subject, and reading quite a bit, i began to wonder if certain types of strategies would get confused by trying to match frames of materials with two different framerates.
FILM - Progressive 23.976
NTSC - 29.97 interlaced, or 59.94 progressive if fields are separated.
BlendBob sends back amazingly clean, progressive frames on NTSC material but the motion seems a little robotic at times if there isn't much action in the scene. I'll have to try it on the hybrid material.
.
manono
12th January 2006, 06:54
Hi-
I'm not exactly sure if this is what you're talking about, but I've seen Movies with interlaced scrolling text along the bottom. Using Decomb, you can exclude the text from the IVTC with one of its parameters:
y0 and y1 (integer, default 0) define an exclusion band for the field matching. If y0 is not equal to y1 this feature is enabled. Rows in the image between lines y0 and y1 (inclusive) are excluded from consideration when the field matching is decided. This feature is typically used to ignore subtitling, which might otherwise throw off the matching. y0 and y1 must both be positive integers and y0 must be less than or equal to y1; if this is violated an exception will be thrown.
If those progressive banners are throwing off the IVTC, you can exclude them, unless they're showing up at different places on the screen. Both Decomb and TIVTC also have hybrid modes that treat telecined film normally, and bring interlaced NTSC 30fps material down to 23.976fps by blending a couple of frames in every 5.
Personally, I prefer SmartDecimate when you have some interlaced NTSC mixed with film. It was designed with hybrids in mind, such as a lot of the space shows with 30fps computer effects. I don't know how it will do with your banners in there messing things up. It doesn't blend the NTSC portions, but grabs bobbed fields instead, in order to keep the movement as fluid as possible. It is very slightly jerky as a result, but much less so than doing a straight IVTC on it. You'd have to decide for yourself if you like it better or not.
gastorgrab
12th January 2006, 12:46
Both Decomb and TIVTC also have hybrid modes that treat telecined film normally, and bring interlaced NTSC 30fps material down to 23.976fps by blending a couple of frames in every 5.
....and that plays back smoothly? (Normal inverse telecine only blends a couple of frames out of five.)
:confused:
.
manono
12th January 2006, 14:09
Normal IVTC doesn't blend anything. After reassembling the fields into progressive frames, it removes the duplicate frame. When you have some NTSC mixed in, quoting from the Decimate section of the Decomb Reference Manual:
If mode=3, instead of discarding the most similar frame, Decimate() will apply different decimation strategies for 3:2 pulldown material (film) and for pure video (nonfilm) cycles. Film cycles are decimated in the normal way. Nonfilm cycles are decimated by applying a frame blending decimation of the cycle from 5 frames to 4 frames. The resulting frame rate is the film rate (decimated by 1/5).
So 2 of the frames out of 5 are blended into 1.
But maybe I didn't quite understand your post. As for whether or not it plays smoothly, you'll have to be the judge. For AVI, when you have a hybrid source and have to do it for the same framerate, there are serious problems and no solution is entirely satisfactory. Like I said, I prefer to use Smart Decimate, but that's a judgement call.
gastorgrab
12th January 2006, 18:02
Normal IVTC doesn't blend anything. After reassembling the fields into progressive frames, it removes the duplicate frame. When you have some NTSC mixed in, quoting from the Decimate section of the Decomb Reference Manual:
:o
Yes, i knew that. It doesn't have to create anything, just reassemble whats already there.
It's also easier for someone to give you help when they know what your talking about. My fault.
For AVI, when you have a hybrid source and have to do it for the same framerate, there are serious problems and no solution is entirely satisfactory. Like I said, I prefer to use Smart Decimate, but that's a judgement call.
Personal preference then....
Thanks.
.
phædrus
12th January 2006, 23:30
I never had good luck with mode=3 in telecide/decimate. If there is much motion in the video part of the hybrid material, it will be jerky. No real cure for it, except some kind of "motionperfect" program, and I don't know of any good open source solutions for that. Plus I'm sure the processing would be very time consuming.
gastorgrab
13th January 2006, 22:52
The year is 2020. AviSynth 8.0 RC1 has just been released.
HologramSource ("C:\temp\flying_car.avi-2", fps=2000, convertfps=true)
MorphDeinterlace ()# Convert to standard handheld framrate
;)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.