From Avisynth wiki
Jump to: navigation, search

In some filters (BlankClip, Letterbox, AddBorders and FadeXXX) a color argument can be specified. In all cases (except this one) the color should be specified in RGB format even if the color format of the input clip is YUV. This can be done in hexadecimal or decimal notation.

In hexadecimal notation the number is composed as follows: the first two digits denote the red channel, the next two the green channel and the last two the blue channel. The hexadecimal number must be preceded with a $.

In decimal notation the number is as follows: the red channel value is multiplied by 65536, the green channel value is multiplied by 256 and the two resulting products are both added to the blue channel value.

Let's consider an example. Brown is given by R=$A5 (165), G=$2A (42), B=$2A (42). Thus


gives a brown frame. Converting each channel to decimal (remember that A=10, B=11, C=12, D=14, E=14, F=15) gives

R = $A5 = 10*16^1 +  5*16^0 = 165
G = $2A =  2*16^1 + 10*16^0 =  42
B = $2A =  2*16^1 + 10*16^0 =  42

165*65536 + 42*256 + 42 = 10824234

Thus creating a brown frame specifying the color in decimal notation gives


Common named colors can be found in the file colors_rgb.avsi, which should be present in your plugin autoload folder. Thus BlankClip(color=color_brown) gives the same brown frames. See the page Color presets for a visual preview.

Note that black RGB=$000000 will be converted to Y=16, U=V=128 if the color format of the input clip is YUV, since the default color conversion RGB [0,255] –> YUV [16,235] is used.

[edit] color_yuv

  • BlankClip, AddBorders and LetterBox allows specifying colors in YUV format. This is not very well documented (TODO), but if you know the YUV color you want, the math is similar to the above:
color_rgb = (r*65536) + (g*256) + b
color_yuv = (y*65536) + (u*256) + v
Personal tools