Communitygithub.com

kadian

End-to-end beat-sync video creation (卡点 / 踩点) for AI agents. Measures a track's real tempo, beat grid, bar lines, sections, drops, breaks, and drum hits to the millisecond; conforms music to target length by whole bars; scans source footage for action peaks and hidden cuts; pre-checks plans before rendering; assembles frame-accurate montages; and audits rendered videos frame by frame (with diagnostic contact sheets and strict A/V sync checks) so you deliver a finished beat-synced video autonomously. Use whenever a user asks to make a beat-synced video (montages, trailers, teasers, ads, lyric/motion-graphics videos via Remotion, code, or footage/AI-generated clips), conform generated music to video length, or fix a video that is off the beat (没卡上点 / 卡点不准 / 不踩点). Needs the kadian CLI and FFmpeg.

kadian 是什么?

kadian is a Claude Code agent skill that end-to-end beat-sync video creation (卡点 / 踩点) for AI agents. Measures a track's real tempo, beat grid, bar lines, sections, drops, breaks, and drum hits to the millisecond; conforms music to target length by whole bars; scans source footage for action peaks and hidden cuts; pre-checks plans before rendering; assembles frame-accurate montages; and audits rendered videos frame by frame (with diagnostic contact sheets and strict A/V sync checks) so you deliver a finished beat-synced video autonomously. Use whenever a user asks to make a beat-synced video (montages, trailers, teasers, ads, lyric/motion-graphics videos via Remotion, code, or footage/AI-generated clips), conform generated music to video length, or fix a video that is off the beat (没卡上点 / 卡点不准 / 不踩点). Needs the kadian CLI and FFmpeg.

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/A1mL3ssNoob/kadian/tree/HEAD/skills/kadian

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

kadian: autonomous beat-sync video production

You cannot hear the music and you cannot see which frame changes without measuring. Every timing decision guessed from a nominal BPM number ("120 BPM", "beat 3") drifts. kadian gives you the full autonomous loop — listen, conform music, scan source clips, pre-check plan, assemble or code-render, audit with numbers and diagnostic frames, and fix until clean — so the user receives a finished beat-synced video without having to act as a manual editor.

Setup

kadian --version || pip install git+https://github.com/A1mL3ssNoob/kadian.git   # or: pip install .
ffmpeg -version                                                                # must be on PATH

If installed as a Claude Code plugin, the package ships with it: pip install "${CLAUDE_PLUGIN_ROOT}". Output is English or Chinese (--lang en|zh, or KADIAN_LANG). Every command accepts --json PATH (or - for stdout).

The autonomous loop

1. Listen once (brief)

Start with a single compact musical map before designing anything:

kadian brief music.wav --fps 30 --json brief.json

This reports tempo (to 0.001 BPM), stability, warnings (tempo_moves, low_bar_line_confidence, maybe_half_tempo), bar-by-bar sections, drops, breaks / pre-drop cutouts, and tier-1 structural anchors. Need the full beat grid or every attack? Run kadian beats music.wav --fps 30 --json beats.json or kadian hits music.wav --tier 2 --fps 30 --json hits.json (pass --stems DIR if you separated stems with kadian stems).

2. Conform music to target duration (conform)

AI-generated music almost never matches your target video length. Never hand-write ffmpeg acrossfade chains (they eat fade duration and shift every downstream beat). Cut strictly by whole bars with pre-downbeat equal-power crossfades and automatic grid re-verification:

kadian conform music.wav --duration 20 --out soundtrack.wav          # auto-pick whole bars keeping intro & drop
kadian conform music.wav --bars "1-4,7-12" --out soundtrack.wav      # or explicit bar ranges

Always confirm post-splice check: ... -> grid OK, then measure soundtrack.wav for all downstream planning.

3. Scan source clips if editing footage / AI-generated clips (clip)

Before cutting live footage or AI-generated video clips (Veo, Kling, Seedance, etc.), scan each clip:

kadian clip clip1.mp4 --fps 30 --json clip1.json

Use active bounds to skip dead static/black head frames, avoid crossing internal_cuts (common hidden cuts inside AI clips), and pick action_peaks (align_source_t) when you want an in-clip movement (jump, turn, punch) to land directly on a beat.

4. Draft and pre-check the plan BEFORE rendering (plan)

Build plan.json exclusively from real measured hits (never BPM arithmetic). You can draft a cue skeleton first and edit it to fit your script:

kadian plan soundtrack.wav --fps 30 --pace medium --out plan.json    # or --clips 10

Then validate plan.json in 0.5 seconds before spending minutes rendering:

kadian plan soundtrack.wav --check plan.json --fps 30 --strict
# Or auto-snap minor timing slips onto real hits:
kadian plan soundtrack.wav --check plan.json --fps 30 --snap plan.json

Only start rendering once plan --check --strict passes (or every remaining warning is intentional). Full format: plan-format.md.

5. Build the video

  • Footage / AI clips / image montage: write a shots.json shotlist and let kadian assemble produce a frame-accurate CFR MP4 + exact matching plan.json in one shot (see code-video.md):
    kadian assemble shots.json --music soundtrack.wav --fps 30 --out out.mp4 --plan-out plan.json
    
  • Motion graphics / UI / lyric video (Remotion, HTML, scripts): load beats.json / plan.json directly into code, round once (Math.round(seconds * fps)), and put the biggest visual change on the beat frame (ease out after it). See code-video.md.

6. Audit the render and self-repair until clean (check --strict --sheets)

Always verify the rendered file with its own muxed sound:

kadian check out.mp4 --plan plan.json --music soundtrack.wav --strict --sheets diag --json check.json
  • Every problem in check.json carries a machine-actionable fix (action, target_frame, delta_frames, target_t).
  • --strict exits 1 on any defect: A/V sync offset (>= 35 ms), cut off by >= 1 frame, ease-in animation peaking early, off-beat moment, heavy moment on a light hit, missed drop/section start, unplanned off-beat jump, too-short crowded cuts (< 250 ms), hierarchy inversion (drop weaker than ordinary cuts), or monotonous mechanical beat-pulsing.
  • Inspect the diagnostic PNG strips in diag/ with your vision tool (gold border = target beat frame B, red border = actual peak frame P) to catch visual defects numbers cannot see (overlapping transition flicker, unreadable text, awkward framing).
  • Fix all issues, re-render, and re-run kadian check --strict until it passes cleanly.

7. Deliver

Deliver out.mp4 directly to the user.

  • If the user wants a quick 10-second ear-check without launching a server, generate a lossless-video click-track copy: kadian preview out.mp4 --out preview_clicks.mp4.
  • Only build an interactive beat map (kadian map ... + kadian serve) if the user explicitly asks to inspect tracks, solo stems, or place frame marks in a browser.

Rules that make an edit feel on the beat

Details and evidence: rules.md.

  • Change ON the beat frame, ease out AFTER it. An element that eases in and stops on the beat peaks 5–15 frames early and feels late and soft. Cut, appear, flash, or pass edge-on exactly on frame f; settle afterward.
  • Real events carry the beat, not decoration. Use scene cuts, camera whips, reveals, lighting shifts, or words appearing — never repetitive card-bouncing or screen pulsing on every beat (check flags this as monotonous).
  • One continuous motion per transition. Flip a single card edge-on on the beat rather than snapping two overlapping hinges.
  • Respect the musical hierarchy. Save your largest visual jump (scene change, drop reveal, title hit) for tier-1 structural hits (drops, section starts). Use breaks / pre-drop cutouts as deliberate visual breathing room so the drop hits harder (check flags weak drops as flat_hierarchy).
  • Stay readable. Give text or UI at least half a beat (usually 1–2 beats); avoid rapid cuts under 250 ms unless they are deliberate kind="tick" flurries (check flags this as crowded).
  • Cut on real attacks, not empty grid lines. Follow kicks (low) and snares (mid) for primary cuts; reserve hi-hats (high, tier 3) for rapid flurries.
  • Sound slightly after picture is okay; sound ahead of picture is not. Detection thresholds are ~45 ms sound-early vs ~125 ms sound-late (ITU-R BT.1359). check enforces <= 35 ms both per-moment and for overall muxed A/V sync (av_offset).

Limits

  • Steady tracks use one straight grid; live/drifting tempo is tracked beat by beat and flagged (tempo_moves). Free-time rubato remains approximate.
  • Double/half tempo ambiguities are flagged (maybe_half_tempo); override with --bpm.
  • Mix band labels (low / mid / high) are approximate when instruments overlap; pass --stems DIR (after kadian stems) for exact kick / snare / hat / bass / vocals roles.

相关技能