Atrin
Atrin

Reputation: 49

What is the scaling algorithm of the FFmpeg scale filter?

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?

Upvotes: 2

Views: 10059

Answers (1)

llogan
llogan

Reputation: 133873

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.

Upvotes: 9

Related Questions