---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "Fix FFmpeg amix Cutting Off Silent Closing End-Cards"
description: "Append ,apad onto your shorter voiceover stream inside filter_complex before sidechaincompress/amix, pass normalize=0 plus loudnorm, and let the full-length video stream govern -shortest so silent closing end-cards always play completely."
canonical: "https://framesfield.com/fixes/ffmpeg-amix-cuts-off-end-card"
---

# Fix FFmpeg amix Cutting Off Silent Closing End-Cards

> Append ,apad onto your shorter voiceover stream inside filter_complex before sidechaincompress/amix, pass normalize=0 plus loudnorm, and let the full-length video stream govern -shortest so silent closing end-cards always play completely.

- **Canonical URL:** https://framesfield.com/fixes/ffmpeg-amix-cuts-off-end-card
- **Category:** FFmpeg & Delivery
- **Error Signature:** `Input video: 18.00s (incl. 4s brand end-card) -> Exported MP4 abruptly stops at 14.02s right after narration finishes`
- **Last Verified:** 2026-12-01

## Observed Symptom

You append a 3–4 second static brand logo end-card onto a 15-second AI commercial, mix narration plus background music using amix and -shortest, and the final exported MP4 cuts off abruptly right as the speaker finishes their last word—deleting your brand logo entirely.

## Technical Root Cause

When the voiceover WAV ends at 00:14 while the video stream runs to 00:18, amix defaults to duration=longest OR global -shortest terminates the entire muxer as soon as any unpadded input stream hits EOF—cutting off the silent closing end-card.

## Under the Hood

Audio-visual truncation in FFmpeg is almost always a stream-length mismatch inside `filter_complex`. If Input 1 (voiceover) is 14 seconds long and Input 2 (music) is 20 seconds long while Input 0 (video + end-card) is 18 seconds long, setting `amix=duration=shortest` produces a 14-second audio track, and global `-shortest` then truncates your 18-second video straight down to 14 seconds—slicing off the final 4 seconds of your brand outro.

There is also a subtle second trap with `sidechaincompress` and `amix`: by default `amix` activates `normalize=1`, which divides gain by the number of active inputs (halving vocal volume to -6 dB during speech) and suddenly jumps music volume when one input terminates. Appending `,apad` to the shorter voiceover input extends it with infinite zero-amplitude silence, keeping `sidechaincompress` smooth as music swells gracefully over your closing logo, while letting `amix=duration=longest:normalize=0` + `-shortest` stop on the exact final frame of Input 0 (video).

## Before vs. After

### Broken (Broken Filtergraph (Voiceover EOF Truncates 18s Video at 14s))

```
ffmpeg -i video_18s.mp4 -i vo_14s.wav -i music_20s.wav \
  -filter_complex "[1:a][2:a]amix=inputs=2:duration=shortest[aout]" \
  -map 0:v:0 -map "[aout]" -shortest cut_off_at_14s.mp4
```

### Verified Fix (Verified Full-Duration Mix (apad + normalize=0 + loudnorm))

```
ffmpeg -i video_18s.mp4 -i vo_14s.wav -i music_20s.wav \
  -filter_complex "[1:a]aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo,apad[vo];[2:a]aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo,volume=0.25[bg];[bg][vo]sidechaincompress=threshold=0.03:ratio=6:attack=20:release=350[ducked];[ducked][vo]amix=inputs=2:duration=longest:normalize=0,loudnorm=I=-14:TP=-1.0:LRA=7[aout]" \
  -map 0:v:0 -map "[aout]" -shortest full_18s_endcard.mp4
```

Padding `[vo]` with `,apad` guarantees the voiceover never triggers premature EOF; the music bed smoothly releases from sidechain ducking and carries your 4-second closing logo to the exact last video frame.

## Copy-Paste Fix (fix-amix-endcard-apad.sh)

```bash
# Input 0: full 18s video WITH 4s closing brand end-card
# Input 1: 14s narration WAV (shorter than video!)
# Input 2: background music bed (add -stream_loop -1 right before -i if music is shorter than video)
ffmpeg -y -i video_with_endcard.mp4 -i voiceover_14s.wav -stream_loop -1 -i music_bed.wav \
  -filter_complex "\
    [1:a]aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo,apad[vo]; \
    [2:a]aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo,volume=0.25[bg]; \
    [bg][vo]sidechaincompress=threshold=0.03:ratio=6:attack=20:release=350[ducked]; \
    [ducked][vo]amix=inputs=2:duration=longest:normalize=0,loudnorm=I=-14:TP=-1.0:LRA=7[aout]" \
  -map 0:v:0 -map "[aout]" -shortest \
  -c:v copy -c:a aac -b:a 192k -ar 48000 -movflags +faststart \
  final_full_endcard.mp4
```

## Step-by-Step Resolution

1. **Pad shorter narration streams with ,apad and standardize sample format:** Appending aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo,apad extends the voiceover stream cleanly with infinite zero-amplitude silence after the speaker finishes.
2. **Loop short music tracks cleanly with -stream_loop -1:** Placing -stream_loop -1 immediately before -i music_bed.wav ensures the background music never terminates early either, allowing the full-length video stream (Input 0) to govern -shortest.
3. **Set normalize=0 inside amix and verify duration with ffprobe:** Confirm with ffprobe -show_entries format=duration that final_full_endcard.mp4 matches video_with_endcard.mp4 within 50 milliseconds.

## Verification Check (Verify Output Duration Matches Input Video Duration Exactly)

```bash
ffprobe -v error -show_entries format=duration -of csv=p=0 video_with_endcard.mp4 final_full_endcard.mp4
```

**Expected healthy output:**

```text
18.000000
18.000000   # Both durations must match within 0.05s
```

## Prevention Guardrails

1. **Always put -stream_loop -1 on ambient/music beds and ,apad on voiceover:** Making both audio branches effectively infinite lets Input 0 (the edited video timeline) act as the single unambiguous duration master.
2. **Always pair amix with normalize=0 and trailing EBU R128 loudnorm:** Default amix normalization causes sudden volume surges whenever a shorter voice clip ends mid-mix.
3. **Assert output duration vs input duration in batch delivery scripts:** A 3-line ffprobe check catches silent 4-second truncations automatically before files reach paid ad platforms.

## FAQs

### Why pass normalize=0 inside FFmpeg amix?

By default FFmpeg amix divides volume by the number of inputs (cutting speech in half when mixing 2 tracks) and then shifts gain dynamically when one track ends. Setting normalize=0 plus a trailing loudnorm pass keeps vocal level rock-solid.

### What if my background music track is also shorter than my video?

Add -stream_loop -1 right before -i music_bed.wav so the background bed loops seamlessly up to the exact end of the video stream.

### Can I add a smooth 1-second music fade-out at the very end of the closing logo?

Yes. Append `,afade=t=out:st=17.0:d=1.0` right before `loudnorm` (setting `st` to total video duration minus 1.0 second) so the closing logo ends with a clean broadcast fade.

### Why did my concat pipeline fail earlier when mixing silent B-roll with voiced Veo clips?

FFmpeg concat requires identical audio channel layouts across every segment. Inject 48 kHz stereo silence via `anullsrc` onto silent B-roll clips first using Skill 02.

### What if I want the narration to start 0.5 seconds after frame 0 instead of immediately?

Insert `adelay=500|500` directly before `,apad` on the `[1:a]` voiceover chain (`aformat=...,adelay=500|500,apad[vo]`) so speech enters cleanly half a second into the opening visual hook while preserving your full closing end-card.
