Blend two video frames into each other.
The blend
filter 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.
The tblend
(time blend) filter takes two consecutive frames
from one single stream, and outputs the result obtained by blending
the new frame on top of the old frame.
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
- difference128
- divide
- dodge
- exclusion
- glow
- hardlight
- hardmix
- lighten
- linearlight
- 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_opacity. 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:
- 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 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, and0.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).
- shortest
-
Force termination when the shortest input terminates. Default is
0
. This option is only defined for theblend
filter. - repeatlast
-
Continue applying the last bottom frame after the end of the stream. A value of
0
disable the filter after the last frame of the bottom layer is reached. Default is1
. This option is only defined for theblend
filter.
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)'
-
Apply uncover left effect:
blend=all_expr='if(gte(N*SW+X,W),A,B)'
-
Apply uncover down effect:
blend=all_expr='if(gte(Y-N*SH,0),A,B)'
-
Apply uncover up-left effect:
blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
-
Display differences between the current and the previous frame:
tblend=all_mode=difference128