Log in

View Full Version : How to deinterlace a rendered interlaced text scene?


jjabba
14th July 2006, 19:36
I've got a good all progressive anime that at some places has a short cutscene where an english text is added. The text is rendered as interlaced and steadily shrinking in size. Every field holds an intirely new "frame" so to speak.
To explain this further:
If you use Separatefields() and step in virtualdub, each new frame is showing a slight progress to the previous one.

Since this is white text on an all black background, and there are only a few seconds of this in each episode I feel it's worth while to manually interlace these few frames.
I've been thinking just to use one field in each frame and then duplicate it.

How is that most easily done in avisynth?
Are there more attractive options availible?

Guest
14th July 2006, 22:58
One option is to use FieldDeinterlace(blend=false) with an override file that specifies the frames to be deinterlaced.

jjabba
15th July 2006, 01:06
One option is to use FieldDeinterlace(blend=false) with an override file that specifies the frames to be deinterlaced.

That sounds like a good idea. However, I've been doing some more reading on deinterlacing and I came up with this:
AssumeTFF().SeparateFields().SelectEven().EEDI2(field=-1)

EEDI2 if I understand things correctly will do a rather sofisticated interpolating for the creating of the missing field lines. I'm not familiar with deinterlace() but I guess it's not as specialiced at upsizing one field to full resolution as EEDI2 is. And since EEDI2, in this case, is looking to match a white edge on a black background it's algoritm should preform well.

actionman133
15th July 2006, 01:12
You could also use one of the CPU-burning high quality deinterlacers like SecureDeint or MVBob and just tell AVISynth to only deinterlace those frames. For example:

a = AVISource ("Test.avi")
b = a.MBob ().SelectEven () # overkill but it's cool :-)
final = a.Trim (0, 999) + b.Trim (1000, 1100) + a.Trim (1101, 0)

return final

That will deinterlace between frames 1000 and 1100, while all other frames won't even touch the deinterlacer at all.

Guest
15th July 2006, 01:41
That sounds like a good idea. However, I've been doing some more reading on deinterlacing and I came up with this:
AssumeTFF().SeparateFields().SelectEven().EEDI2(field=-1)

EEDI2 if I understand things correctly will do a rather sofisticated interpolating for the creating of the missing field lines. I'm not familiar with deinterlace() but I guess it's not as specialiced at upsizing one field to full resolution as EEDI2 is. And since EEDI2, in this case, is looking to match a white edge on a black background it's algoritm should preform well. You'll need to find a way to apply it only to the few seconds that you mentioned, and also only to the interlaced parts of those frames. What you gave is just a test method for EEDI2() that fully deinterlaces all parts of every frame. You can do it with TDeint() but it gets complicated. Since it's only a few seconds, is it really worth all that complication?

LocalH
15th July 2006, 22:25
Just use Trim() to split the video up into several clips as necessary and then concatenate them, applying that filterchain only to the desired clips. It's manual work, but it's also frame-accurate that way. Basically, another way of doing actionman's script. Something like this:

src=AviSource("test.avi")
a=Trim(src,0,999)
b=Trim(src,1000,1100).AssumeTFF().SeparateFields().SelectEven().EEDI2(field=-1)
c=Trim(src,1101,0)

return a+b+c
If you have a large filterchain that you're also applying to the whole video, then just bung it after the AviSource call. If it's large enough you might consider making it a function to consolidate your code. This would also allow you to finetune the parameters of your filterchain for each clip, either way. Just make sure that everything stays the same frame rate, so if you're doing IVTC then you will also want to reduce your manually-chosen deinterlaced clips to 23.976fps.