Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the scaling algorithm of the FFmpeg scale filter?

Tags:

ffmpeg

I have upscaled and downscaled an image with following command.

ffmpeg -s:v 1280:720 -r 25 -i input.yuv -vf scale=1920x1080 -c:v rawvideo -pix_fmt yuv420p out.yuv

I'm wondering what kind of scaling algorithm is used to do down scaling (bilinear, bicubic,...)?

and how can I change the filter or add it if there is no filter in this command?

like image 362
Atrin Avatar asked Jan 21 '26 15:01

Atrin


1 Answers

It depends on your FFmpeg version

If using FFmpeg > 4.4, or a build from the git master branch as of commit lavfi/vf_scale: use default swscale flags for scaler, then the default scaling algorithm is bicubic.

If using FFmpeg 4.4 or older

  • When using -vf the default scaling algorithm is bicubic.
  • When using -filter_complex the default scaling algorithm is bilinear.

You can choose the algorithm with the flags option:

-vf scale=1920x1080:flags=lanczos

You can see a list of algorithms with:

ffmpeg -h filter=scale

They will be listed under the -sws_flags option which shows bicubic as the default.

like image 135
llogan Avatar answered Jan 23 '26 21:01

llogan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!