FFmpeg 0.7.17
Since* 0.7
#

Add paddings to the input image, and places the original input at the given coordinates x, y.

It accepts the following parameters: width:height:x:y:color.

The parameters width, height, x, and y are expressions containing the following constants:

E, PI, PHI

the corresponding mathematical approximated values for e (euler number), pi (greek PI), phi (golden ratio)

in_w, in_h

the input video width and heigth

iw, ih

same as in_w and in_h

out_w, out_h

the output width and heigth, that is the size of the padded area as specified by the width and height expressions

ow, oh

same as out_w and out_h

x, y

x and y offsets as specified by the x and y expressions, or NAN if not yet specified

a

input display aspect ratio, same as iw / ih

hsub, vsub

horizontal and vertical chroma subsample values. For example for the pixel format "yuv422p" hsub is 2 and vsub is 1.

Follows the description of the accepted parameters.

width, height

Specify the size of the output image with the paddings added. If the value for width or height is 0, the corresponding input size is used for the output.

The width expression can reference the value set by the height expression, and viceversa.

The default value of width and height is 0.

x, y

Specify the offsets where to place the input image in the padded area with respect to the top/left border of the output image.

The x expression can reference the value set by the y expression, and viceversa.

The default value of x and y is 0.

color

Specify the color of the padded area, it can be the name of a color (case insensitive match) or a 0xRRGGBB[AA] sequence.

The default value of color is "black".

Some examples follow:

# Add paddings with color "violet" to the input video. Output video
# size is 640x480, the top-left corner of the input video is placed at
# column 0, row 40.
pad=640:480:0:40:violet

# pad the input to get an output with dimensions increased bt 3/2,
# and put the input video at the center of the padded area
pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"

# pad the input to get a squared output with size equal to the maximum
# value between the input width and height, and put the input video at
# the center of the padded area
pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"

# pad the input to get a final w/h ratio of 16:9
pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"

# double output size and put the input video in the bottom-right
# corner of the output padded area
pad="2*iw:2*ih:ow-iw:oh-ih"