FFmpeg 0.10.16
Since* 0.7
#

Compute a look-up table for binding each pixel component input value to an output value, and apply it to input video.

lutyuv applies a lookup table to a YUV input video, lutrgb to an RGB input video.

These filters accept in input a ":"-separated list of options, which specify the expressions used for computing the lookup table for the corresponding pixel component values.

The lut filter requires either YUV or RGB pixel formats in input, and accepts the options:

c0

first pixel component

c1

second pixel component

c2

third pixel component

c3

fourth pixel component, corresponds to the alpha component

The exact component associated to each option depends on the format in input.

The lutrgb filter requires RGB pixel formats in input, and accepts the options:

r

red component

g

green component

b

blue component

a

alpha component

The lutyuv filter requires YUV pixel formats in input, and accepts the options:

y

Y/luminance component

u

U/Cb component

v

V/Cr component

a

alpha component

The expressions can contain the following constants and functions:

w, h

the input width and height

val

input value for the pixel component

clipval

the input value clipped in the minval-maxval range

maxval

maximum value for the pixel component

minval

minimum value for the pixel component

negval

the negated value for the pixel component value clipped in the minval-maxval range , it corresponds to the expression "maxval-clipval+minval"

clip(val)

the computed value in val clipped in the minval-maxval range

gammaval(gamma)

the computed gamma correction value of the pixel component value clipped in the minval-maxval range, corresponds to the expression "pow((clipval-minval)/(maxval-minval)\,gamma)*(maxval-minval)+minval"

All expressions default to "val".

Some examples follow:

# negate input video
lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"

# the above is the same as
lutrgb="r=negval:g=negval:b=negval"
lutyuv="y=negval:u=negval:v=negval"

# negate luminance
lutyuv=y=negval

# remove chroma components, turns the video into a graytone image
lutyuv="u=128:v=128"

# apply a luma burning effect
lutyuv="y=2*val"

# remove green and blue components
lutrgb="g=0:b=0"

# set a constant alpha channel value on input
format=rgba,lutrgb=a="maxval-minval/2"

# correct luminance gamma by a 0.5 factor
lutyuv=y=gammaval(0.5)