Categories: Creative

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

iw/2:ih/2

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

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago