Printer Friendly

The Other Leg, Lanczos.

As you may have guessed from the title, this column is about how using the Lanczos filter to scale downward during encoding can increase the quality of your lower-resolution videos. But I'll start with an anecdote about Zero Mostel, an actor and comedian famous for his portrayal of Tevye in Fiddler on the Roof.

As I remember seeing in Reader's Digest as a child, Mostel was hit by a New York City bus, crushing his leg and costing him 4 months in the hospital to avoid amputation. Saving the massively scarred leg was considered a significant medical achievement, and Mostel's doctor asked if he could present his case at a medical meeting. Mostel agreed, and after describing the accident and treatment, the doctor asked him to raise his pant leg to show the result. Mostel did so, and after a moment of awed silence, the physicians applauded wildly. Once the cheers died down, Mostel's doctor sighed and said, "The other leg, Zero."

I had an "other leg" experience while testing how much using the Lanczos filter during downscaling improved the output of the compressed quality. The genesis of this testing was a blog I wrote on the Streaming Learning Center about how the scaling method used to upscale lower-resolution videos for comparing to the source impacted Video Multimethod Assessment Fusion (VMAF), peak signal-to-noise ratio (PSNR), and SSIM scoring. Of course, this didn't change the quality of the actual compressed file, just the metric score, and my point was that you had to use the same technique with all tools to produce consistent results.

One respected compressionist commented, "I always apply FFmpeg with [the] Lanczos method of down-scaling" and supplied the switch "-vf scale=852x480 -sws_flags lanczos." To confirm his premise, I decided to run some tests.

I started at 480p, scaling using the default switch (-s 852x480) and the Lanczos method via the script above. This produced a VMAF difference of less than 1 point, which is probably worth chasing, but nothing to write home about. Then I revised my script to 180p and saw a huge difference between default and Lanczos scaling.

I had been working with gaming footage, so my first test clip was Euro Truck Simulator 2. I thought, "Synthetic footage, idiosyncratic result," so then I tested a talking-head clip and saw the same huge difference--not just in VMAF score, but in side-by-side visual comparisons.

Every compressionist fantasizes about finding the perfect switch, the configuration option that few know about and that will make a huge difference in output quality. I thought I had found mine, but then went back and looked at my command line and thought, "The other leg, Zero." I had fouled up the command line and had been comparing 480p videos scaled with Lanczos to 180p videos scaled using the default switch. Of course there was a huge difference.

So I fixed the command line, ran comparisons on three files (the two above plus the Harmonic football test clip), and produced the average results shown in the table. For perspective, a VMAF differential of 6 constitutes a just noticeable difference. So while I'll probably add Lanczos-based downscaling to the lower rungs of my encoding ladders, it's not something I'll expect my viewers to applaud wildly about.

By Jan Ozer

Jan Ozer ( is a contributing editor to Streaming Media magazine and the author of Learn to Produce Videos With FFmpeg in Thirty Minutes or Less, which is available on Amazon. See for more information. Comments? Email us at, or check the masthead for other ways to contact us.
      Lanczos  Default  Delta

720p   89.23    88.92   0.31
480p   76.03    75.03   0.99
360p   62.53    60.64   1.90
180p   26.51    22.37   4.14
COPYRIGHT 2019 Information Today, Inc.
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 2019 Gale, Cengage Learning. All rights reserved.

Article Details
Printer friendly Cite/link Email Feedback
Title Annotation:The Producer's View
Author:Ozer, Jan
Publication:Streaming Media
Date:Jul 1, 2019
Previous Article:Education in an Era of Immersive Information.
Next Article:Is It Time to Retire the Phrase 'Skinny Bundle'?

Terms of use | Privacy policy | Copyright © 2019 Farlex, Inc. | Feedback | For webmasters