Evaluating Video Information

A. Viewing Video Information

After importing it is important to know all the information about the video source. This information is key to knowing what filters will work with the video as it currently is, and if you will need to change anything to make the source compatible with a particular function you intend to use. The easiest way to obtain this information is by adding Info() into the script. This function will display the clip information in the top left corner of the video output.

AviSource("video.avi")
Info()

When it comes to figuring out filter compatibility, the only thing you will need to concern yourself with is the ColorSpace. If you plan to combine multiple clips you will need to pay attention to the ColorSpace, Width, Height, and the frames per second. If you plan on combining clips that have audio then you will have to pay attention to that information as well.

B. ColorSpace and Color Matrix

At this point it is important to cover something that Info() will not display, and that is the color matrix of YV12 videos. The color matrix is used for decoding the YV12 information and displaying it as RGB information. The simplest way to explain a color matrix is that it is the math used to store and retrieve YV12 information.

NOTE: While this information applies to all YUV based colorspaces, YV12 will be the most common of these you will encounter.

If you plan to convert the video to RGB or if you need to convert RGB back to YV12 for encoding, it is important that you use the appropriate color matrix. Rec.601 is the color matrix used for standard definition video and Rec.709 is the color matrix used for high definition video. By default AviSynth uses Rec.601 for everything so you will need to specify Rec.709. Using the wrong color matrix won't cause the video to not work with other filters or prevent it from combining with other clips, but it will slightly alter the color information of the output.

If you need to change the color matrix of a video that is YV12, you will need to convert the colorspace to RGB first. Here are a few colorspace conversion examples:

Converting to RGB from YV12

Example (B-1):

Converting Standard Definition Video

AviSource("videoSD.avi")
ConvertToRGB(Matrix="Rec601")

Example (B-2):

Converting High Definition Video

AviSource("videoHD.avi")
ConvertToRGB(Matrix="Rec709")

Converting to YV12 from RGB

Example (B-3):

Converting Standard Definition Video

AviSource("videoSD.avi")
ConvertToYV12(Matrix="Rec601")

Example (B-4):

Converting High Definition Video

AviSource("videoHD.avi")
ConvertToYV12(Matrix="Rec709")