Skip to content
FramesField
SKILL.md Developer / Local Tooling SKILL.md
Verified Nov 29, 2026

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

How to install this SKILL.md

Pick Claude Code, Cursor, or Codex below and run the 1-line install command—it downloads the clean, valid YAML-frontmatter SKILL.md directly into your repo so your coding agent applies safe vertical framing and audio ducking automatically.

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.

Compatible agent hosts
Claude Code Cursor Codex
Target tool: FFmpeg · License: MIT
  1. STEP 01
    Pick your coding agent tab below

    Choose Claude Code (.claude/skills/), Cursor (.cursor/skills/), or Codex / shared (.agents/skills/).

  2. STEP 02
    Run the 1-line raw install command

    Downloads the pure YAML-frontmatter SKILL.md directly from /raw/skills/ffmpeg-vertical-captions-and-ducking.

  3. STEP 03
    Ask your agent to render a vertical master

    The agent checks for libass, protects silent end-cards via apad, ducks music automatically, and locks -14 LUFS.

1. Install for your tool

Pick the app you use below for the exact verified command or config—zero manual guessing.

Direct raw file (SKILL.md) ↓
Claude Code (.claude/skills/) bash
Downloads the valid raw SKILL.md directly into .claude/skills/ffmpeg-vertical-delivery/SKILL.md.
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

2. Inspect or download the full SKILL.md file

This is the exact raw file served at /raw/skills/ffmpeg-vertical-captions-and-ducking.

FFmpeg 9:16 Safe-Zone Crop, Subtitle Burn & Audio Ducking Skill SKILL.md
---
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.

3. Test it right away (sample prompt & result)

Sample prompt / input
"Take clips/hero_9x16.mp4, audio/vo.wav, audio/score.mp3, and subs/script.srt and render a TikTok/Reels-safe master."
What happens when it runs
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`.

What you need & known limits

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

Watch out for

  • 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

Frequently Asked Questions

Why did ass=captions.ass fail on my Mac after running brew install ffmpeg?
Homebrew's default ffmpeg formula removed libass subtitle burning. This skill explicitly checks ffmpeg -filters first and guides you to brew install ffmpeg-full (or clean soft-muxed subtitles) instead of crashing.
Why does the filter chain include apad on the voiceover track?
If your narration ends 3 seconds before your video finishes (for example, over a silent closing logo end-card), omitting apad causes -shortest to chop off those final 3 seconds. apad pads infinite silence after the voice finishes so the music swells smoothly until the exact final video frame.
Use this page in AI tools or notes
raw .md