FFmpeg 1.2.12
Since* 0.7
#

Scale (resize) the input video, using the libswscale library.

The scale filter forces the output display aspect ratio to be the same of the input, by changing the output sample aspect ratio.

This filter accepts a list of named options in the form of key=value pairs separated by ":". If the key for the first two options is not specified, the assumed keys for the first two values are w and h. If the first option has no key and can be interpreted like a video size specification, it will be used to set the video size.

A description of the accepted options follows.

width, w

Set the video width expression, default value is iw. See below for the list of accepted constants.

height, h

Set the video heiht expression, default value is ih. See below for the list of accepted constants.

interl

Set the interlacing. It accepts the following values:

1

force interlaced aware scaling

0

do not apply interlaced scaling

-1

select interlaced aware scaling depending on whether the source frames are flagged as interlaced or not

Default value is 0.

flags

Set libswscale scaling flags. If not explictly specified the filter applies a bilinear scaling algorithm.

size, s

Set the video size, the value must be a valid abbreviation or in the form widthxheight.

The values of the w and h options are expressions containing the following constants:

in_w, in_h

the input width and height

iw, ih

same as in_w and in_h

out_w, out_h

the output (cropped) width and height

ow, oh

same as out_w and out_h

a

same as iw / ih

sar

input sample aspect ratio

dar

input display aspect ratio, it is the same as (iw / ih) * sar

hsub, vsub

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

If the input image format is different from the format requested by the next filter, the scale filter will convert the input to the requested format.

If the value for width or height is 0, the respective input size is used for the output.

If the value for width or height is -1, the scale filter will use, for the respective output size, a value that maintains the aspect ratio of the input image.

#

Examples

  • Scale the input video to a size of 200x100:

    scale=200:100

    This is equivalent to:

    scale=w=200:h=100

    or:

    scale=200x100
  • Specify a size abbreviation for the output size:

    scale=qcif

    which can also be written as:

    scale=size=qcif
  • Scale the input to 2x:

    scale=2*iw:2*ih
  • The above is the same as:

    scale=2*in_w:2*in_h
  • Scale the input to 2x with forced interlaced scaling:

    scale=2*iw:2*ih:interl=1
  • Scale the input to half size:

    scale=iw/2:ih/2
  • Increase the width, and set the height to the same size:

    scale=3/2*iw:ow
  • Seek for Greek harmony:

    scale=iw:1/PHI*iw
    scale=ih*PHI:ih
  • Increase the height, and set the width to 3/2 of the height:

    scale=3/2*oh:3/5*ih
  • Increase the size, but make the size a multiple of the chroma:

    scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  • Increase the width to a maximum of 500 pixels, keep the same input aspect ratio:

    scale='min(500\, iw*3/2):-1'