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
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.
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.
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 peakThose are the real numbers for the QFXLAB launch reel after muxing.