Jump to

Advanced AVISynth Commands and IVTC


Advanced AVISynth Commands:
Now that we dealt with the simpler aspects of just loading our video, we will now see how to IVTC and further process our video.

MJPEG Luma Range:
Luma (brightness) in MJPEG decoders is often decoded incorrectly to the YUV luma-range, a special plugin was written specifically to fix this issue with MJPEG videos. I have not verified if this problem exists with all MJPEG Video Codecs, but the two most popular codecs (PicVideo & Morgan) both suffer from this issue (only when decoding to YUV, decoding to RGB in programs such as VirtualDub doesn't require this fix).

Here's a simple script that fixes this issue:
LoadPlugin("MJPEGcorrect.dll")
AVISource("my_mjpeg_capture.avi")
MJPEGcorrect()


You can obtain the MJPEGCorrect plugin either here or here.

IVTC (Inverse Telecine) and Field Matching:
As many of you that have experimented in IVTC in the past know, IVTCing a video is often a slow and problematic issue. Especially when your source is erratic and possibly even noisy (such as Anime or TV Capture).

Up until late 2001, the only way to properly IVTC video was using TMPEG Encoder or AVIFile. Both these systems were not perfect. They had issues with certain hardware and often broke down, not to mention the IVTC processing speed left much to be desired.

Then Tom Barry, one of the authors involved in the dScaler project took it upon himself to convert his dScaler field matching plugin to the AVISynth platform. The filter is GreedyHMA. The benefits of this filter is that it was CPU Optimized and was quite adaptable.

A few months later, Donald A. Graft, the Author of Telecide (A field matching filter for VirtualDub) converted his filter to the AVISynth platform and modified the code to allow for dropping of duplicated frames (part of the IVTC process) and further optimized it so that it too was quite a bit faster than the older VirtualDub version. His filter is called "Decomb".

Both these filters work well, but Decomb is currently more evolved and as such will be the plugin I will discuss in this article. At this time, the latest version of Decomb is v3.6 and as such some of the parameters may change in a future version. The latest version of Decomb can be found here and possibly on doom9.org as well.

The Decomb plugin is built from two sections:
  1. Telecide, which matches fields in order to reconstruct the original progressive image and filters out fields that can't be matched).
  2. Decimate, which matches duplicate frames after the Telecide process and removes one of these frames to restore the original 23.976 frame rate.
Telecide accepts the following parameters:
Telecide (Reverse Field Matching, Swap Fields, Blend First/Last Frames, DeInterlace Non-Matching Frames, Field Detection Threshold, Field DeInterlace Threshold, Blend instead of Interpolate, Use Chroma Search, Exclude Line Start, Exclude Line End)

Recommended Setting (these are also the defaults if no value is set):
Telecide (reverse=false, swap=false, firstlast=false, post=true, threshold=15, dthreshold=9, blend=true, chroma=false, y0=0, y1=0)

Some of these parameters may not be clear so I will explain them in detail: Note that the field matching Aspect and adaptive deinterlace function makes Telecide perfect for Phase Shifted or Field Blended PAL sources as well.

Decimate accepts the following parameters:
Decimate (Cycle in [n] Frames, Decimate Mode, Hybrid Threshold)

Recommended Setting (these are also the defaults if no value is set):
Decimate (cycle=5, mode=0, threshold=0)

The idea behind Cropping is, you set how many pixels to cut on the left and top sides, and then you set the new width and height so that the bottom and right sides will also get cropped.




PREVIOUS NEXT