FFmpeg 2.0.7
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.

The filter accepts the following options:

width, w

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

height, h

Set the output video height 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 w or h is 0, the respective input size is used for the output.

If the value for w or h 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=w=200:h=100

    This is equivalent to:

    scale=200: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=w=2*iw:h=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=w=iw/2:h=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=w=3/2*oh:h=3/5*ih
  • Increase the size, but make the size a multiple of the chroma subsample values:

    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=w='min(500\, iw*3/2):h=-1'