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…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago