Making
your footage Progressive

This is a much expanded version of part of the guide which previously
only took one paragraph. The guides are much more focused on showing
you how to analyse your footage and how to deal with it depending on
the footage you have. Hopefully by this point you will know (or at
least have a good idea) whether your source is Telecined, Hybrid,
Blended or Pure Interlaced.

Armed with this knowledge I can show the different ways of handling
this
footage. If, on the other hand, you read the Analysing
your Footage
page and couldn't decide which type of interlacing your source had then
you may want to try each method one by one and see what looks best to
you.

Methodology

The information contained on this page are general rules of thumb and
like all rules there are exceptions. When reading this document you
should try to understand why certain options are being used so that you
can modify these depending on your own source footage. There are
different solutions to different problems and although I have tried to
cover numerous possibilities it is very likely that you may find better
solutions yourself so don't be afraid to experiment.

The Decomb
Plugin

Decomb is an plugin for Avisynth developed by Donald Graft which will
be used for the majority of our attempts to recover progressive frames.
The version used in the last guide was decomb 4 but these days decomb 5
is recommended. If for some reason you would prefer to use Decomb 4
(with all the old options) then you can do so by adding LoadOldDecomb()
to your script before using Telecide and Decimate. You can also
LoadLegacyDecomb() which is the same as the version for avisynth 2.0x
that operates in YUY2 colourspace.

Decomb works in two stages using two functions - Telecide and Decimate.

Telecide: This part of the filter chain looks
for the original progressive frames in the source and attempts to
restore them. If it can't find a progressive frame it can use Post
Processing to adaptively deinterlace the frame for you.

Decimate: This removes any duplicate frames created by
Telecine
and removed frames in an attempt to restore a source to its original
framerate. For Telecined PAL
material this is not required.

Each of these fuctions have settings which will differ depending on the
kind of interlacing you have, so let's have a look at the different
ways of dealing with your source.

Telecined
Footage

The simple stuff - or so we hope. The decomb functions should be able
to deal with this sort of footage very easily by using Inverse
Telecine. This will take your footage and restore the original
progressive frames. With NTSC footage this will also restore the
framerate to 23.976fps whereas PAL will keep the its framerate of 25fps.

For NTSC footage you you make a script like this:

MPEG2Source("C:\yourfolder\blah.d2v")Telecide(order=1,guide=1)
#1 for Top Field First or Telecide(order=0) for Bottom.Decimate(cycle=5, mode=2)

and for PAL you do

MPEG2Source("C:\yourfolder\blah.d2v")Telecide(order=1,guide=2)
#1 for Top Field First or Telecide(order=0) for Bottom.

So you can understand what is going on with these functions and
settings, allow me to explain the options that are being used.

Telecide:

Order - This dictates the field order of the
source. Top Field First or Bottom Field First - you should know this
from the analysis stage you did earlier.Guide - This tells Telecide what sort of pattern to
look for.
Use 1 for NTSC Pulldown and 2 for PAL pulldown. 0 is default and does
blind pattern matching which is pretty decent too - if the pattern
guidance looks like it's getting it wrong, try guide=0

Decimate:

Cycle - The number tells decimate how
regularly to remove a frame. For NTSC IVTC it is 1 in every 5 frames.
Later
you will see some examples where decimation is used differently or not
at all..Mode - The mode will govern what frame in a sequence
gets deleted. This decision will affect how smooth the output will
be. For a simple NTSC Telecine of anime, mode of 2 is best - you can
read the decomb manual for info on the other modes.

You will notice that there is no decimate for PAL Telecine. This is
because if a source has used a simple Telecine process for PAL then
once the frames are recoverable they will be at the correct framerate
of 25fps.
Again, I must stress that it is unlikely that a PAL source has been
encoded like this.

Remember it is common for a Telecine pattern to be hard to find, which
in turn makes it difficult for the filters to restore the orignal
frames. One
difficulty which you can try and overcome is when Telecide has trouble
finding good mathches when it looks for the progressive frames - if you
believe this to be true then you will want to refer to the Decomb 5 FAQ
which you should have in your start menu under AMVapp/Avisynth
Filters/Documentation/. Yes, that's right, I'm telling you to RTFM -
I'd only be repeating things if I put them here. All the decomb
documentation file are great and well worth reading. Here's a quick
rundown of what you need to do to tweak your settings:

Add show=true to telecide

Look for a frame that is still interlaced

a) If the info says that the frame is Progressive then you
need to lower your vthresh to be lower than the "matching"
number.

b) If the info says the frame is interlaced then you need
to lower your dthresh

This is actually very easy to do and very worthwhile.

If you are still having trouble, there are some alternatives.
Alternative Method 1: SmartDecimate

Some sources respond better to the filter SmartDecimate which is a
decomb alternative. For NTSC footage use SmartDecimate(24,60). For more information see the
Smart Decimate documentation in the Start Menu - AMVapp/Avisynth
Filters/Documentation. This filter can be used in other creative ways
as described in the documentation so mess around with it.

Alternative Method 2: Better deinterlacing in Post-processing

When Telecide cannot match a field, it has to deinterlace the
frame. By default it uses FieldDeinterlace... but FieldDeinterlace
isn't all that good. You can specify other filters to do the
interlacing on those frames. Two deinterlacers that can do this are
KernelDeinterlace and TDeinterlace. To use these, do as follows:

To use KernelDeint:

MPEG2Source("C:\yourfolder\blah.d2v")Telecide(order=1,guide=1,hints=true=,post=1) #1 for Top Field First or order=0 for
Bottom.KernelDeinterlace(order=1) #See
readme for kerneldeinterlace options.Decimate(cycle=5, mode=2)

To use Tdeint:

MPEG2Source("C:\yourfolder\blah.d2v")orig = lastloadTdeint()Telecide(order=1,guide=1,hints=true,post=1) #1 for Top Field 1st or
order=0 for Bottom.Tdeint(order=1,clip2=orig)Decimate(cycle=5, mode=2)

Hybrid Footage

This stuff is marginally more complicated and you'll need to make a
decision on the nature of your hybrid footage - is it more basic FILM
or more pure interlaced NTSC? This will govern how the thing is
Decimated. If it's more FILM then you can decimate it easily (like with
regular Telecine) but if it's more pure interlacing then doing so will
make all the motion jerky so you need to be careful. Note that Hybrid
Sources basically are an NTSC phenomenon so there's no PAL option here.

Note that this will blend the frames in the pure interlaced
areas to keep the smoothness of the motion at 23.976fps. On the Hybrid
source I was messing with earlier, Super GALS these settings seem to
work pretty well but I didnt go into it too thoroughly.

However, if there are too
many pure interlaced sections then you will get far too much blending
and you want to avoid that if you can. Using Decimate
mode 2 stops the blending but gives you jerky motion - if you don't
want blending or jerky motion treat it as 'mostly pure interlaced':

The two changes to notice here are that there is no pattern guidance
and no decimate cycle. This method will give you 29.97fps footage
with
progressive frames restored as best as telecide can manage. Extra
smoothness can be
obtained by using Telecide(order=1, post=4)

With Hybrid footage some parts of your video stream will have to be
deinterlaced - these are the pure interlaced parts. Decomb contains
pretty decent adaptive deinterlacing in its post-processing options and
the settings I've referred to here should be fine. If, however, you
find that the deinterlacer is hurting good frames or isn't catching all
the deinterlacing then you should tweak the vthresh and dthresh
options in Telecide. These are advanced settings that you
should refer to the Decomb 5 Reference Manual and the Decomb 5 Tutorial
pages for full explanation about how this works.

If you have lots of pure interlaced frames and decomb isn't helping
then it may be best to just treat it like completely pure interlaced
material.

The third way:

If you have hybrid footage and Decomb is getting you nowhere
fast then the answer for you is to use BlendBob. BlendBob works in a
similar but opposite way to decomb - where decomb tries to match fields
and deinterlaces when it can't, BlendBob bob deinterlaces all the
fields and then does the matching, blending the matched fields together
or discarding on if they don't match. This is very very effective at
getting rid of interlacing but it should be used only when decomb fails
because decomb does produce better wuality when it works well.

You can actually use any bob function provided you set it to output
double framerate. TDeint gives the best results in my tests but KernelBob is also a good option (and much
faster than TDeint).

Half Field
Blended Fooatage

This is where no solution will ever be satisfactory and is where you
will really want to experiment as much as possible to find a solution
you are happy with. This will often vary from source to source but here
are some approaches that I found useful:

These settings I found to really help reduce the prevalence of
the
blending (frames that contained blends were often removed during
decimation) but this approach would often leave the footage looking
very jerky in scenes with
linear motion. Some scenes were so jerky they were unusable and so I
generally had a second avisynth script importing footage and doing a
different approach for scenes where I wanted to retain smoothness of
motion:

[Note, if you are doing to be converting your
footage to RGB32 for editing then you can use ConvertToRGB32(interlaced=true) instead and avoid converting twice.]

This is full deinterlacing and worked well on the particular source I
was using at the time - other methods may work better for your
sources so you should refer to the section on pure interlacing or even
the method used in 'mostly pure interlaced' for some
alternative approaches. In particular TDeint and/or BlendBob should
also work well. Note that the 2nd script produces 29.97fps
footage - you can use the assumefps in avisynth to make it match the
first script for editing.

Note well: if you try any bob deinterlacing on this kind
of footage it can often produce situations where you have different
parts of an image moving in different frames which looks really nasty.
There is no quick fix with this kind of footage and there
is definitely no perfect solution, only different ways with different
pros and cons. When you have footage this bad, you have to experiment -
try as many methods as you can to see which works best.

Full Field
Blended Footage

Unfortunately, I do not have much hands-on experience of this kind of
footage. I can, however, give you some pointers.

PAL users:

- Use one of the deinterlacing options described in
the 'pure interlacing' section below. They will not remove the blends
but will retain the smoothness of the footage.
- Use TDeint (see below) as its motion compensation can massively
assist with blended footage.
- Try removing the blending (see below)

NTSC users (less likely):

- Try treating it just like the half-field blending
type above and see how it comes out.
- If you don't mind the blends then try treating it as pure interlaced.
- Use TDeint (see below) as its motion compensation can massively
assist with blended footage.
- Try removing the blending (see below)

Pure Interlaced
- Deinterlacing options

When you have a source where looking for progressive frames is mostly
futile, it is often best to just attempt to deinterlace the source.
There are many different ways to deinterlace things and, like many
things, the best method will depend on your source.

Adaptive and Motion Compensated Deinterlacing:

These techniques generally search for areas of movement and deinterlace
those
areas or, from the other viewpoint, search for areas without motion and
leave them alone. It's a useful approach but is often made difficult by
the fact
that it is so easy to have false matches. If you set the threshold too
low
you get interlacing coming through... too high and you start messing
with frames that were decent to start with. It's problematic but these
techniques are worth a shot to see if they can help you out.
There are a number of deinterlacers that use this approach:

FieldDeinterlace()- this is the Avisynth Version of the
old virtualdub Smart Deinterlacer. You will want to tweak the
thresholds of this manually to fit your source if you use it. The
numerous parameters are described in the Decomb 5 Reference Manual.
I've never
really found this deinterlacer to give me entirely satisfactory results
but different sources require different methods so you should
experiment. Each source is different so any of these deinterlacers
could give the best results.

SmoothDeinterlace(tff=true,
doublerate=false) - this is an
updated version of the old Area
Based Deinterlacer and I think it's pretty decent at what it does. You
need to specify field
order and it will only accept YUY2 or RGB32 footage so you will want to
use something like:

[If you are going to be converting your
footage to RGB32 for editing then you can use ConvertToRGB32(interlaced=true) instead and save converting it twice.]

KernelDeint(order=1, threshold=10) - This is a nice new deinterlacing
approach. Order is just like the same setting in Telecide. 'Threshold'
detects motion areas for deinterlacing - if too many areas are being
deinterlaced then increase the threshold; if too few then reduce it. As
with all Donald Graft filters, the settings are well documented and can
be found in the start menu.

TomsMoComp(1,5,1) - This
deinterlacer uses both adaptive
and motion compensated deinterlacing and is generally considered to be
a pretty worthy all-rounder and the deinterlacer everything else is
compared to.
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.

Bobbing and Field Interpolation Deinterlacing:

This is a technique that takes the fields and resizes them to full
frame size. That's the start at least. Different bob deinterlacers do
all sorts of different things after that that give different results.
If you have a problem with interlacing appearing in your video with
other methods then bob deinterlacing will definitely get rid of that -
unfortunately they have other problems such as shimmering, aliasing
(jagged edges) and so on but they are worth trying out as they are
usually smooth and almost always interlacing free. Note that some
bobbing methods double the framerate and so Decimate(2) has been added to the end to keep these
29.97fps. You can remove this if you so desire.

DGbob(order=1,mode=0) - Order is just like with Telecide.
Mode=0 will keep the frame rate the same as the source although it
works best at double framerate (mode=1) you may not want to edit with
that. For tweaking read the DGBob Help documentation in the amvapp
start menu directory.

SangNom(order=1,aa=32)
- Very different approach -
not your usual bob at all. This filter interpolates fields and is very
powerful when dealing with pure interlaced material. Order means field
order just like Telecide,
aa means Anti-Aliasing and will try to smooth out those lines when
interpolating making it particularly useful for anime. Can be very
pretty.

ConvertToYUY2(interlaced=true).SSTomsMoComp("tff") - tff obviously for
Top Field First, replace with "bff" as required. This is a 29.97fps bob
that uses a mix of supersampling and TomsMoComp. Works pretty well imo.

KernelBob(4).Decimate(2)- Bob deinterlacer that takes advantage
of kerneldeint's processing. The number is the threshold used - see
KernelDeint.

TMCkernelbob(th=7,tff=true).Decimate(2) Another bob deinterlacer which uses both
TomsMoComp and KernelDeint for constructing the frame. th is threshold
(deafult 7) and tff is Top Field First - true or false.

LoadTDeint().TDeint(mode=0,order=1) Tdeint is a bob deinterlacer that uses motion
adaptation and all kinds of interesting interpolation tricks. This is a
really excellent bobber and worth trying. mode=0 outputs the
original framerate, mode=1 outputs double framerate.

LoadTDeint().TDeint(mode=1,order=1).BlendBob()
BlendBob is a special way of processing bobbed footage that tries to
match fields from the same original frame and blends them to restore
the original quality. Can work with any bobber set to output double
frames - simply replace the TDeint commands with one of the bobbers
above.

Removing
Blending

This is complicated stuff and success is the exception not the rule. I
can give you some general pointers but a lot of this is advanced and
experimental so you are largely on your own. Essentially the theory
goes like this:

1) Do bob deinterlacing
2) Find the frames which are blended
3) Compare them to their neighbours
4) Use this comparison to construct the original frames if possible
5) Decimate to get the original framerate.

There have been a few attempts at doing this: Unblend, RePal,
Restore24, UnblendPattern and PFR (Progressive Frame Restorer). RePal
is for footage that was originally
pal and converted to NTSC, however, so it's unlikley to be any use for
anime.

Here's an example of how you would try removing blending on PAL footage.

KernelBob(4) #or some other
frame-doubling bob deinterlacer Unblend()Decimate(4).Decimate(3) #to
get the frames back to normal

Frankly if you can work this stuff out then I take my hat off to you.
Doing searched on the doom9 forums for the above filters will give you
clues as to how to attempt this kind of thing but it's not the kind of
filtering that has been acheived with any amazing and easily
duplicatable level of success.

Dealing with
the new FPS

Now that you have successfully made your footage progressive you need
to think about what effect this change has on things. This all depends
on the new framerate.

23.976fps Footage

You have done IVTC on NTSC material and now have progressive frames at
23.976fps. This is good, particularly when editing with programs such
as Vegas which support 23.976fps projects.

Be warned that Adobe Premiere can't handle 23.976fps without
screwing up and yes that includes Premiere Pro (well, mostly...
you'll need to read this page for more
information on that). 23.98fps is NOT
the same as 23.976 and you will get things mistimed and miscalculated.

If you are using
Premiere you basically have two options

1) Convert to 24fps and edit with that or
2) Convert to 29.97fps, have sped up footage and produce progressive
NTSC video.

I use option 1 in all my videos with the exception of some multi-editor
projects where I often create progressive 29.97fps videos just so they
are easy to intergrate with other people's videos.

If you want to edit the video at 24fps then you will need to read this
page on how.

If you want to just edit it as progressive 29.97fps then add AssumeFPS(29.97) after
your have done your IVTC filtering. Remember that your footage is now
progressive so you should set any field rendering options to "no
fields" or disabled.

29.97fps Footage

Your interlacing removal has left you with a 29.97fps source. You can
go straight ahead and edit this as NTSC. It does not have a field order
(set rendering to "no fields" in your editing program) but it can be
considered either top field or bottom field by any playback device so
it is good for converting to DV or MPEG2 or anything you like for
conventions. It's also fine for making internet distribution encodes as
the frames are progressive.

25fps

If you have progressive 25fps footage then you can quite simply edit
with the regular PAL profiles in your editing application. Remember
that field rendering should be set to "no fields" if you now have
progressive frames and that you can
create DV and mpeg2 files with any field order you like as it will be
look the same.

xx.xxfps

If you have a framerate that is not one of the above then you have
either a) Used a bob deinterlacer that has doubled the framerate or b)
done frame decimation on a source that should not be decimated such as
PAL footage. If your answer is a) and you want the framerate returned
then try putting Decmate(2) at the end. If the answer is b) then you
should check your settings and re-read this page - you may be trying to
do something silly like IVTC PAL footage with cycle=5 or do IVTC on a
source that has already been put (incorrectly?) through Force FILM in
DGIndex.

OK so you've now dealt with your interlaced footage, you need to have a
quick think about what to do about Aspect Ratios.