---
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: "FFmpeg 9:16 Safe-Zone Crop, Subtitle Burn & Audio Ducking Skill"
description: "Drop-in SKILL.md rulebook teaching Claude Code, Cursor, and Codex how to render 1080×1920 Reels/Shorts/TikTok masters with unified safe-zone ASS captions (MarginV=520, MarginR=170), automatic sidechain music ducking that never cuts off closing end-cards (`apad`), and EBU R128 -14 LUFS loudness."
canonical: "https://framesfield.com/skills/ffmpeg-vertical-captions-and-ducking"
---

# FFmpeg 9:16 Safe-Zone Crop, Subtitle Burn & Audio Ducking Skill

> Drop-in SKILL.md rulebook teaching Claude Code, Cursor, and Codex how to render 1080×1920 Reels/Shorts/TikTok masters with unified safe-zone ASS captions (MarginV=520, MarginR=170), automatic sidechain music ducking that never cuts off closing end-cards (`apad`), and EBU R128 -14 LUFS loudness.

- **Canonical URL:** https://framesfield.com/skills/ffmpeg-vertical-captions-and-ducking
- **Raw Payload URL:** https://framesfield.com/raw/skills/ffmpeg-vertical-captions-and-ducking
- **Asset Type:** SKILL.md
- **Compatible Hosts:** Claude Code, Cursor, Codex
- **Target Creative Tool:** FFmpeg
- **License:** MIT
- **Last Verified:** 2026-11-29
- **Source Reference:** https://ffmpeg.org/ffmpeg-filters.html#ass

## Setup & Install

```bash
mkdir -p .claude/skills/ffmpeg-vertical-delivery
curl -fsSL https://framesfield.com/raw/skills/ffmpeg-vertical-captions-and-ducking -o .claude/skills/ffmpeg-vertical-delivery/SKILL.md

```

## Copyable Asset (SKILL.md)

````markdown
---
name: ffmpeg-vertical-delivery
description: Produce unified 1080x1920 vertical Reels, Shorts, and TikTok masters with cross-platform safe-zone ASS captions, voice-triggered music sidechain ducking (preserving silent end-cards with apad), and -14 LUFS EBU R128 loudness conform.
---

# FFmpeg 9:16 Vertical Delivery & Audio Ducking Rules

Whenever asked to render, crop, subtitle, or mix vertical short-form video (TikTok, Instagram Reels, YouTube Shorts), enforce ALL five invariants below:

## 1. Probe FFmpeg Subtitle Support First (macOS Homebrew Guard)
Stock Homebrew `ffmpeg` on macOS often omits `libass`. Always check filter support before burning captions:
```bash
ffmpeg -filters 2>/dev/null | grep -E " (ass|subtitles) "
```
- If `ass` is present: proceed with burned-in ASS captions below.
- If `ass` is missing: inform the user they can install full subtitle support (`brew install ffmpeg-full` on macOS) OR fall back cleanly to soft-muxed subtitles (`-i captions.srt -c:s mov_text`) while still running the 1080x1920 scale + sidechain audio ducking pipeline.

## 2. Canvas & Aspect Ratio Integrity
- Target canvas: exact `1080x1920` (`setsar=1`, `yuv420p`, `libx264`, `-crf 18`, `-movflags +faststart`).
- If input is already native `9:16`, scale directly (`scale=1080:1920:flags=lanczos`)—never add black bars.
- If input is `16:9` (warn user if source height < 2160p about 68.4% pixel loss), center-crop cleanly: `scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,setsar=1`.

## 3. Unified 1080x1920 Cross-Platform Subtitle Safe Band (ASS Format)
Convert `.srt` to `.ass` and inject this exact `[V4+ Styles]` header so captions stay inside `y: 1220–1420 px` and clear of the right `150px` action rail:
```ini
[Script Info]
ScriptType: v4.00+
PlayResX: 1080
PlayResY: 1920
WrapStyle: 2

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: VerticalSafe,Arial,62,&H00FFFFFF,&H002044E0,&H00111111,&H80000000,-1,0,0,0,100,100,0,0,1,3,1,2,80,170,520,1
```
- Wrap dialogue cues to 3–4 words max per line.

## 4. Sidechain Auto-Ducking + `apad` End-Card Guard + 48 kHz Conform
Always include `apad` on the voiceover chain so `-shortest` ends cleanly at the full video length rather than cutting off silent closing brand end-cards when narration finishes early:
```bash
# With libass installed (omit `,ass=captions.ass` if running without burned captions):
ffmpeg -y -i input_video.mp4 -i voice.wav -stream_loop -1 -i music.mp3 \
  -filter_complex "
    [0:v]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,setsar=1,ass=captions.ass[vout];
    [1:a]aresample=48000,highpass=f=80,dynaudnorm=f=150:g=15,apad,asplit=2[vo_mix][vo_sc];
    [2:a]aresample=48000,volume=-14dB[bed_base];
    [bed_base][vo_sc]sidechaincompress=threshold=0.025:ratio=4.5:attack=25:release=300:makeup=1[bed_ducked];
    [vo_mix][bed_ducked]amix=inputs=2:duration=first:dropout_transition=2:normalize=0,
    loudnorm=I=-14:TP=-1.0:LRA=7[aout]
  " \
  -map "[vout]" -map "[aout]" \
  -r 24 -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p \
  -c:a aac -b:a 192k -ar 48000 -ac 2 \
  -shortest -movflags +faststart \
  vertical_master_1080x1920.mp4
```

## 5. Verification Before Returning
Always verify the rendered master with `ffprobe -v error -show_entries format=duration -show_entries stream=width,height,r_frame_rate,pix_fmt,sample_rate -of default=noprint_wrappers=1 vertical_master_1080x1920.mp4` and confirm full video duration was preserved.
````

## Example Input

```text
"Take clips/hero_9x16.mp4, audio/vo.wav, audio/score.mp3, and subs/script.srt and render a TikTok/Reels-safe master."
```

## Expected Output

```text
1. Probes local FFmpeg for `ass` filter support first (warns and suggests `ffmpeg-full` or soft `.srt` fallback if stock macOS brew lacks `libass`).
2. Converts `subs/script.srt` into `subs/safe.ass` with `PlayResX=1080`, `PlayResY=1920`, `MarginL=80`, `MarginR=170`, `MarginV=520`.
3. Runs FFmpeg scaling cleanly to `1080x1920`, applying 4.5:1 voice-triggered sidechain ducking with `apad` preserving the full video/end-card length, and conforming audio to `-14 LUFS / -1.0 dBTP` at `48 kHz`.
4. Runs `ffprobe` verifying exact output duration, `1080x1920`, `24/1` fps, `yuv420p`, and `48000 Hz`.
```

## Requirements

- FFmpeg installed locally; for burned-in ASS captions on macOS install `brew install ffmpeg-full` (stock `brew install ffmpeg` omits `libass`)
- Claude Code, Cursor, or Codex with local terminal execution enabled

## Known Limits

- Font name in the ASS style must exist on the rendering machine (replace `Arial` with `Inter` or `Helvetica Neue` if installed)
- Cropping 1080p landscape footage loses 68.4% of pixels—always prefer native 9:16 video sources for flagship vertical ads

## Implementation Notes

## Pair with our vertical production handbook & workflow

Read the full coordinate geometry behind `MarginV=520` and `MarginR=170` in [Guide 07: Vertical AI Video Systems: Reels, Shorts & TikTok Batch Workflows](/guides/short-form-ai-video-production-system), and test the audio-ducking filter interactively via [Workflow 08: Silent AI Video to Voiced Spot with ElevenLabs & FFmpeg Mix](/workflows/silent-video-to-voiced-spot-pipeline).
