Scale the input video to width:height and/or convert the image format.
The parameters width and height 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 width and heigth
- iw, ih
-
same as in_w and in_h
- out_w, out_h
-
the output (cropped) width and heigth
- ow, oh
-
same as out_w and out_h
- 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.
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.
The default value of width and height is 0.
Some examples follow:
# scale the input video to a size of 200x100. scale=200:100 # 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 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'