Skip to content
FramesField
SKILL.md Beginner Setup (1 Command) SKILL.md
Verified Nov 29, 2026

FFmpeg Beat-Sync Montage & Concat Skill

How to install this SKILL.md

Drop into your Claude Code (.claude/skills/), Cursor (.cursor/skills/), or Codex (.agents/skills/) folder to automate BPM-accurate AI music videos, trailers, and beat-locked product montages.

Executable SKILL.md playbook teaching Claude Code, Cursor, and Codex how to trim AI video clips past slow opening settle frames (-ss 0.40), snap every shot to exact musical BPM bar durations at constant 24fps CFR, unify mixed models with subtle 35mm temporal film grain, and mux stereo soundtracks at -14 LUFS with yuv420p +faststart.

Compatible agent hosts
Claude Code Cursor Codex
Target tool: FFmpeg CLI / Suno v6 / Kling 4.0 / Runway Gen-4 · License: MIT
  1. STEP 01
    Install from /raw/skills/<slug>

    Choose your IDE tab below to install the verified YAML-frontmatter SKILL.md cleanly.

  2. STEP 02
    Supply clips + BPM + stereo WAV soundtrack

    Tell your agent your track BPM (e.g., 120 BPM = 0.50s/beat) and ordered silent AI clip folder.

  3. STEP 03
    Render frame-locked -14 LUFS master

    Agent trims slow 0.40s I2V heads, snaps every cut to bar downbeats, adds 35mm grain, and verifies with ffprobe.

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 bash
Installs the pure SKILL.md bytes directly into Claude Code's progressive skill loader:
mkdir -p .claude/skills/ffmpeg-beat-sync-montage
curl -fsSL https://framesfield.com/raw/skills/ffmpeg-beat-sync-montage-and-concat-skill \
  -o .claude/skills/ffmpeg-beat-sync-montage/SKILL.md

2. Inspect or download the full SKILL.md file

This is the exact raw file served at /raw/skills/ffmpeg-beat-sync-montage-and-concat-skill.

FFmpeg Beat-Sync Montage & Concat Skill SKILL.md
---
name: ffmpeg-beat-sync-montage
description: Trim AI video clips past slow 0.40s I2V ease-in frames, snap cuts to exact musical BPM bar durations at constant 24fps CFR, unify mixed models with subtle 35mm temporal film grain, and mux stereo soundtracks at -14 LUFS with Safari-safe yuv420p +faststart. Use when assembling beat-synced trailers, music videos, or fast AI montages with FFmpeg.
---

# FFmpeg Beat-Sync Montage & Concat Playbook

## 1. BPM-to-Seconds Cut Math
Calculate exact cut lengths before trimming any clip:
- `beat_sec = 60 / BPM` (Example at `120 BPM`: `1 beat = 0.50s`, `2 beats = 1.00s`, `4 beats / 1 bar = 2.00s`, `8 beats = 4.00s`)
- Always skip the first `0.35s–0.50s` (`-ss 0.40`) on Image-to-Video clips so every cut enters *in motion* rather than easing out of a frozen frame.

## 2. Normalize Every Cut to Identical CFR, Geometry & SAR (Prevents Concat Glitches)
Never run `-c copy` concat on mixed-model AI clips (`Kling`, `Runway`, `Gemini Omni Flash`, `Wan`) because mismatched SAR, frame rate, or timebases cause frozen frames or audio drift. Re-encode normalized intermediate cuts at near-lossless `-crf 15`:

```bash
ffmpeg -y -ss "$START_OFFSET" -i "$SRC_CLIP" -t "$BEAT_DURATION" \
  -vf "scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080,fps=24,setsar=1" \
  -c:v libx264 -crf 15 -pix_fmt yuv420p -an "$CUT_OUT"
```
*(For 9:16 vertical Reels/TikTok, swap `1920:1080` cleanly to `1080:1920`.)*

## 3. Join Beat-Locked Cuts + Shared 35mm Temporal Grain + -14 LUFS Audio Master
Build `concat.txt` with absolute paths (`file '/abs/path/cut_01.mp4'`), then render one unified delivery master:

```bash
ffmpeg -y -f concat -safe 0 -i concat.txt -i soundtrack_48k.wav \
  -vf "noise=alls=6:allf=t+u" \
  -af "aresample=48000,loudnorm=I=-14:TP=-1.0:LRA=11" \
  -c:v libx264 -crf 18 -pix_fmt yuv420p -movflags +faststart \
  -c:a aac -b:a 192k -ar 48000 -shortest \
  beat_synced_master.mp4
```

## 4. Mandatory ffprobe Verification Gate
Always verify pixel format, constant frame rate, audio clock, and exact runtime before reporting done:

```bash
ffprobe -v error -show_entries format=duration \
  -show_entries stream=codec_name,pix_fmt,r_frame_rate,sample_rate \
  -of compact=p=0 beat_synced_master.mp4
```
Expected checks: `codec_name=h264`, `pix_fmt=yuv420p`, `r_frame_rate=24/1`, `codec_name=aac`, `sample_rate=48000`.

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

Sample prompt / input
Assemble clips s01.mp4..s06.mp4 synced to our 120 BPM Suno v6 WAV (4s opener, three 2s build shots, two 1s climax hits) in 16:9 1080p with 35mm film grain and -14 LUFS loudness.
What happens when it runs
Normalized 6 cuts at 1920x1080 24fps CFR starting at +0.40s offset, joined with noise=alls=6:allf=t+u temporal grain, muxed 48 kHz soundtrack at -14 LUFS.
ffprobe verify: h264 | yuv420p | 24/1 fps | aac | 48000 Hz | duration=12.00s.

What you need & known limits

Requirements

  • Local FFmpeg 6+ installed (ffmpeg -version)
  • Commercial-cleared stereo soundtrack (e.g., Suno v6 Pro/Premier WAV)

Watch out for

  • Always conform mixed-model source clips to shared fps/resolution/SAR before running concat—never use raw -c copy across different AI models
  • Keep grain subtle (alls=5 to alls=7); heavier values bloat H.264 bitrate unnecessarily

What this skill automates inside your coding agent

Cutting mixed-model AI clips to music manually in an NLE takes 45 minutes of repetitive trimming—and naive FFmpeg -c copy scripts snap off-beat by up to two seconds. Installing this progressive SKILL.md gives Claude Code, Cursor, and Codex an exact, live-verified beat-slicing, SAR-normalizing, 35mm grain-unifying, and -14 LUFS mastering pipeline ready to run on any folder of raw clips.

Pair it directly with Workflow 26: Beat-Synced Music Video & Trailer Pipeline and Suno v6 Specs.

Frequently Asked Questions

Why does this skill re-encode each trimmed clip at -crf 15 instead of using fast -c copy?
Stream-copying mixed clips from Kling, Runway, Gemini Omni Flash, and Wan fails cleanly at beat boundaries because cuts snap to arbitrary GOP keyframes (often 1–2 seconds off-beat!) and mismatched timebases break playback. Intermediate -crf 15 cuts give frame-accurate downbeat timing with zero visible generation loss.
Was the exact FFmpeg command tested locally?
Yes. Every flag—including -ss 0.40 beat trimming, force_original_aspect_ratio=increase crop, setsar=1, temporal noise=alls=6:allf=t+u grain, loudnorm, and yuv420p +faststart—was executed and verified via ffprobe on synthetic media.
Use this page in AI tools or notes
raw .md