FFmpeg 1.2.12
Since* 1.1
#

The filter takes one, two, three or four 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

alpha_expr

the alpha expression

If one of the chrominance expression is not defined, it falls back on the other one. If no alpha expression is specified it will evaluate to opaque value. If none of chrominance expressions 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. Returns 0 if there is no such plane.

cr(x, y)

Return the value of the pixel at location (x,y) of the red-difference chroma plane. Returns 0 if there is no such plane.

alpha(x, y)

Return the value of the pixel at location (x,y) of the alpha plane. Returns 0 if there is no such plane.

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

#

Examples

  • Flip the image horizontally:

    geq=p(W-X\,Y)
  • Generate a bidimensional sine wave, with angle PI/3 and a wavelength of 100 pixels:

    geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  • Generate a fancy enigmatic moving light:

    nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128