Categories: Creative

Upscaling and downscaling video with FFmpeg

Making a video smaller (downscaling) or bigger (upscaling) with FFmpeg is actually very easy. Here are some FFmpeg commands to help you out:

Upscale with FFmpeg

To change a video file to be 1080p in FFmpeg:

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

This uses FFmpeg scaling with Lanczos resampling. For an excellent source on resampling methods go here.

The 3 main types are:

  • Bilinear
  • Bicubic
  • Lanczos

whilst Lanczos in most cases wont be the sharpest it combines sharpness with smooth to make the footage look better overall, Avoiding blocky footage.

To upscale a video to 1080p whilst encoding it:

ffmpeg -i input.mp4 -vf scale=1920x1080:flags=lanczos -c:v libx264 -preset slow -crf 21 output_compress_1080p.mp4

To upscale to 4k video:

ffmpeg -i input.mp4 -vf scale=3840x2560:flags=lanczos -c:v libx264 -preset slow -crf 21 output_compress_4k.mp4

Downscale with FFmpeg

To downscale video all you need to know is popular dimensions. Given you have a source video of 1280 x 720; 640 x 480, 480 x 360 and 426 x240.

ffmpeg -i input.mp4 -vf scale=640x480:flags=lanczos -c:v libx264 -preset slow -crf 21 output_compress_480p.mp4

All you need to do is change the scale= to the dimension you want, then change the output to indicate the video dimensions.

The end result is going to depend on your source footage. A high bitrate 720p video can look good at 1080p and maybe work at 4k. A low quality 480p will struggle to make it at 1080p.

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