FFmpeg 1.2.12
Since* 1.2
#

Blend two video frames into each other.

It takes two input streams and outputs one stream, the first input is the "top" layer and second input is "bottom" layer. Output terminates when shortest input terminates.

This filter accepts a list of options in the form of key=value pairs separated by ":". A description of the accepted options follows.

c0_mode, c1_mode, c2_mode, c3_mode, all_mode

Set blend mode for specific pixel component or all pixel components in case of all_mode. Default value is normal.

Available values for component modes are:

  • addition
  • and
  • average
  • burn
  • darken
  • difference
  • divide
  • dodge
  • exclusion
  • hardlight
  • lighten
  • multiply
  • negation
  • normal
  • or
  • overlay
  • phoenix
  • pinlight
  • reflect
  • screen
  • softlight
  • subtract
  • vividlight
  • xor
c0_opacity, c1_opacity, c2_opacity, c3_opacity, all_opacity

Set blend opacity for specific pixel component or all pixel components in case of all_expr. Only used in combination with pixel component blend modes.

c0_expr, c1_expr, c2_expr, c3_expr, all_expr

Set blend expression for specific pixel component or all pixel components in case of all_expr. Note that related mode options will be ignored if those are set.

The expressions can use the following variables:

X, Y

the coordinates of the current sample

W, H

the width and height of currently filtered plane

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.

TOP, A

Value of pixel component at current location for first video frame (top layer).

BOTTOM, B

Value of pixel component at current location for second video frame (bottom layer).

#

Examples

  • Apply transition from bottom layer to top layer in first 10 seconds:

    blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  • Apply 1x1 checkerboard effect:

    blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'