Skip to content

feat(audio): Add FFmpeg Dynaudnorm Audio Filter

Benny perumalla requested to merge gsoc into master

FFmpeg Dynaudnorm Audio Filter

This merge request introduces a new audio filter plugin that integrates FFmpeg's dynaudnorm (Dynamic Audio Normalizer). This work is part of my Google Summer of Code project.

The filter is designed to solve the common problem of inconsistent audio volume, providing a much smoother and more enjoyable listening experience without requiring constant manual volume adjustments.

The Problem: Inconsistent Audio Levels

Many types of media suffer from a wide dynamic range, which can be frustrating for the listener:

  • Movies & TV Shows: Viewers often struggle with quiet dialogue that is immediately followed by loud explosions, action sequences, or musical scores. This forces them to constantly "ride the volume" remote, turning it up to hear whispers and quickly turning it down to avoid startlingly loud sounds.
  • Podcasts & Interviews: When multiple speakers are recorded with different microphone setups or at varying distances, their volume levels can be inconsistent. A listener might strain to hear one person, only to be blasted by the next speaker.
  • Streaming & Broadcasting: Content is often interspersed with advertisements that are significantly louder than the program audio, creating a jarring experience.

The Solution: Dynamic Audio Normalization

The dynaudnorm filter addresses this by dynamically compressing the audio's dynamic range. It intelligently analyzes the audio in real-time to:

  • Amplify quiet sounds: It boosts the volume of softer sections, like whispered dialogue, making them clear and intelligible.
  • Attenuate loud sounds: It reduces the volume of excessively loud peaks, such as explosions or sudden loud noises, preventing them from being disruptive.

The result is a balanced audio output where the difference between the quietest and loudest moments is reduced, leading to a more uniform and comfortable listening experience across all types of media.

Technical Implementation

This feature is implemented across three main areas:

1. Contrib & Build System:

  • The build system (both Autotools and Meson) has been updated to detect and link against FFmpeg's libavfilter and libavutil libraries.
  • The contrib build process for FFmpeg now ensures libavfilter is compiled, making the dynaudnorm filter available to the application.
  • The new audio filter plugin is conditionally compiled and will only be built on systems where these dependencies are present.

2. Audio Filter Module:

  • A new audio filter plugin has been created, which serves as a wrapper for dynaudnorm.
  • It processes audio by setting up an FFmpeg AVFilterGraph with the following chain: abuffersrc -> dynaudnorm -> abuffersink.
  • The plugin handles audio format negotiation (requesting FL32) and maps channel layouts correctly using AVChannelLayout.

3. User-Exposed Configuration:

To allow for fine-tuning, the following dynaudnorm parameters have been exposed through the filter's options:

  • dynaudnorm-framelen
  • dynaudnorm-gausssize
  • dynaudnorm-peak
  • dynaudnorm-max-gain
  • dynaudnorm-target-rms

4. Detailed Documentation GSoC_Dynaudnorm_Audio_Filter_Report.pdf


Contributors

Mentors

  1. Thomas Guillem
  2. Francois Cartegnie

Documentation_for_Creating_and_Using_Audio_Filters_in_VLC.pdf

Edited by Benny perumalla

Merge request reports

Loading