Communitygithub.com

koubo-autocut

剪辑对着镜头说英语的口播视频:剪掉停顿、uh / um 和说了一半重来的地方,配很轻的 BGM,烧录中英双语字幕,直接出成片 mp4。 先在本地做带词级时间戳的语音识别,再由你(运行这个 skill 的 agent)读词表、决定保留哪些词并写出英文和中文字幕, 脚本把「保留的词」换算成对齐到帧的剪切点,画面、人声、字幕都从同一份编辑清单推出来。 触发词:剪口播、口播视频、英语口播、剪这条 vlog、对镜头讲话的视频、剪掉卡顿、去掉 uh um、去口癖、 加中英字幕、双语字幕、talking head、jump cut、koubo。

koubo-autocut 是什么?

koubo-autocut is a Claude Code agent skill that 剪辑对着镜头说英语的口播视频:剪掉停顿、uh / um 和说了一半重来的地方,配很轻的 BGM,烧录中英双语字幕,直接出成片 mp4。 先在本地做带词级时间戳的语音识别,再由你(运行这个 skill 的 agent)读词表、决定保留哪些词并写出英文和中文字幕, 脚本把「保留的词」换算成对齐到帧的剪切点,画面、人声、字幕都从同一份编辑清单推出来。 触发词:剪口播、口播视频、英语口播、剪这条 vlog、对镜头讲话的视频、剪掉卡顿、去掉 uh um、去口癖、 加中英字幕、双语字幕、talking head、jump cut、koubo。.

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/BeenLi/koubo-autocut/tree/HEAD/skills/koubo-autocut

在你喜欢的 AI 中提问

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

文档

koubo-autocut: From raw talking-head footage → clean cut with bilingual subtitles

S=<directory containing this SKILL.md>/scripts, invoke with uv run --script $S/<x>.py (dependencies in script header, auto-installed on first run). Working directory W defaults to <raw footage directory>/_koubo; steps communicate only via files in W, each can be rerun independently. Requires local ffmpeg (with libass) and uv.

Core idea: Make editing decisions on words, not on the timeline. You read the word list, decide which words to keep; cut points, subtitle timing, and voice are all derived from this list by the script, so they align naturally.

Step 0: Gather requirements — ask the user all at once before starting

Absolute path to the raw footage, where to put the final video (default next to the footage), whether to use their own BGM track or generate an original one. Note down proper nouns (names, schools, platforms) the user mentions — they'll be needed in subtitles. Don't ask for a target duration: the final length is determined by what's left after removing disfluencies.

Workflow

StepCommandOutput (under W)
1 Transcribetranscribe.py <raw>words.json, and prints a numbered word list
2 Write edit listYou write it (see below)edit.json
3 Compute cutsplan.py <raw>plan.json voice.wav subs.ass
3.5 Self-checkcheck.py --work WDiff table on screen
4 BGM (optional)bgm.py --work Wbgm.wav
5 Mixmix.py --work W [--music track] [--gap 21]mix.m4a
6 Renderrender.py --work W --out <final.mp4>Final video
7 DeliverSpot-check, inform user—

Step 1: Transcribe

transcribe.py uses sherpa-onnx with Parakeet TDT (English), fully local. First run downloads ~480MB model to ~/.cache/koubo-autocut/; let the user know. Each output line is a breath group: [start_sec +interval_to_prev] idx:word …. The model writes out uh / um / mm; large intervals mark pauses. To view the word list again: transcribe.py <raw> --show.

Step 2: Write edit.json (your decision)

A list, each item is one subtitle line:

{"w": [[6,8],[11,13]], "en": "I'm excited to tell you that", "zh": "我很兴奋地告诉大家"}

w = kept word index intervals (inclusive), must be sequential and non-overlapping; words not listed are cut.

Cut: uh / um / mm; restarted fragments; immediately repeated words; the mistaken part in self-corrections. Keep: natural oral connectors like Okay, Yeah, So; sentences that are complete enough even if grammatically imperfect. The user wants "pauses removed", not a rewritten monologue.

  • When something was said twice, keep the one that connects naturally to the following text (usually the second one) for natural intonation. Example: start this … uh this this challenge or this channel → keep start + the final this channel.
  • Each English line ≤ ~45 characters (max two lines). Split long sentences by sense group.
  • Lines ending a sentence must end with . ? !; other lines must NOT end with them. The script uses this to decide sentence breaks and zoom transitions.
  • Write English as spoken; only fix recognition errors and one‑ or two‑word grammar issues (experience → experiences). Do not rephrase.
  • Chinese: translate by meaning, colloquial, not word‑for‑word. No period at line end.
  • Proper nouns (names, schools, platforms) are often misrecognized. Write the most likely spelling, and list them at delivery for the user to confirm.

Step 3: Compute cuts, then self-check

uv run --script $S/plan.py <raw>
uv run --script $S/check.py --work W

check.py re‑transcribes the cut voice and compares it to your kept words. "Missing" → a word was clipped; double‑check that interval. "Extra … ← missed filler" → a filler word is stuck to an adjacent kept word; one or two instances are acceptable; more → widen the interval to include it. "Different" is usually just variation between runs; ignore. Edit edit.json and rerun both commands.

Only edit edit.json, never words.json. The word list is the raw recognition result; indices and timestamps are the ground truth. Inserting, deleting, or changing timestamps will break all downstream cut calculations. When self‑check hears words not in the word list (unrecognized uh, repeated "to"), you can only: cut the surrounding words together, or accept them in the final video. Self‑check at most 2–3 rounds; if 1–2 remain, stop and tell the user at delivery.

Common plan.py parameters: --max-pause 0.45 (shorter pauses kept as‑is; larger = more relaxed, smaller = tighter), --zoom 1.05 (1 = no zoom), --size 1080x1920, --en-size --zh-size, --margin-v (distance from bottom).

Default subtitle style is fixed: Source Han Sans Bold (font shipped with the skill), English white on top, Chinese warm yellow below, black outline, bottom‑centered. Don't change unless the user asks; for font changes see references/pitfalls.md.

Steps 4–5: BGM and mix

User provided track: mix.py --work W --music <track>. No track: first bgm.py --work W to generate an original pad, then mix.py --work W. Do not download music from unknown sources. If the user says music is too loud/soft, adjust --gap (dB lower than voice; higher = softer), rerun mix.py and render.py … --join-only (no need to re‑render video). No music at all: mix.py --work W --no-music.

Step 6: Render

uv run --script $S/render.py --work W --out <final.mp4>

4K footage renders roughly real‑time. For time‑limited environments: --chunk-span 90 to split chunks; to run on another machine: --emit, which writes W/render.sh, then run bash render.sh 0, 1 …, bash render.sh join <final> on that machine (override source path with --src if changed).

If only subtitle text changes (e.g., corrected a name): edit edit.json → rerun plan.py → rerun render.py; mixing stays untouched.

Step 7: Pre‑delivery check

  • Final duration should equal plan.json's out_seconds.
  • ffmpeg -ss <sec> -i final -frames:v 1 x.jpg — grab 2–3 frames to check subtitles: placement, no triple lines, Chinese not rendered as boxes (only happens if font was changed; see pitfalls).
  • You can't hear audio: ask the user to check BGM quality/volume and any remaining uh.

Tell the user: final path, original → final duration, proper nouns needing confirmation, three adjustable settings (BGM volume / swap track, subtitle size/position, zoom toggle). The W directory is intermediate files; can be deleted after confirming the final video.

More

Common pitfalls and rationale behind each parameter are in references/pitfalls.md; check it first if modifying the script or if results look wrong.

相关技能