Compressing Noisy Film Scans with librav1e
This article examines whether the librav1e AV1 encoder
can efficiently compress highly noisy or grainy older film scans. It
details the challenges of compressing high-frequency analog noise,
explains how AV1’s Film Grain Synthesis (FGS) resolves these issues, and
provides practical insights on achieving the best balance between file
size and visual fidelity.
The Challenge of Film Grain in Video Compression
Highly noisy or grainy older film scans pose a major challenge for video codecs. Traditional compression algorithms rely on spatial and temporal redundancy—finding patterns within a frame or tracking moving objects across frames to save data.
Film grain, however, is random, high-frequency noise that changes
completely with every single frame. When an encoder like
librav1e attempts to compress raw, grainy footage using
traditional methods, it faces two problematic outcomes: *
Bloated File Sizes: The encoder attempts to preserve
every individual grain particle, forcing the bitrate to skyrocket. *
Severe Artifacts: If the bitrate is constrained, the
encoder will discard the grain, resulting in ugly blocking, smearing,
and a muddy, unnatural image.
How librav1e Efficiently Handles Grain
To compress grainy film scans efficiently, librav1e (the
library interface for the Rust-based rav1e encoder) relies
on the AV1 standard’s most powerful tool for analog content:
Film Grain Synthesis (FGS).
Instead of trying to encode the actual noise, FGS uses a two-step process: 1. Grain Denoising and Modeling: The encoder analyzes the film scan to determine the statistical characteristics of the grain (such as its size, frequency, and intensity across different brightness levels). Once analyzed, the grain is stripped away, leaving a clean, easy-to-compress video. 2. Grain Synthesis: The clean video is encoded at a highly efficient, low bitrate. The mathematical parameters of the original grain are saved as metadata in the video bitstream. Upon playback, the decoder reads this metadata and synthetically regenerates the grain, overlaying it back onto the video in real-time.
By using FGS, librav1e can achieve bitrate savings of
30% to 50% compared to traditional encoding methods while maintaining
the visual appearance of the original, grainy film.
Performance and Tuning with librav1e
While librav1e is capable of handling grainy sources,
achieving optimal efficiency requires proper configuration.
Parameter Tuning
To utilize Film Grain Synthesis in rav1e /
librav1e, you must enable the film grain parameter during
the encoding process. You can specify a photon noise model or use
internal analysis tools to generate the metadata. If FGS is turned off,
librav1e will struggle with noisy film scans, requiring a
very high Constant Rate Factor (CRF) or target bitrate to prevent the
grain from turning into digital compression mush.
Computational Complexity
librav1e is designed with safety and performance in
mind, but analyzing and modeling heavy film grain increases
computational overhead. Encoding highly noisy 4K film scans will require
significant CPU resources. To optimize encoding times, it is often best
to perform the denoising and grain-table generation using external tools
(like photon noise tables or aomenc tools) and
then feed that grain table directly into rav1e during the
encoding pipeline.
Conclusion
librav1e can compress highly noisy older film scans with
remarkable efficiency, but only when leveraging AV1’s Film Grain
Synthesis. Without FGS, the random nature of film grain defeats standard
compression techniques, resulting in massive files. By stripping,
modeling, and synthetically recreating the grain, librav1e
preserves the organic, cinematic look of vintage film at a fraction of
the traditional file size.