Decomb Guide

First of all a word of advice. I'm not capturing or encoding Anime. All I tested this on were 2 clips somebody was nice enough to send me and as it turns out these clips worked just fine with the default settings of Decomb but I'll try to explain all the options as good as possible and give you some pointers for further reading material.

You'll need the following software for this guide:

DGDecode
Avisynth
Decomb

Furthermore you should already be familiar with DGIndex -> Avisynth frameserving.

Upon completing the above guide you'll have an Avisynth script that looks something like:

LoadPlugin("C:\PROGRA~1\GORDIA~1\dgmpgdec.dll")
mpeg2source("D:\lain.d2v")
BicubicResize(512,384,0,0.5)

As you can see I've used GordianKnot to generate the script and then simply stripped it of all unnecessary lines. Using GKnot isn't such a bad idea as it makes the whole resizing and script creation game a lot easier. In order to use decomb you first have to load it, so add the following line after the first LoadPlugin line in the script:

LoadPlugin("d:\decomb.dll")

Make sure you include the full path of the dll so that the script can be copied anywhere and will still work. By now your Avisynth script will look like:

LoadPlugin("C:\PROGRA~1\GORDIA~1\dgmpgdec.dll")
LoadPlugin("d:\decomb.dll")
mpeg2source("D:\lain.d2v")
BicubicResize(512,384,0,0.5)

Now we have all decomb options accessible: Telecide, FieldDeinterlace and Decimate. By clicking on the name of any of the 3 functions you'll get to a document explaining every possible parameter in detail.

Telecide recovers progressive frames by field matching and by default it will post process every frame and deinterlace parts of a frame where combing (interlacing) effects can still be found.

FieldDeinterlace contains the postprocessing functionality of Telecide and should only be used on purely interlaced streams that have not been telecined. Most DVDs have been telecined in some way and are based on progressive sources so you shouldn't use this option on such clips. Truly interlaced clips are stuff you capture with your camera, and TV shows originally shot for TV (modern TV series are now often shot on film - 24fps progressive rather than 29.97 or 25fps interlaced).

Decimate well remove duplicate frames after postprocessing and adjust the framerate accordingly. If you have an interlaced or telecined PAL source this parameter is useless as you want to keep the original framerate.

 

Now let's have a look at a couple of examples:

1) a regular telecined source:

Telecide(order=0)
Decimate(cycle=5)

are the lines to be added before cropping or resizing the source. The number behind order signifies the field order (more about how you can figure this one out in a second) In our example the full script would look like this:

LoadPlugin("C:\PROGRA~1\GORDIA~1\dgmpgdec.dll")
LoadPlugin("d:\decomb.dll")
mpeg2source("D:\lain.d2v")
Telecide(order=0)
Decimate(cycle=5)
BicubicResize(512,384,0,0.5)

The input is a 720x480 29.97fps Anime source, the output a 512x384 23.976fps progressive movie. If your source is very clean you could use Telecide(post=false) to speed up the process. If you know the source material is NTSC with 3:2 pulldown you can enable pattern guidance by setting Telecide(guide=1). Or if you combine this you'll have:

Telecide(order=0, post=false, guide=1)
Decimate(cycle=5)

A little more advanced script that's especially useful for anime sources would be

Telecide(order=0,guide=1,gthresh=50,chroma=true,threshold=30)
Decimate(cycle=5)

where you can increase gthresh up to 75 if you should experience mouth errors.

Now that you know your way around Decomb, here is a script that allows you to figure out the field order:

LoadPlugin("C:\PROGRA~1\GORDIA~1\dgmpgdec.dll")
mpeg2source("D:\lain.d2v")
AssumeTFF().SeparateFields()

Save this script and load it into VirtualDub or a media player that allows you to step through the video frame by frame. Find an area with constant motion (a pan would be a good scene), and step through that scene frame by frame. If the video constantly moves forward as you'd expect it, then the field order is top field first, so order has to be set to 1. If the video jumps back and forth as you proceed to advance frame by frame, your video is bottom field first and order has to be set to 0.

2) a purely interlaced source

LoadPlugin("C:\PROGRA~1\GORDIA~1\dgmpgdec.dll")
LoadPlugin("d:\decomb.dll")
mpeg2source("D:\lain.d2v")
FieldDeinterlace(full=false)
BicubicResize(512,384,0,0.5)

As output we get a 512x384 29.97fps progressive movie. As an alternative to FieldDeinterlace, you can use KernelDeint. Using KernelDeint, the above script becomes the following:

LoadPlugin("C:\PROGRA~1\GORDIA~1\dgmpgdec.dll")
LoadPlugin("d:\kerneldeint.dll")
mpeg2source("D:\lain.d2v")
KernelDeint(order=0)
BicubicResize(512,384,0,0.5)

where order is the field order as explained under 1)

3) a hybrid source (that is a source containing both progressive and interlaced parts)

LoadPlugin("C:\PROGRA~1\GORDIA~1\dgmpgdec.dll")
LoadPlugin("d:\decomb.dll")
mpeg2source("D:\lain.d2v")
Telecide()
Decimate(order=0,mode=1,threshold=50)
BicubicResize(512,384,0,0.5)

In this case Telecide will only be used to determine what to do with frames that would normally be dropped, and the output will still be 29.97fps.

4) a source containing subtitles

LoadPlugin("C:\PROGRA~1\GORDIA~1\dgmpgdec.dll")
LoadPlugin("d:\decomb.dll")
mpeg2source("D:\lain.d2v")
Telecide(order=0,y0=420, y1=480)
Decimate(cycle=5)
BicubicResize(640,272,0,0.5)

In this example we have a 1:2.35 16:9 720x480 NTSC source containing subtitles in the black bars area of the screen and we want to exclude the subtitles from the field matching so we exclude the lower black bar area using the y0 and y1 parameters.

 

Obviously, we want to go for the first case whenever possible so play around with the parameters.

I would like to thank Nic for sending me some useful links that helped me a lot in preparation of this document. I've used the Decomb reference and Blight's capturing IVTC guide as source for this article.