DEV Community

FFmpeg dynaudnorm Filter: Dynamic Audio Normalization Guide

You're editing together clips from three different recording sessions, and every cut brings a jarring volume shift. One speaker whispers, the next shouts, and the background noise floor jumps around.

You could run a two-pass loudnorm workflow targeting EBU R128, but that's designed for broadcast compliance, not general-purpose volume leveling. FFmpeg's dynaudnorm filter solves this specific problem. It applies dynamic audio normalization frame-by-frame, adjusting gain in real time without requiring two-pass processing. You pass a single command, and it smooths out volume differences across your entire file.

How dynaudnorm Works

The dynaudnorm filter divides your audio into short frames, calculates the peak or RMS level of each frame, and applies a gain factor to bring that frame closer to a target level. A Gaussian-weighted smoothing window prevents abrupt gain changes between frames, so transitions sound natural rather than pumpy.

This is fundamentally different from loudnorm. The loudnorm filter measures integrated loudness across the entire file and applies a static correction to hit a target LUFS value (typically -14 or -16 LUFS for broadcast). dynaudnorm doesn't care about LUFS. It operates locally, frame by frame, making quiet parts louder and loud parts quieter relative to each other.

Key Parameters

  • framelen (f) - Frame length in ms (default 500). Use 150ms for speech.
  • gausssize (g) - Gaussian window size (default 31, must be odd). 11-15 for speech.
  • maxgain (m) - Max gain factor (default 10). Set to 3-5 for speech to avoid amplifying silence.
  • peak (p) - Target peak value (default 0.95). Safety ceiling for clipping.
  • targetrms (r) - Target RMS level (0-1). Use ~0.5 for spoken-word.
  • coupling (n) - Channel coupling (default true). Keep enabled for stereo.

CLI Examples

Basic:

ffmpeg -i input.mp4 -af "dynaudnorm" output.mp4

Podcast smoothing:

ffmpeg -i podcast.mp4 -af "dynaudnorm=f=150:g=15:m=5" output.mp4

Aggressive normalization:

ffmpeg -i input.mp4 -af "dynaudnorm=f=75:g=11:m=15:p=0.9" output.mp4

Using dynaudnorm with the FFmpeg Micro API

curl -X POST https://api.ffmpeg-micro.com/v1/transcodes \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": [{"url": "https://example.com/podcast-episode.mp4"}],
    "outputFormat": "mp4",
    "options": [
      {"option": "-af", "argument": "dynaudnorm=f=150:g=15:m=5"}
    ]
  }'

Common Pitfalls

  • Boosting silence into noise - Set maxgain to 3-5 for speech content
  • Using dynaudnorm for broadcast delivery - Use loudnorm for LUFS targets instead
  • Setting gausssize too low - Stay at 11+ to avoid pumping artifacts

Get a free API key and start normalizing audio in minutes.

Comments

No comments yet. Start the discussion.