The Compressionist's Aha! Moment: '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.
[This article appears in the July/August 2019 issue of Streaming Media Magazine as "The Other Leg, Lanczos."]
Paul Schmutzler explains how you can take advantage of the cost and bandwidth savings of HEVC in your livestreams with the Teradek VidiU Go.
The annual conference for video engineers by video engineers produced must-watch sessions from Akamai, YouTube, Mux, and many others. Here's a survey of useful sessions, along with a link to the video library.
Twitch's Tarek Amara discusses the pros and cons of different codecs for video compression and delivery for live streaming and VOD.
London-based V-Nova has made some impressive claims about Perseus, its compression technology. Streaming Media's preliminary testing shows that it lives up to some of them.
Companies and Suppliers Mentioned