color

Create a solid color canvas. See Creating Solid Color Background for detail.

  • $_width_, $_height_ and $_fps_ are automatically set according to the video size and fps if deducible (See Video Dimensions and FPS).

  • If not, they must be defined explicitly via <config> (See an example code in Creating Solid Color Background).

  • Same rule applies to the other compositions below.

Attribute

Description

Default

color

Color name in this form

$_bgcolor_

duration

Duration in seconds. Empty for infinite.

width

Width

$_width_

height

Height

$_height_

fps

FPS

$_fps_

alpha

Opacity

1.0

Number of inputs

Number of outputs

Used FFmpeg filters

0

1

color

<config name="shape" value="900x540"/>
<config name="fps" value="20"/>

<stream>
   <composite name="color" duration="3"/>
</stream>

nullsrc

Create a null source canvas.

Attribute

Description

Default

duration

Duration in seconds. Empty for infinite.

width

Width

$_width_

height

Height

$_height_

fps

FPS

$_fps_

Number of inputs

Number of outputs

Used FFmpeg filters

0

1

nullsrc

<config name="shape" value="900x540"/>
<config name="fps" value="20"/>

<stream>
   <composite name="nullsrc" duration="3"/>
</stream>

trim

Trim a video with time.

Attribute

Description

Default

start

Start time in seconds

0

end

End time in seconds

3

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

trim, setpts

<material name="video" path="video.mp4"/>
<stream>
   <!-- remove first and last 2 seconds -->
   <composite name="trim" start="2" end="eval(duration())-2">
      <reference name="video"/>
   </composite>
</stream>

vstack

Vertically stack videos.

Attribute

Description

Default

N/A

N/A

N/A

Number of inputs

Number of outputs

Used FFmpeg filters

any

1

vstack

<material name="video_1" path="video_1.mp4"/>
<material name="video_2" path="video_2.mp4"/>
<material name="video_3" path="video_3.mp4"/>
<stream>
   <composite name="vstack">
      <reference name="video_1"/>
      <reference name="video_2"/>
      <reference name="video_3"/>
   </composite>
</stream>

hstack

Horizontally stack videos.

Attribute

Description

Default

N/A

N/A

N/A

Number of inputs

Number of outputs

Used FFmpeg filters

any

1

hstack

<material name="video_1" path="video_1.mp4"/>
<material name="video_2" path="video_2.mp4"/>
<material name="video_3" path="video_3.mp4"/>
<stream>
   <composite name="hstack">
      <reference name="video_1"/>
      <reference name="video_2"/>
      <reference name="video_3"/>
   </composite>
</stream>

crop

Crop a video.

Attribute

Description

Default

x

Horizontal origin

0

y

Vertical origin

0

width

Crop width

0.5 * iw

height

Crop height

0.5 * ih

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

crop

<material name="video" path="video.mp4"/>
<stream>
   <composite name="crop" x="0.1*iw" y="0.1*ih" width="0.8*iw" height="0.8*ih">
      <reference name="video"/>
   </composite>
</stream>

join

Concatenate videos in time.

Attribute

Description

Default

N/A

N/A

N/A

Number of inputs

Number of outputs

Used FFmpeg filters

any

1

concat

<material name="video_1" path="video_1.mp4"/>
<material name="video_2" path="video_2.mp4"/>
<material name="video_3" path="video_3.mp4"/>
<stream>
   <pipe>
      <composite name="join">
         <reference name="video_1"/>
         <reference name="video_2"/>
         <reference name="video_3"/>
      </composite>
      <composite name="drawtext" text="Hello World"/>
   </pipe>
</stream>

split

Duplicate videos. This is only used in composition, when one needs to re-use the same <input/> multiple times.

Attribute

Description

Default

count

Duplicate count

2

Number of inputs

Number of outputs

Used FFmpeg filters

1

any

split

<function name="my_repeat_twice">
   <pipe>
      <composite name="split" count="2">
         <input/>
         <input/>
      </composite>
      <composite name="join"/>
   </pipe>
</function>

scale

Re-scale video size.

Attribute

Description

Default

scale

Scale ratio

0.5

width

New width

$scale*iw

height

New height

$scale*ih

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

scale

<material name="video" path="video.mp4"/>
<stream>
   <composite name="scale" scale="0.8">
      <reference name="video"/>
   </composite>
</stream>

fps

Change the video fps.

Attribute

Description

Default

fps

FPS

eval(fps())

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

fps

<material name="video" path="video.mp4"/>
<stream>
   <composite name="fps" fps="24">
      <reference name="video"/>
   </composite>
</stream>

format

Change the video format.

Attribute

Description

Default

format

New format

yuva444p

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

format

<material name="video" path="video.mp4"/>
<stream>
   <composite name="format" format="yuv420p">
      <reference name="video"/>
   </composite>
</stream>

fade

Apply fade transition.

Attribute

Description

Default

type

Type, in or out

in

at

When to start

0

duration

Duration in seconds

3

alpha

If set one, only alpha channel fades

1

color

Fade color (set alpha 0 if use color)

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

fade

<material name="video" path="video.mp4"/>
<stream>
   <composite name="fade" color="black">
      <reference name="video"/>
   </composite>
</stream>

extend

Extend a video from both back and front sides. In other words, insert freeze frames at front and back.

Attribute

Description

Default

start_duration

Duration to freeze at front

0

end_duration

Duration to freeze at back

0

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

many

<material name="video" path="video.mp4"/>
<stream>
   <!-- freeze both back and front for 1 second -->
   <composite name="extend" start_duration="1" end_duration="1">
      <reference name="video"/>
   </composite>
</stream>

overlay

Overlay a video onto another video.

Attribute

Description

Default

x

Horizontal position

0

y

Vertical position

0

at

Time to start overlay

0

for

Duration to overlay (empty for infinite)

scale

Scaling of video to be overlaid

1.0

shortest

truncate the whole videos when any terminates (0 or 1)

0

effect

In and out effect

pop

duration

duration for the effect

1

Number of inputs

Number of outputs

Used FFmpeg filters

2

1

overlay and many others

<material name="video" path="video.mp4"/>
<stream>
   <pipe>
      <!-- lay background color -->
      <composite name="color" duration="12"/>
      <composite name="overlay" x="w/5" y="h/3" scale="0.7" effect="dissolve">
         <reference name="video"/> <!-- overlay video at the start -->
      </composite>
   </pipe>
</stream>

transition

Apply a transition over two videos.

Attribute

Description

Default

duration

Transition duration

1

type

Type of transition

fade

Number of inputs

Number of outputs

Used FFmpeg filters

2

1

xfade

<material name="video_1" path="video_1.mp4"/>
<material name="video_2" path="video_2.mp4"/>
<stream>
   <composite name="transition" duration="1" type="smoothleft">
      <reference name="video_1"/>
      <reference name="video_2"/>
   </composite>
</stream>

extended_transition

Apply a transition over two videos (a more high-level composition to transition).

Attribute

Description

Default

duration

Transition duration

1

pause

Duration to pause

1

color

Solid color between videos (empty to skip)

type

Type of transition

fade

Number of inputs

Number of outputs

Used FFmpeg filters

2

1

xfade and many others

<material name="video_1" path="video_1.mp4"/>
<material name="video_2" path="video_2.mp4"/>
<stream>
   <composite name="extended_transition" duration="1" type="smoothleft">
      <reference name="video_1"/>
      <reference name="video_2"/>
   </composite>
</stream>

sidebyside-split

Lay a split side-by-side comparison.

Attribute

Description

Default

border_width

Border width at the center

4

border_color

Border color

$_bgcolor_

direction

Vertical or horizontal

vertical

position

Fractional split postion

0.5

shortest

Terminate the whole video if any terminates

0

Number of inputs

Number of outputs

Used FFmpeg filters

2

1

many

<material name="video_1" path="video_1.mp4"/>
<material name="video_2" path="video_2.mp4"/>
<stream>
   <composite name="sidebyside-split">
      <reference name="video_1"/>
      <reference name="video_2"/>
   </composite>
</stream>

sidebyside-float

Lay a floating side-by-side comparison.

Attribute

Description

Default

margin

Horizontal margin ratio

0.1

head

Top margin

0.1

foot

Bottom margin

0.25

color

Background color

$_bgcolor_

shortest

Terminate the whole video if any terminates

0

Number of inputs

Number of outputs

Used FFmpeg filters

2

1

many

<material name="video_1" path="video_1.mp4"/>
<material name="video_2" path="video_2.mp4"/>
<stream>
   <composite name="sidebyside-float">
      <reference name="video_1"/>
      <reference name="video_2"/>
   </composite>
</stream>

drawtext

Draw a text onto a video.

Attribute

Description

Default

text

Text to draw

hello

font

Optional font path

scale

Font scale

1.0

size

Absolute font size

eval(width()*0.06*$scale)

color

Font color

black

x

Horizontal position

(w-text_w)/2

y

Vertical position

(h-text_h)/2

shift_x

Horizontal shift to x variable

0

shift_y

Vertical shift to y variable

0

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

drawtext

<material name="video" path="video.mp4"/>
<stream>
   <composite name="drawtext" text="Hello World">
      <reference name="video"/>
   </composite>
</stream>

title-slide

Create a title slide.

Attribute

Description

Default

text

Text to draw

hello

font

Optional font path

scale

Font scale

1.0

size

Absolute font size

eval(width()*0.06*$scale)

color

Font color

black

x

Horizontal position

(w-text_w)/2

y

Vertical position

(h-text_h)/2

shift_x

Horizontal shift to x variable

0

shift_y

Vertical shift to y variable

0

Number of inputs

Number of outputs

Used FFmpeg filters

0

1

drawtext and many others

changespeed

Change the video speed.

Attribute

Description

Default

factor

Speed factor

0.5

mode

Interpolation mode

dup

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

minterpolate

<material name="video" path="video.mp4"/>
<stream>
   <composite name="changespeed">
      <reference name="video"/>
   </composite>
</stream>

negate

Invert color of an input video.

Change the video speed.

Attribute

Description

Default

N/A

N/A

N/A

Number of inputs

Number of outputs

Used FFmpeg filters

1

1

negate

<material name="video" path="video.mp4"/>
<stream>
   <composite name="negate">
      <reference name="video"/>
   </composite>
</stream>