FFmpeg 3.4.13
Since* 1.1
#

The filter accepts the following options:

lum_expr, lum

Set the luminance expression.

cb_expr, cb

Set the chrominance blue expression.

cr_expr, cr

Set the chrominance red expression.

alpha_expr, a

Set the alpha expression.

red_expr, r

Set the red expression.

green_expr, g

Set the green expression.

blue_expr, b

Set the blue expression.

The colorspace is selected according to the specified options. If one of the lum_expr, cb_expr, or cr_expr options is specified, the filter will automatically select a YCbCr colorspace. If one of the red_expr, green_expr, or blue_expr options is specified, it will select an RGB colorspace.

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 to 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. Return 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. Return 0 if there is no such plane.

r(x, y), g(x, y), b(x, y)

Return the value of the pixel at location (x,y) of the red/green/blue component. Return 0 if there is no such component.

alpha(x, y)

Return the value of the pixel at location (x,y) of the alpha plane. Return 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
  • Generate a quick emboss effect:

    format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  • Modify RGB components depending on pixel position:

    geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  • Create a radial gradient that is the same size as the input (also see the vignette filter):

    geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray