How librav1e is Packaged and Distributed in Linux

This article provides an overview of how librav1e, the library form of the rav1e AV1 video encoder, is packaged and distributed across major Linux distributions. It examines its availability in system package managers, its role as a dependency for multimedia frameworks like FFmpeg, and how users can install it on different Linux environments.

What is librav1e?

librav1e is the shared library version of rav1e, an AV1 document encoder written in Rust. Known for being safe and fast, rav1e is designed to eventually cover all AV1 use cases. While the command-line tool is named rav1e, the library version (librav1e) allows third-party applications like FFmpeg, GStreamer, and VLC to utilize its AV1 encoding capabilities.

Packaging in Major Linux Distributions

Linux distributions package librav1e to comply with their respective shared library standards. Because it is written in Rust, maintainers compile the Rust crate into a C-compatible dynamic library (.so file) and distribute it alongside C header files.

Debian and Ubuntu

In Debian, Ubuntu, and their derivatives, the package is split into runtime and development components: * librav1e-dev: Contains the C header files, static libraries, and pkg-config files needed for compiling software against librav1e. * librav1eX (e.g., librav1e0 or librav1e0.9): Contains the actual shared library (.so) needed to run compiled applications.

These can be installed using the APT package manager:

sudo apt install librav1e-dev

Fedora and Red Hat Enterprise Linux (RHEL)

Fedora and enterprise-grade distributions package librav1e within their official repositories, splitting it into: * rav1e-libs: The runtime shared library. * rav1e-devel: The development headers and tools for building dependent software.

To install these on Fedora, users utilize the DNF package manager:

sudo dnf install rav1e-devel

Arch Linux

Arch Linux takes a simpler packaging approach. It bundles the command-line tool, the shared library, and the development headers into a single package called rav1e in the [extra] repository.

To install it on Arch, run:

sudo pacman -S rav1e

Integration with Multimedia Frameworks

The primary reason Linux distributions package librav1e is to enable AV1 encoding in FFmpeg.

Most distributions compile their official FFmpeg packages with librav1e support enabled (often designated by the --enable-librav1e flag during configuration). When a user installs FFmpeg via their package manager, librav1e is automatically pulled in as a required dependency. This allows users to encode videos using the AV1 codec directly from the command line using FFmpeg.

Distribution via the Rust Ecosystem

For developers who prefer not to use system package managers, the underlying code is distributed as the rav1e crate on Crates.io (the Rust package registry). Developers can add it to their Cargo.toml file, allowing Cargo to download, compile, and link the library statically or dynamically during the application build process.