FFmpeg 2.2.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 the following options:

c0

set first pixel component expression

c1

set second pixel component expression

c2

set third pixel component expression

c3

set fourth pixel component expression, corresponds to the alpha component

r

set red component expression

g

set green component expression

b

set blue component expression

a

alpha component expression

y

set Y/luminance component expression

u

set U/Cb component expression

v

set V/Cr component expression

Each of them specifies the expression to use for computing the lookup table for the corresponding pixel component values.

The exact component associated to each of the c* options depends on the format in input.

The lut filter requires either YUV or RGB pixel formats in input, lutrgb requires RGB pixel formats in input, and lutyuv requires YUV.

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".

#

Examples

  • 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)
  • Discard least significant bits of luma:

    lutyuv=y='bitand(val, 128+64+32)'