QFX LABMADE UP. MADE REAL. Send a brief

HOME / TRICKS[N° T07] · UPDATED 2026-11-19

Hit −14 LUFS exactly: two-pass loudnorm in ffmpeg

Single-pass loudnorm guesses as it goes and can pump the mix. Measure first, feed the numbers back in linear mode, then verify with ebur128.

Audioffmpeg4 MIN READ

BY · PUBLISHED

Most social and streaming platforms turn playback down to roughly −14 LUFS. A mix that is louder gets turned down and sounds flat; a quieter one sounds weak next to everything else in the feed. ffmpeg's loudnorm filter can land the target exactly, but only in two passes.

Pass 1: measure

MEASURE THE RAW MIX
ffmpeg -hide_banner -nostats -i raw_mix.wav \
  -af loudnorm=I=-14:TP=-1.3:LRA=7:print_format=json -f null -
# prints: {"input_i": "-19.84", "input_tp": "-4.10", "input_lra": "5.60",
#          "input_thresh": "-30.12", "target_offset": "0.27", ...}

Pass 2: apply the measurements, linearly

Feed the measured values back in with linear=true. loudnorm then applies one fixed gain instead of riding the level, so transients and the mix balance stay intact.

MOTIONKIT/SFX_ENGINE.PY (SIMPLIFIED)
stats = json.loads(re.search(r"\{[\s\S]*?\}", pass1.stderr).group(0))
af = (f"loudnorm=I=-14:TP=-1.3:LRA=7:"
      f"measured_I={stats['input_i']}:measured_TP={stats['input_tp']}:"
      f"measured_LRA={stats['input_lra']}:measured_thresh={stats['input_thresh']}:"
      f"offset={stats['target_offset']}:linear=true")
subprocess.run(["ffmpeg", "-y", "-i", "raw_mix.wav", "-af", af,
                "-ar", "48000", "-ac", "2", "-c:a", "pcm_s16le", "master.wav"], check=True)

Verify after encoding

Measure the final MP4, not the WAV: AAC encoding can push peaks up slightly. That is why the target true peak is −1.3 dBTP rather than −1.0.

CHECK THE DELIVERED FILE
ffmpeg -hide_banner -nostats -i reel.mp4 -af ebur128=peak=true -f null - 2>&1 | grep -A12 Summary
#   I:         -14.0 LUFS        <- integrated loudness
#   Peak:       -1.2 dBFS        <- true peak

Those are the real numbers for the QFXLAB launch reel after muxing.

FallbackIf the pass-1 JSON cannot be parsed, run single-pass loudnorm with the same targets. It will be close, but not exact, so always verify.
++++
QFX-BRIEF · ASYNC INTAKEWRITTEN · NO CALLS

Want something like this built for your product?

Send a short brief by email: the product, where the video or game will run, and when you need it. I reply in writing within a day with an approach and a quote for that project.

[email protected] · REPLY WITHIN 1 WORKING DAY