Fix FFmpeg Loudness Clipping and -14 LUFS Rejection
Broadcast / Ad QC reject: True Peak exceeds -1.0 dBTP (measured +0.3 dBTP after AAC encode) | Audible breathing/pumping on short clips | Unexpected 192000 Hz output sample rate After adding -af loudnorm=I=-14:TP=-1.0:LRA=11 to an FFmpeg command, voiceovers audibly pump and swell on pauses, short 8-to-15-second AI commercials miss -14 LUFS by 2–3 LU, or the final AAC MP4 still fails YouTube, Spotify, or ad-network true-peak limits above -1.0 dBTP.
Single-pass loudnorm always runs in dynamic real-time compression mode (pumping quiet noise floors), internally upsamples audio to 192 kHz without downsampling back unless -ar 48000 is forced, and applies its true-peak ceiling before lossy AAC encoding introduces +0.3 to +0.8 dB of inter-sample overshoot.
Copy-Paste Verified Fix
#!/usr/bin/env bash
set -euo pipefail
# Usage: ./master-loudnorm-2pass.sh input.mp4 output_14lufs.mp4 [target_lufs=-14] [target_tp=-1.5]
IN_FILE="$1"
OUT_FILE="$2"
TARGET_I="${3:--14}"
TARGET_TP="${4:--1.5}"
TARGET_LRA="11"
# Pass 1: Capture exact EBU R128 JSON metrics from stderr
STATS="$(ffmpeg -hide_banner -i "$IN_FILE" \
-af "loudnorm=I=${TARGET_I}:TP=${TARGET_TP}:LRA=${TARGET_LRA}:print_format=json" \
-f null - 2>&1 | awk '/^\{/,/^\}/')"
# Parse the 5 required fields safely via python3 (compatible with Python 3.8+)
eval "$(python3 - "$STATS" <<'PY'
import json, sys
d = json.loads(sys.argv[1])
print("M_I=" + str(d["input_i"]))
print("M_TP=" + str(d["input_tp"]))
print("M_LRA=" + str(d["input_lra"]))
print("M_TH=" + str(d["input_thresh"]))
print("M_OFF=" + str(d["target_offset"]))
PY
)"
echo "Pass 1 measured -> I=${M_I} LUFS | TP=${M_TP} dBTP | LRA=${M_LRA} LU"
# Pass 2: Linear gain conform + explicit 48 kHz resample before AAC encode
ffmpeg -y -hide_banner -i "$IN_FILE" \
-c:v copy \
-af "loudnorm=I=${TARGET_I}:TP=${TARGET_TP}:LRA=${TARGET_LRA}:measured_I=${M_I}:measured_LRA=${M_LRA}:measured_TP=${M_TP}:measured_thresh=${M_TH}:offset=${M_OFF}:linear=true:print_format=summary" \
-ar 48000 -ac 2 -c:a aac -b:a 192k -movflags +faststart "$OUT_FILE"
echo "Master written -> ${OUT_FILE}" Before vs. After (Broken Pattern vs. Verified Fix)
ffmpeg -i commercial.mp4 -c:v copy \
-af "loudnorm=I=-14:TP=-1.0:LRA=11" \
-c:a aac -b:a 192k loud_pumping.mp4
# Causes dynamic gain pumping, 192 kHz filter output quirks, and AAC peaks > -1.0 dBTP # Pass 1: Measure exact integrated loudness, true peak, LRA, threshold, and offset
ffmpeg -hide_banner -i commercial.mp4 -af "loudnorm=I=-14:TP=-1.5:LRA=11:print_format=json" -f null -
# Pass 2: Apply transparent linear gain using Pass 1 measurements + force 48 kHz
ffmpeg -y -i commercial.mp4 -c:v copy \
-af "loudnorm=I=-14:TP=-1.5:LRA=11:measured_I=-20.73:measured_LRA=6.40:measured_TP=-4.10:measured_thresh=-31.12:offset=-0.12:linear=true:print_format=summary" \
-ar 48000 -c:a aac -b:a 192k -movflags +faststart master_14lufs.mp4 Why this works: Passing all five Pass-1 measurements with linear=true applies one clean static gain curve without pumping, -ar 48000 reverts loudnorm’s internal 192 kHz upsampling, and TP=-1.5 absorbs AAC inter-sample overshoot so final peaks stay safely under -1.0 dBTP.
Why This Failure Happens in Real Pipelines
FFmpeg’s loudnorm filter implements the EBU R128 loudness model in two completely different modes: **dynamic** (single-pass) and **linear** (two-pass). Whenever you call -af loudnorm=I=-14:TP=-1.0:LRA=11 without passing measured statistics from an analysis pass, loudnorm has no way to know the clip’s overall integrated loudness ahead of time. It therefore acts like an aggressive short-window automatic gain rider—cranking background hiss between spoken sentences and crushing initial transients on short AI video ads.
A second notorious quirk inside loudnorm is sample-rate upsampling: to compute accurate ITU-R BS.1770 true-peak inter-sample levels, the filter upsamples the audio stream internally to 192,000 Hz and leaves the filter output at 192 kHz. If you omit an explicit -ar 48000 output flag, FFmpeg either feeds 192 kHz straight into an encoder that rejects it or triggers an uncalibrated post-limiter resample right before AAC compression—re-introducing clipping peaks that exceed your -1.0 dBTP target.
Finally, lossy perceptual codecs like AAC (-c:a aac -b:a 192k) alter waveform phase and reconstruct slightly taller inter-sample peaks than the uncompressed PCM limiter saw. Setting the two-pass linear ceiling to TP=-1.5 (giving 0.5 dB of encoding headroom) while forcing -ar 48000 guarantees the final AAC delivery file measures right on -14.0 LUFS with zero audible pumping and true peaks cleanly below -1.0 dBTP.
Step-by-Step Resolution & Verification
- 01
Measure integrated loudness and true peak in Pass 1 without writing output
Run loudnorm with print_format=json and -f null - to collect input_i, input_tp, input_lra, input_thresh, and target_offset across the entire program duration.
- 02
Run Pass 2 with linear=true, TP=-1.5 AAC headroom, and explicit -ar 48000
Feed all five measured values back into loudnorm with linear=true so FFmpeg applies clean static gain instead of dynamic pumping, and set -ar 48000 so the 192 kHz internal rate never leaks downstream.
- 03
Audit the final AAC-encoded deliverable with a third verification probe
Always measure the actual final AAC MP4 (not the pre-encode WAV) to confirm integrated loudness sits within +/-0.5 LU of -14 LUFS and true peaks remain at or below -1.0 dBTP.
ffprobe -v error -select_streams a:0 -show_entries stream=codec_name,sample_rate,channels -of csv=p=0 output_14lufs.mp4 && ffmpeg -hide_banner -i output_14lufs.mp4 -af "loudnorm=I=-14:TP=-1.0:LRA=11:print_format=json" -f null - 2>&1 | awk '/^\{/,/^\}/' aac,48000,2
{
"input_i" : "-14.02",
"input_tp" : "-1.38", # Safely below -1.0 dBTP even after lossy AAC encoding
"input_lra" : "6.40"
} How to Prevent This Error From Recurring
Reserve 0.5 dB true-peak headroom whenever encoding to lossy AAC or MP3
Target TP=-1.5 for web AAC/MP3 delivery (-1.0 dBTP spec) and TP=-2.0 for strict EBU R128 broadcast (-23 LUFS / -1.0 dBTP) so perceptual codec overshoot never triggers automated QC rejection.
Use dynaudnorm or gentle compression before loudnorm on high-crest narration
If raw ElevenLabs or studio voiceover has a massive 18 dB peak-to-loudness ratio, linear loudnorm cannot reach -14 LUFS without hitting TP=-1.5 and falling back to dynamic mode—apply a gentle 2.5:1 compressor first.
Never run loudnorm on clips shorter than 3 seconds
EBU R128 integrated gating requires enough active audio blocks (~3+ seconds) for stable measurement; for 1–2s UI SFX stingers, normalize peaks with alimiter or volume instead of loudnorm.
Troubleshooting FAQs
- Why did FFmpeg loudnorm fall back to "dynamic" even when I passed linear=true?
- FFmpeg automatically reverts to dynamic mode whenever applying pure linear gain to hit your target integrated LUFS would push measured true peaks past your TP ceiling, or when your clip LRA exceeds target LRA. Raising target LRA (e.g. LRA=15) or applying a gentle vocal compressor/limiter beforehand keeps Pass 2 in clean linear mode.
- Why does loudnorm change my audio sample rate to 192 kHz?
- ITU-R BS.1770 true-peak metering requires 4x oversampling (48 kHz x 4 = 192 kHz) to catch peaks sitting between digital samples. FFmpeg leaves the filter output at 192 kHz unless you explicitly append -ar 48000 (or aresample=48000) after loudnorm.
- What LUFS and True Peak targets should I use for YouTube, TikTok, Reels, and broadcast TV?
- YouTube, Spotify, TikTok, and Instagram Reels standardize cleanly on -14 LUFS integrated with <= -1.0 dBTP true peak (mastered at TP=-1.5 for AAC safety). North American TV (ATSC A/85) targets -24 LKFS / -2.0 dBTP, and European broadcast (EBU R128) targets -23 LUFS / -1.0 dBTP.
- Can I pass loudness normalization directly on a stereo music bed before ducking under voiceover?
- Normalize the final mixed master (voiceover + ducked music + SFX) as the very last step rather than independently normalizing music to -14 LUFS and summing it with narration, which would push the combined mix to -11 LUFS and force harsh limiting.
- Does -c:v copy preserve exact video quality during two-pass audio mastering?
- Yes. Using -c:v copy in Pass 2 remuxes the existing compressed video bitstream bit-for-bit in seconds while replacing only the mastered audio track.