How to Disable Experimental Features in librav1e

This article explains how to disable experimental and unstable features in stable builds of the librav1e AV1 encoder. It covers the specific compilation flags used during the Rust build process, how Cargo features control these capabilities, and how to verify that your build only uses stable, production-ready APIs.

The Compile-Time Feature Flag: unstable

In rav1e and its C-compatible library interface librav1e, experimental features are gated at compile-time. There is no runtime switch or command-line flag to disable experimental features once the library is compiled; instead, you must exclude them during the build process.

The specific flag that controls experimental and non-stabilized features is the Rust Cargo feature named unstable.

To disable experimental features, you must ensure that the unstable feature is not passed to the compiler.

Building librav1e Without Experimental Features

When building librav1e from source using cargo-c (the standard tool for building the C-compatible library), exclude the unstable feature flag from your build command.

To compile a strictly stable release, use the following standard release command:

cargo cinstall --release

Do not include the --features unstable argument. If you are using a custom build script or a package manager configuration, check the Cargo.toml or the build command to ensure --features=unstable or --all-features is omitted.

Default Behavior of Stable Releases

In official, stable releases of rav1e and librav1e obtained from source repositories or package managers: * The unstable feature is disabled by default. * Unless you explicitly pass --features unstable during the build process, the resulting binary and library will only contain stable, production-ready features.

Checking Downstream Integrations (FFmpeg)

If you are using librav1e through FFmpeg, FFmpeg respects the compilation limits of the underlying library. If your librav1e binary was compiled without the unstable flag, FFmpeg will only access stable encoding paths.

To ensure stability when invoking FFmpeg with librav1e, avoid using experimental FFmpeg flags like -strict experimental or -strict -2 unless required for other parts of your command.