FFmpeg upscale or downscale with auto ratio

Scaling video with FFmpeg can be done with defined width and height like:

ffmpeg -i input.mp4 -vf scale=1920x1080 output_1080p.mp4

Assuming that my video is 16:9 ratio like 1280×720.

However if you didn’t have a conventional ratio like 16:9 and didn’t know the upscaled and down scaled sizes for your videos ratio there is a simple command to do that work for you.

To upscale double of what your original video is

ffmpeg -i input.mp4 -vf scale=iw*2:ih*2 output_double.mp4

iw*2is width x 2, ih*2 means height x 2. You can also times by 3, 4 etc for a bigger size.

Down scaling whilst respecting the ratio is done like:

ffmpeg -i input.mp4 -vf scale=iw*.5:ih*.5 output_half.mp4

This is multiplying by .5 to get half. Another method is to divide by 2


These scaling methods are quick and do auto calculation on width x height based on the original video ratio.