Which resize algorithm to choose for videos?

TL;DR

When sampling down: Use Lanczos or Spline filtering.

When sampling up: Use Bicubic or Lanczos filtering.

These are based on material I've read over the years, and from what I've seen used in the industry. The recommendations may vary depending on content type and application area.

Why does it matter?

It could be argued that the resizing filters don't matter that much when you downscale a video. More importantly, they have an impact on the quality when upscaling, because you need to generate data where there isn't in the first place.

These filters all have only a marginal impact on file size. You therefore shouldn't worry about huge differences there.

Fact is, as always when encoding video, that the result heavily depends on the source material. You can't always predict the result, but just see what works best for you.

Different algorithms

As an example, here's bicubic vs. bilinear interpolation:

     enter image description here

See that bicubic interpolation results in smoother edges? That's a very general statement … but you can find an overview of image scaling algorithms here.

  • Bilinear interpolation uses a 2x2 environment of a pixel and then takes the average of these pixels to interpolate the new value. It's not the best algorithm, but rather fast.

  • Bicubic interpolation uses a 4x4 environment of a pixel, weighing the innermost pixels higher, and then takes the average to interpolate the new value. It's – as far as I'm concerned – the most popular.

  • Area averaging uses a mapping of source and destination pixels, averaging the source pixels with regards to the fraction of destination pixels that are covered. According to this page, it should produce better results when downsampling.

  • Spline and sinc interpolation use higher-order polynomials and are therefore harder to compute than bicubic interpolation. I don't think the overall increase in processing time is worth using them.

  • Lanczos resampling involves a sinc filter as well. It is more computationally expensive but usually described as very high quality and can be used for up- and downsampling.

  • hqx as well as 2xSaI filters are used for pixel-art scaling (e.g. game emulators). I don't think there's a good reason for using them in video.

Jeff Atwood's comparison

It turns out Jeff Atwood did a comparison of image interpolation algorithms. His rule of thumb was to use bicubic interpolation for downsampling and bilinear interpolation when upsampling. That said, this is not what is typically recommended for video encoding – and some commenters have raised doubts about Atwood's expertise in the field.

However, he also mentioned that …

Reducing images is a completely safe and rational operation. You're simply reducing precision and resolution by discarding information. Make the image as small as you want, and you have complete fidelity-- within the bounds of the number of pixels you've allowed. You'll get good results no matter which algorithm you pick. (Well, unless you pick the nave Pixel Resize or Nearest Neighbor algorithms.)

Other examples

Here are some more examples of image interpolation algorithms, including the ones I mentioned above.

I also found documents (scene rules) from the video encoding scene that explicitly ban bicubic filtering for downsampling. Instead, they endorse Lanczos, Spline, or "Blackman" resampling.


I found a good image that documents some of this.

enter image description here

Full size version here.

In general you want a mild sharpening effect when making a larger image into a smaller one, and a mild blurring effect when making a smaller image into a larger one. The MadVR filter set defaults to Lanczos for upscaling and bicubic for downscaling.