Time to Start Testing: FFmpeg Turns 4.0 and Adds AV1 Support
FFmpeg turned 4.0 a few weeks ago, an event I planned to leave unheralded until I read Tim Siglin’s latest research report entitled “Real-World HEVC Insights: Adoption, Implications, and Workflows.” In addition to the much more important HEVC-related implementation details, the report states that, of the 406 qualified respondents, 36 percent used FFmpeg in their encoding workflows. Although FFmpeg has certainly weaved its way into my daily encoding chores, I had no idea the overall number was so high, making a major release noteworthy.
What’s in FFmpeg 4.0? You can read through the entire list, but it’s the usual assortment of new codecs and features, including NVIDIA’s NVDEC hardware-accelerated codecs, improved metadata editing, and support for Haivision SRT. What really floated my boat, however, was the addition of AV1 support. Finally, after years of talking about the codec, I could finally run my own tests.
What did I find? Well, the results are mixed. The quality was very good, but encoding times were long and decode requirements seemed very high. How long are encoding times? Well, a 5-second section of Tears of Steel 1080p source footage took 23 hours and 46 minutes to encode (1,426 minutes) on my 48-core HP Z840 workstation using the default speed preset. This translates to 285 hours (and change) to encode one minute of 1080p video. In comparison, encoding with x265 using the “veryslow” preset took about 3 minutes, VP9 using the “0 speed” setting (highest quality) took about 2 minutes, and H.264 using the “veryslow” preset took 10 seconds. So in this simple trial, AV1 took 475 times longer than x265, 713 times longer than VP9, and about 8,500 times longer than H.264.
I will say that during AV1 encoding, FFmpeg consumed only one or two cores on the Z840, and for later trials I was able to encode 10 files simultaneously while only extending encoding time by about 10 percent. But the same is true for VP9, and to a lesser extent, HEVC. Most commercial AV1 encoders will have to divide the video into chunks, encode them separately, and piece them back together to achieve any kind of throughput. Of course, while this reduces linear time, it doesn’t reduce machine time, which translates directly to cost. Any way you look at it, AV1 streams will take an order of magnitude longer in machine time to process, which translates directly into cost.
What about quality? Here I focused on AV1 vs. HEVC. I targeted the AV1 encode at 3Mbps, and the file rendered at 2,854Kbps. I ran several HEVC encodes at different data rates, and a 4,500Kbps HEVC file delivered almost identical video multimethod assessment fusion (VMAF) and peak signal-to-noise ratio (PSNR) quality. So, with my 5-second test clip, AV1 delivered equivalent quality at a 36.58 percent lower data rate. That’s impressive any way you look at it.
Decoding proved less so. Here I switched to my HP ZBook Studio G3 notebook, powered by a single Xeon E3-1505M CPU and NVIDIA M1000M GPU, which likely has both H.264 and HEVC decoding hardware. Then I used FFmpeg to convert the encoded files to Y4M4 format on the notebook’s SSD drive. H.264 converted at 20.6x real time, HEVC at 12.1x, VP9 at 10.2x, and AV1 at 1.0x real time. The AV1 results are close enough to real time to make you wonder if there’s some kind of speed gate in the decoder, which I didn’t have time to explore.
It was right about then that I discovered that FFmpeg had just dropped a new build (4.01). Sigh. With my deadline looming, I punted, and vowed to run more extensive tests on the new build, including asking MulticoreWare if I should tune for PSNR when measuring with VMAF, which I didn’t do for the results cited above. Even if the quality results stand, nothing I saw in AV1 made me think that it would soon be relevant for producers who don’t periodically encode streams viewed by millions of people. If you’d like to see for yourself, check out the newly published 2018 edition of my book, Learn to Produce Video With FFmpeg in 30 Minutes or Less, which covers encoding AV1 and other new features in FFmpeg 4.0
[This article appears in the September 2018 issue of Streaming Media magazine as "FFmpeg Turns 4.0."]
With just a few beginner-level scripts, you can encode and package multiple filds to HLS and DASH output using open source tools.
Is AV1 all that people expect it to be? How much better would HEVC be doing with a fair royalty policy? Look to these charts for the answers to tomorrow's codec questions.
FFmpeg 4.0 gives many video engineers their first chance to test the new AV1 codec against H.264, HEVC, and VP9. The results? In our tests, quality was impressive, but glacially slow encoding times make AV1 a non-starter for most publishers until hardware acceleration becomes available.
For the streaming industry, NAB will be all about HEVC vs. AV1. Here's a look at the most important issues to consider when evaluating the two codecs.
FFmpeg might be a free download, but there's still a cost that goes with it. Robert Reinhardt explains why this encoder isn't right for every company.
Companies and Suppliers Mentioned