Correct Colorimetry

If you're encoding video with CCE (Cinemacraft Encoder) you always want to know what colorimetry your source file uses. If you find that a file has no colorimetry information you can sometimes infer it from the type of video encoding. For example, since all MPEG-4 ASP (DivX, XviD, etc,...) encoders use Rec.601 color, you can safely assume that any video in that format uses Rec.601.

Unlike other encoders, which actually check for colorimetry information in the video stream, CCE assumes the input video uses Rec.601. If you have video encoded with Rec.709 colors it can be converted to Rec.601 without re-encoding. It requires a plugin called ColorMatrix. Like DGDecode and TIVTC it has a DLL file, ColorMatrix.dll, that needs copied to AviSynth's plugins directory before it can be used. If you don't know how to do that, you can find instructions for AviSynth plugins in our AviSynth guide. Although that guide utilizes a different tool (AVSEdit) than we'll be using (AvsP) to write scripts with, it does explain the basics of AviSynth plugins and using them.

AviSynth Commands

A single line in AviSynth will perform the color correction, but it's different for Progressive and Interlaced video.

Progressive Video:

ColorMatrix(mode="Rec.709->Rec.601", hints=true)

Interlaced Video:

ColorMatrix(mode="Rec.709->Rec.601", hints=true, interlaced=true)

Placement In Your Script

You can put the ColorMatrix line either directly after the line that loads your source or right after IVTC. In some cases you may have film based material with pulldown flags mixed with either pure interlaced video or hard pulldown. Since it's neither pure interlaced or pure progressive, you should generally try to figure out which one is prevalent (usually progressive). If it's mostly progressive (ie actual film frames) you should perform a progressive correction after IVTC. If it's primarily true interlaced you should put it immediately after the source and before IVTC. Depending on what parts of your source are film and which are video (interlaced) you might even want to treat them differently. You can apply AviSynth filters to only part of a file by using an aligned splice, but we won't cover that here as all our files don't change in the middle.

Written by: Rich Fiscus