FFmpeg 7.0: a question of threads

15 April 2024

FFmpeg 7.0

FFmpeg 7.0 was released a few days ago: a major release with numerous new features and a new major version of the APIs.
It features a multi-threaded CLI, a first version of our native VVC decoder, support for EVC decoding and encoding, numerous RISC-V & loongarch optimizations and D3D12 hardware decoding.

Multi-threading FFmpeg

The CLI of FFmpeg is used everywhere and can do so many things. But it’s an ancient codebase, and has many limitations, notably when doing multiple decodes, encodes or filters.
For example, doing ABR ladders for live can be very challenging, because most of the work is sequential.

Anton has been working on this projects for the past couple of years, to be able to decode, demux, mux and encode in their own threads. This work required a lot of cleaning of the codebase, fixing a lot of thread-safety and reentrency issues, but everything got in for FFmpeg 7.0.

You should watch Anton’s talk at VDD 2023 and my talk at FOSDEM 2024 about this multi-threading topic.

VVC decoder

We decided, a couple of years ago, to do our own VVC decoder, instead of using the official vvcdec decoder.
There are many reasons to prefer native decoders inside FFmpeg, notably for better control of the codebase, but mostly because it allows sharing code between decodersi.

The VVC decoder is a large project, notably done by Google Summer of Code students last year, and the main decoder just landed in FFmpeg.

It is not complete, since there a many tools in VVC that are not yet implemented, so it does not decode all streams yet. This is why it is marked as experimental.
However, this will allow people to test VVC, check the errors, the conformance and the speed of decoding, so that the next release will allow us to remove the experimental flag.

D3D 12

We’ve had DxVA2, D3D11 video acceleration since a long time in FFmpeg, and if I recall correctly, it was Laurent Aimar who did the first version for DxVA2.
But the last video decoding API on Windows is D3D12 video acceleration, and it seems that noone cared enough.

Until the Intel team around FFmpeg considered it should be developed, and so we now have MPEG-2, H.264, HEVC, VP9, AV1, VC-1 decoding with the Direct3D 12 video APIs.
Thanks Intel!

Misc features and enhancements

A few other features deserve a mention, notably a first version for the DVD support, the support of QOA or the support for HEIF images.
On the video enhancements side, FFmpeg 7.0 can provide the support for Dolby Vision with AV1 (profile 10) and supports the new AFGS1 Film Grain for MPEG codecs.

We now have support for the new IAMF format from AOM. It is an audio format that is supposed to help fighting the Dolby Atmos hegemony. We’ll see how it goes, but now FFmpeg supports it.

We also have now a new DNN backend, based on libtorch, to run machine learning models directly in FFmpeg.

Finally, a lot of work has been done on the ARM NEON optimizations for our HEVC decoder.
The decoder is, in certain cases, twice faster than it once was, one year ago.
Thanks a lot to Martin and Josh for those improvements.

API changes

Many new APIs have appeared, notably on the Audio Channel layouts, and everything related to IAMF. Quite a few additions for AVStreamGroups, and film grain.

But, because 7.0 is a major release, numerous deprecated APIs have been removed and our ABI has changed compared to 6.1.

Conclusion

This is a strong major release, with the multi-threading work being the most visible part of the work done. However, a lot of features have been merged, and a lot of new features are in preparation, and will be visible next release!

This release is more than 1970 commits, and the diff is around 225kLoC!
Thanks so much to Andreas, James, Anton, Michael, Niklas, Marton, Paul, Stefano, RĂ©mi, Zhao, Lynne, Nuo Mi, and Martin, who are our top contributors for this release!

Have fun testing this release!

Jean-Baptiste Kempf