Removing Interlacing


If you happened to edit your video interlaced, you will definitely want to remove this interlacing now. If you removed interlacing before editing, then you should obviously skip this step. Interlacing looks terrible on progressive displays like computer monitors and it makes good looking compression difficult.

There are many ways to remove interlacing. However, as your video has been edited together, some of these options are less successful than they would be before you started editing. So let's look at some possible techniques.

OK, so we just
IVTC, right?

Usually the best way to remove interlacing in anime is to use Inverse Telecine (IVTC). This matches up the fields in order to restore the progressive frames. These fields are usually in a pattern, so finding and combining them is usually not that difficult. However, your video has been edited. This makes things very tough indeed. Imagine one pattern of telecine being faded into another pattern of telecine... that pattern now becomes very difficult to find. Footage that is sped up will also have completely lost some fields, making it even harder to find the pattern.

IVTC also includes decimation. If you've done lots of tight editing, beat matching, flashes and all sort of other video trickery, it may be ruined by the decimation process as the footage is reduced from 29.97fps to 23.976fps.

So you can see now the basic problem that we have in removing interlacing with edited videos. Add to this the numerous problems that you can find in sources (hybrids, field blending etc etc) and it becomes a real mess.

So, what can you do?

There are basically two solutions to the problem. You can attempt to perform IVTC on the footage, or you can deinterlace it. I strongly recommend that you try both methods and see which one works best for your video.

Before you begin: Get the correct colorspace

It is likely that at this point you have an avi that has been exported losslessly from your editing program - probably in an RGB colorspace. For pretty much all the filters on this page you will need to convert this to YV12 (the exceptions to this rule will say what you need to convert it to instead). To do this conversion make sure you avisynth script looks something like this:
AVISource("youramv.avi")
ConvertToYV12(interlaced=true)


1) Try to IVTC anyway (might work pretty well)

It may be that your video is edited together in such a simplistic way that IVTC will be just as good now as it would have been working on the original source. It's not very likely, but it's possible. If you are going to use this method, a basic script like this will do:
deint = TDeint(order=1, mode=2, mtnmode=3, blim=100) #order=0 for bottom field first
TFM(order=1, cthresh=4, slow=2, clip2=deint) #order=0 for bottom field first
TDecimate()

If you have PAL footage, omit the TDecimate() part. If you are using NTSC, you can still try omitting the TDecimate() line and see if you like the result better. You really should try both ways (but never leave the TDecimate in if you have PAL footage!).

This script basically tries to match fields as best as it can, and deinterlaces the parts it cant match by blending the fields together. Notice that the order parameter, where you specify the field order is required. Order=1 means top field first, and order=0 means bottom field first.

2) Full Frame Deinterlace (most likely solution)

Not always the prettiest option but certainly one of the more reliable techniques. If you have lots of complex editing and not much film footage in your video, these are the options you will probably want to try first:

TDeint(order=1) - Tdeint is a deinterlacer that uses motion adaptation and all kinds of interesting interpolation tricks. This is a really excellent deinterlacer and worth trying. Be sure to properly set the field order.

At the default settings, this does a pretty nice job at deinterlacing by interpolating the fields, but this can leave jagged lines in the video. I also highly recommend you try this filter with these settings: TDeint(order=1, mode=2, mtnmode=3, blim=100)

This filter has a lot of different options and modes which cause it to deinterlace in different ways. I highly recommend you check out the documentation on it and experiment to see what works best for your particular source.

TomsMoComp(1,5,1) - This deinterlacer uses both adaptive and motion compensated deinterlacing and is generally considered to be a pretty worthy all-rounder. It's not perfect, no deinterlacer is, but it is good at what it does. The commands are given as numbers in order. 1 specifies this is Top Field First (0 would be BFF). 5 is the search effort (which is the value recommended) and 1 turns on the vertical filter. If you get a lot of noise then try setting the last number to 0 to turn off the vertical filter. This deinterlacer has some other interesting modes too, which you may wish to investigate in the documentation.

SangNom(order=1,aa=32) - This filter interpolates fields and is very powerful when dealing with pure interlaced material. Order sets the field order just like with most of the other deinterlacers, aa means Anti-Aliasing and will try to smooth out those lines when interpolating making it particularly useful for anime. Can be very pretty.

Once you have a script with deinterlacing, you will want to check out how to improve the visual quality of your video.