FFmpeg 1.1.16
Since* 1.1
#

The filter takes one, two or three equations as parameter, separated by ’:’. The first equation is mandatory and applies to the luma plane. The two following are respectively for chroma blue and chroma red planes.

The filter syntax allows named parameters:

lum_expr

the luminance expression

cb_expr

the chrominance blue expression

cr_expr

the chrominance red expression

If one of the chrominance expression is not defined, it falls back on the other one. If none of them are specified, they will evaluate the luminance expression.

The expressions can use the following variables and functions:

N

The sequential number of the filtered frame, starting from 0.

X, Y

The coordinates of the current sample.

W, H

The width and height of the image.

SW, SH

Width and height scale depending on the currently filtered plane. It is the ratio between the corresponding luma plane number of pixels and the current plane ones. E.g. for YUV4:2:0 the values are 1,1 for the luma plane, and 0.5,0.5 for chroma planes.

T

Time of the current frame, expressed in seconds.

p(x, y)

Return the value of the pixel at location (x,y) of the current plane.

lum(x, y)

Return the value of the pixel at location (x,y) of the luminance plane.

cb(x, y)

Return the value of the pixel at location (x,y) of the blue-difference chroma plane.

cr(x, y)

Return the value of the pixel at location (x,y) of the red-difference chroma plane.

For functions, if x and y are outside the area, the value will be automatically clipped to the closer edge.

Some examples follow: