Log in

View Full Version : Encoding an interlaced DVD, very confused.


valodya
17th February 2004, 23:20
I'm a relative newbie to all this, although not as much of a noob as my post count would suggest; I've been lurking here for months, and have successfully encoded many films with GK, DivX, and XviD.

I've just run into my first DVD that's (I think?) interlaced all the way through, and I'm not sure what to do. Till now I've only dealt with video with small sections interlaced. In those cases I simply chose "Inverse Telecine" under "Field Operations" in GK, and the results were good enough. In the case of this latest film, it's not quite good enough. I've tried to follow the various guides, but now I'm swimming in a sea of filters and configuration options I don't understand, and I'm thoroughly lost.

The DVD is "Yi Yi"("A One and a Two"; a Taiwanese movie released on DVD in the US). In DVD2AVI, it shows up as 100% NTSC interlaced, and looking at the .d2v file shows strings of 2's (2 2 2 ...) all the way through. I did not enable "Forced Film" in DVD2AVI and left it at 29.97 frame rate. I created the .avs script with GK, and chose "Inverse Telecine" (which results in: "Telecide(order=1,guide=1).Decimate()" in the script), and ecoded with XviD and VDubMod.

The resulting AVI showed no combing, but contained what looked to me like interlacing artifacts. Horizontal boarders looked pixelated, and would sort of shimmer and jump up and down. The worst were Venetian blinds, which looked like they had waves rippling through them; I almost couldn't watch, it almost made me dizzy. Small background objects sometimes also looked more pixelated than they ought to, and shimmered and jumped. Otherwise the encode looked OK, although not quite as sharp as I'd like.

I also tried to look at the clip frame by frame. Not every frame is interlaced, but I couldn't discern a pattern, it certainly wasn't the neat 3:2 ratio. If there was pattern, I couldn't figure it out.

So, is there anything I can do to improve the encode, or is this the best I'm going to get from the source? Can anyone suggest filters or settings I can try? Like I said, trying to figure it out on my own is making my head spin, so thanks in advance for any advice. Sorry for the long post; I hope I included all the relevant information.

manono
18th February 2004, 18:46
Hi and welcome to the forum.

Most of what you did was correct, and you provided a lot of helpful information.

First, from your description of the shimmer/aliasing it sounds as if it's a widescreen movie encoded as widescreen letterboxed 4:3. But IMDB says differently:

http://www.imdb.com/title/tt0244316/dvd

They say it's anamorphic 16:9. On the other hand Amazon.com says it a Fox-Lorber DVD, and they're notorious for producing crap DVDs encoded as 4:3. In addition, a number of the user reviews comment on the poor quality of the DVD, mentioning some of the same things as you did:

http://www.amazon.com/exec/obidos/tg/detail/-/B000059TON/103-7525539-1289419?v=glance&s=dvd&vi=tech-info

But what does DVD2AVI say (or the Stream Information file from DVDDecrypter)-4:3 or 16:9? If it's 4:3, then that can account for the problems with the venetian blinds and other places where there are thin horizontal lines, and the generally soft image. There's just not enough resolution there to resolve it well. If you play the vob files or the DVD itself, you might see the same things if it's a 4:3 DVD.

Now, for the IVTC; you have to determine the pattern of interlaced/progressive frames. When you play your IVTC'd encode, does it play completely smoothly? Try and find a scene where there's a slow pan. Is there a slight jerk every second or so, like it's missing frames? Go back into GKnot and open the .d2v. Find a scene where there's some movement and start advancing a frame at a time. You said it doesn't have a 3/2 pattern. But could it be a 6 frame cycle? That is, are there perhaps 3 or 4 or even 5 interlaced frames out of every 6? If there is at least one progressive frame in every 6 frames, then you have a not uncommon lousy PAL to NTSC conversion. And one solution is to :

Telecide(order=1,guide=2).Decimate(6). And an even better solution is to use the RePAL filter, perhaps in conjunction with KernelBob. You can find more information by searching the AviSynth Forum.

But I'll await your answers to the questions before offering more advice.

valodya
19th February 2004, 04:43
Thanks for your reply. Here goes:

DVD2AVI shows 16:9. Panning scenes do play a little jerky. It's subtle, but I think it's there.

Now here's the weird part. I had a hell of time trying find a pattern of interlaced frames. Part of the problem is there isn't a lot of movement in this movie, so it was hard to find a long enough sequence to discern a pattern. The other problem is the pattern makes no sense. This is what I found, I'm not making it up (- = interlaced):

---...---.---.-----.----.--...---...---.---.-----.----.--...

So it does repeat eventually, but you have to watch for a long time. Then, at another point I found this pattern:

---...-.-----.-----.--..---...---...-.-----.-----.--..---...---...-.-----

Does that make any sense at all?

Finally, I looked at the source again, and you're right, it's pretty crappy. Some of the shimmering is there, but I think it's worse in my encode. So maybe this is the best I'm going to get, but I'll give it another shot, if you think there's anything I can do to improve things. In the mean time, I'll read up on RePAL and KernelBob, and add them to the list of filters I don't understand. :P

Thanks again for your help.

manono
19th February 2004, 09:12
Hi again-

Good work. You told me what I needed to know with all the dashes and dots. It is a PAL to NTSC conversion, but done in a very strange way. But the pattern starts to repeat after every 30 frames, and in that span there are 5 duplicate frames that have to be removed. So, instead of Decimate(5) to bring it down to 23.976fps, you're going to do the equivalent of Decimate(6) to bring it down to 24.975fps. Decomb can do it, but you'll get back a lot of blended deinterlaced frames. So, I think you'll need RePAL, together with a double frame rate smart bob deinterlacer. None of that probably makes any sense to you, but it will soon, maybe.

First, go to here (http://www.avisynth.org/index.php?page=Section+3%3A+Filters%2C+plugins+and+colorspaces#q3.5) and get the RePAL filter (number 2). Then stick the RePAL.dll in the GKnot folder with all the other .dlls.

Second, put this near the top of the .avs just below all the LoadPlugin lines:

function kernelbob(clip a, int th)
{
f=a.kerneldeint(order=1, sharp=true, twoway=true, threshold=th)
e=a.separatefields.trim(1,0).weave.kerneldeint(order=0, sharp=true, twoway=true, threshold=th)
interleave(f,e)
}

You can read more about KernelBob here (http://forum.doom9.org/showthread.php?s=&threadid=66093&highlight=Kernelbob).

Third, remove the "#" from in front of the KernelDeInt Plugin up with all the other LoadPlugIns. If you have an up-to-date GKnot, you'll have the KernelDeInt.dll. If it isn't there, then update your GKnot.

So, you'll have that KernelBob function, and 2 additional LoadPlugins near the top of the ,avs:

LoadPlugin("Path\To\KernelDeInt\KernelDeInt.dll")
LoadPlugin("Path\To\RePAL\RePAL.dll")

You can just erase one of the .dlls not being used and replace it with RePAL. And KernelDeInt should already be there. And, of course, you also will have loaded all the usual stuff, like the MPEG2Source line, the MPEG2DEC3.dll, the Undot.dll and any other filters you may be using.

Fourth, down in the .avs where the Decomb IVTC stuff is located, stick this in:

KernelBob(4)
RePAL(Quality=3)

Make sure that Telecide-Decimate is no longer being used (either erase them, or comment them out (put "#" in front of them)).

Save the .avs and then try and open it in VDubMod. If all goes according to plan, it'll open. If it doesn't, then you might get an error message to help you figure out what the problem is. If you're baffled, then report back with the error message, and anything else you may have learned. Scroll around and make sure that it looks OK. Scrolling will be slower than usual. Then go File->File Information, and you should see that the framerate is now 24.975fps. If you keep it at that, then there's nothing you have to do with the audio. It'll still be insynch. If you want to make it 25fps (as I do), then the audio has to be adjusted, and you also have to add AssumeFPS(25) to the script. But maybe you'll want to save that for another time.

Now you're ready for encoding. You'll have to run both passes again, as the number of frames has changed. And be warned-RePAL is slow, and your encoding time may increase by about 50%. And since Yi yi is a long movie to begin with, then, well, maybe do it overnight, and it may still not be done when you wake up.

RePAL should give you back a smooth running movie, with many fewer blends than before. But it's not perfect. After scene changes, especially, you might see blended frames. But it can't improve on the original bad quality of the DVD. The venetian blinds will still shimmer. And the overall quality of the movie will still be on the soft side. But that may be improved with the use of RePAL, as you'll now have many fewer blended frames.

If all that sounds too complicated, or intimidating, then you may be able to get away with replacing Decimate() with Decimate(6). But I'd need more information to be sure.

Good luck, and report back how it goes.

valodya
20th February 2004, 04:18
Wow. Thanks for all the info. It'll take me a couple of days, but I'll give it another shot and I'll let you know how it goes.

valodya
27th February 2004, 00:29
OK, I finally gave it another shot and it worked, and it helped a bit. It did take care of the jerkiness, and some of the blended frames, as you predicted. It's a definate improvement, but not perfect, but I'll blame that on the lousy source. Thanks for the very explicit instructions; I would never have figured it out otherwise. I tried to understand what I was doing, with limited success. RePal sort of makes sense, but Kernelbob still has me baffled. In any case, I did learn something, so hopefully if I ever run into anything similar, I'll be able to get a little further on my own.

manono
27th February 2004, 02:32
Hi-

Certain filters, such as the SmartDecimate IVTC, RePAL, and Unblend need to work with fields converted into frames, aka doublerate deinterlacers. In the case of RePAL, it wants to be able to choose the unblended fields and discard the blended ones. KernelBob is one of the better doublerate deinterlacers. As you found out, RePAL is a definite improvement, but by no means perfect. But if you're a perfectionist, you can try out UnblendPattern, which can give you back perfect and unblended video. I linked to the UnblendPattern thread in my previous post. But be forewarned; it takes a very long time, and much of that time is you making your way through the movie determining the patterns and spotting where they change. I've done it on a couple of movies I really liked. But it's not for the fainthearted. If you want to give it a try sometime, and the instructions in the thread aren't adequate, you can PM me and I'll walk you through it.

Thanks for reporting back. Good luck.