Communitygithub.com

视频-轮次清理剪辑 — 第一步剪辑流水线

AI 视频编辑器的第一步:将原始说话头视频素材转化为干净的主剪辑。适用于用户需要“清理剪辑”、“剪辑原始素材”、“去除填充词/死音/糟糕镜头”、“加快节奏”、生成 cuts.json、运行剪辑编辑器、或为本仓库中的 video-N 项目渲染清理预览/主剪辑的场景。

视频-轮次清理剪辑 — 第一步剪辑流水线 是什么?

该技能是 AI 视频编辑器流水线的第一步,专注于将原始说话头视频素材转化为干净的主剪辑。它处理音频提取、AssemblyAI 转录、编写 cuts.json(包含保留/剪辑/冗余分类)、剪辑策略(内容激进、停顿自然约 0.5 秒)、QA 和审查文档、本地剪辑编辑器 UI、紧凑和自然预览、最终 4K60 渲染,并生成 edited-transcript.json 作为传递给 /make-tsx 的交接文件。该技能适用于 Claude Code、Cursor 和 Codex 等 AI 代理平台,通过利用 AssemblyAI 进行 ASR 并强制执行基于内容相关性和自然停顿的剪辑策略来确保精确剪辑。关键特性包括通过 RMS 包络交叉检查对 ASR 时间错误的鲁棒处理、自动检测双重短语和幽灵语音,以及强制性的机器验证步骤,确保渲染文件与预期保留的单词完全匹配。该技能高度迭代,包含用户审核门控和严格的 A/V 持续时间检查,以确保输出完整性。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/raisaksham377-bot/youtube-shorts-ai-editor/tree/HEAD/.claude/skills/clean-cut

在你喜欢的 AI 中提问

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

文档

clean-cut — 第一步剪辑流水线

将项目原始素材(videos/video-N/DJI_*.MP4)转化为干净主剪辑 + edited-transcript.json(每个后续步骤依赖的词级时间主干)。单一真相来源是 videos/video-N/work/analysis/cuts.json — 由 Claude 和编辑器 UI 共享。每个工具位于 tools/ 中,并将项目目录作为其第一个参数。

你(Claude)通过阅读转录来编写剪辑。 没有单独的 LLM 调用。工具处理音频、编码、QA 和编辑器;判断 — 什么是重拍、错误开始、填充词或冗余 — 是你的职责。

流水线(按顺序运行)

设 P = 项目(例如 video-1)。素材 id = 简短句柄(0233);每个素材的所有工件按该 id 命名(0233.wav、0233.json)。原始 MP4 路径在 cuts.json 中按素材存储为 file。

  1. 提取每段素材的 16 kHz 单声道 WAV → P/work/audio/<id>.wav(用于转录 + RMS 噪底 / 对齐音频尾部)。无需脚本 — 对每个素材运行 ffmpeg: ffmpeg -i videos/video-1/DJI_...0233_D.MP4 -vn -ac 1 -ar 16000 videos/video-1/work/audio/0233.wav

  2. 为本视频草拟关键词 → P/work/keyterms.txt(在转录前完成)。关键词将识别器偏向本视频的专有名词/产品/技术名称,以免被误识别(例如 "Seedream" 而非 "sea dream","Cloudflare" 而非 "cloud flare")。这里的准确性至关重要:转录文本驱动剪辑决策,而 /make-tsx 搜索它以找到短语时机——误认的术语会破坏两者。根据视频主题/标题,列出大约 10–40 个可能的品牌名称、工具、技术和行话,每行一个(空行和 # 注释被忽略)。这是针对每个视频的——切勿在 transcribe.py 中固化术语。 如果你跳过该文件,转录仍会运行(空后备),只是专业词错误更多。格式为每行一个术语:

    # 本视频中提到的工具+品牌
    Claude Code
    Remotion
    AssemblyAI
    ElevenLabs
    Cloudflare
    
  3. 转录(需要 .env 中的 ASSEMBLYAI_API_KEY;逐字转录,保留填充词;自动加载 work/keyterms.txt): python tools/transcribe.py P → P/work/transcripts/<id>.json。--clips 0233 用于单个素材,--force 用于重做。它会打印加载了多少关键词——"none" 行表示你尚未草拟它们。

  4. 可读的镜头视图用于分析:python tools/format_transcript.py P → P/work/analysis/takes-<id>.txt(在 >0.8s 的间隙处分段,填充词在行内用时间戳标记)。

  5. 编写 cuts.json(见下方模式),通过阅读 takes-*.txt:将每个跨度标记为保留或分类剪辑,添加冗余建议和判断标记。

  6. QA + 审查文档: python tools/analyze_cut.py P [--style tight] → qa-report.md(内部死音、剪辑尾部风险、微小片段、冗余、剪辑连接处的硬进入、幽灵语音 = 在保留内未转录的能量、低置信度保留令牌)。幽灵/硬进入检查存在是因为转录差异无法看到错误定时的令牌(词首被截断)或未转录的错误开始("and it—")在剪辑后幸存——只有能量与令牌交叉检查才能捕获它们(在创建这些检查之前,一次仔细的听辨发现了两者)。 python tools/make_review.py P → review.md(每个素材的保留/剪辑表 + 每种风格的估计长度)。

  7. 编辑器代理(一次):python tools/make_proxy.py P → P/work/editor/{proxy.mp4, waveform.png, manifest.json}(原始素材的 720p 串联 + 每个素材的偏移)。

  8. 预览(渲染两者,用户选择):python tools/render_cuts.py P --style tight --mode preview 和 --style natural → P/output/preview-<style>.mp4(720p h264_nvenc)。 8.5. 渲染的机器验证(每次预览渲染后,在向用户展示前强制进行)。 提取预览的 WAV → transcribe.py P --clips preview --force → python tools/verify_cut.py P → verify-report.md。对渲染进行的第二次 ASR 传递,与预期保留的令牌进行差异比较:额外的单词 = 沿行驶的未转录幽灵(粘在词尾的错误开始——原始转录中不可见,能量启发式无法区分它们与单词释放);缺失的单词 = 被截断/丢失;加上内部停顿异常和低置信度渲染令牌。诞生于测试:一个错误定时的 ASR 令牌截断了词首('slash dot env' → '...env'),一个幽灵 'and it—' 存活到渲染;仔细的听辨发现了两者,现在这些工具做到了。将每个发现视为"请在这里听":解释每个发现或修复它——不要在报告中有未解释的行时声明剪辑良好。

  9. 用户审计 — 这是一个硬门控,与计划步骤相同。打开编辑器:python tools/editor/server.py P → http://localhost:8765。用户拖动保留/剪辑边缘,添加剪辑(I/O + C),比较原始与编辑播放;保存重写 cuts.json(备份到 work/analysis/backups/,附加到 changes.log);渲染按钮重新运行预览。迭代直到获得批准。

  10. 最终主剪辑:python tools/render_cuts.py P --style <chosen> --mode final → P/output/master-<style>.mp4(4K60 10-bit hevc_nvenc)。两个强制性的渲染后步骤:

    • A/V 持续时间门控: ffprobe -show_entries stream=duration 对 v:0 与 a:0 — 它们必须相等。verify_cut 的 A/V 预算沿时间线增长(视频中部 ±2s)并掩盖真实的累积漂移;相等持续时间检查是决定性的。(见下面的注释中的漂移说明。)
    • 可播放/交接转码: 10-bit HEVC 主剪辑在大多数播放器或 IDE 预览中无法播放,且 HEVC 最终在 59.94fps 素材上以约 0.1% 的速度戳帧。生成 8-bit H.264,通过重新定时到真正 CFR 修复两者:ffmpeg -r <src_fps> -i master-<style>.mp4 -c:v libx264 -crf 19 -pix_fmt yuv420p -c:a aac master-<style>-h264.mp4 — -i 之前的源 fps 重新戳每帧(无帧丢失),使 v:0==a:0。这是用户审查的文件,也是下游步骤使用的合成原生源。
  11. 交接主干 — edited-transcript.json:在最终主剪辑时间线中的单词时间。最简单的稳健路径(video-1 使用的):提取主剪辑的 WAV 并使用 transcribe.py 转录,然后归一化为 {words:[{text,start,end}...]},单位为毫秒。(cuts.json 时间重映射器是计划的替代方案。)这个文件是 /make-tsx 读取以将视觉与语音同步的内容。

一次性执行步骤 1–4 和 7;循环 5→6→8→9 直到剪辑获得批准;然后执行 10–11。

cuts.json 模式(你编写的内容)

{
  "project": "video-1",
  "clip_order": ["0232", "0233", "0234", "0235"],   // 串联顺序(假设文件名顺序)
  "clips": [{
    "id": "0233",
    "file": "DJI_20260707121304_0233_D.MP4",         // 原始 MP4,相对于项目目录
    "duration": 245.3,
    "keeps": [ { "s": 7.32, "e": 13.13, "text": "...", "gap": {"d":0.89,"t":"silence"} } ],
    "cuts":  [ { "s": 2.18, "e": 5.04, "cat": "retake", "text": "...", "note": "why" } ],
    "fluff_suggestions": [ { "s": 40.1, "e": 44.0, "text": "...", "crit": "restated-idea",
                            "note": "...", "status": "suggested" } ]   // 或 "auto_applied"
  }],
  "styles": { "tight": {…}, "natural": {…} },         // 定时旋钮见下文
  "flags":  [ { "id": 1, "clip": "0233", "at": "00:30", "issue": "...", "default": "keep both" } ]
}
  • cat ∈ retake | false_start | filler | long_pause | dead_air。时间以该素材内的原始秒为单位。
  • 保留内容从不删除。 带有 status:"auto_applied" 的冗余跨度只是隐藏它所覆盖的保留内容(撤销 = 切换回 "suggested")。为高置信度冗余保留 auto_applied;其余保留为 "suggested"(仅建议 — 渲染器从不丢弃建议的冗余)。
  • flags = 向用户展示的判断调用,带有 default。

剪辑策略(如何决定)

根据手工制作的参考剪辑(创作者自己的 CapCut 编辑)进行校准。目标节奏 = 内容激进 + 停顿自然。 主要的保留杠杆是剪切冗余和重复,而不是抑制沉默——在连续语句之间保持约 0.45–0.5 秒的自然呼吸。所以:

  • 首先查找口头编辑指令——它们优先于你的判断。 创作者对着镜头与编辑交谈。在决定之前搜索每个素材的转录包含 other take / another take / repeat this section / remove this / not needed。在 video-1 上,这些解决了大部分困难调用:"Other take." 意味着后面的镜头取代之前的;"I will repeat this section" 删除了一个节拍的整个第一遍;"There is no app or UI" ×3 后跟 "Remove this sentence. Not needed." 意味着全部四个都要删除。提示板藏在片段内部 — 镜头视图在 0.8s 间隙处分段,所以一个没有停顿说出的提示板位于片段内部("...open source pro— another take. Okay, since this project is..."),需要词级拆分。编写后,断言没有保留文本仍包含提示板短语。
  • 始终剪辑: 重拍/错误开始(保留获胜镜头,剪辑其余——注意哪个取代哪个)、绊嘴、死音和清晰填充词。
  • 重复短语:剪辑第一个。 当一个短语连续重复传递两次——"And what and what makes it so powerful?"、"it holds— it holds your decisions"、"doesn't reflect, doesn't contradict, doesn't contradict with chapter 1"——创作者希望删除较早的那个,包括当它位于一个良好镜头句子中间时。在 video-1 上,用户给出了 17 条审计笔记,每条都是"剪辑第一个"。在展示预览前自己执行此传递:在保留单词中 n-gram 扫描相邻重复运行以及以破折号结尾的令牌,然后在它们之间的安静点剪辑第一个运行。唯一的例外是脚本化喜剧(video-1 的 "ready to get shocked— uh, sorry, I mean..."),所以在剪辑脚本也包含的绊嘴之前检查脚本。
  • 建议,而非自动删除(通常): 冗余——延迟高潮的前奏、评价性旁白、重复想法。对每个进行分类(crit)并让用户在审查中决定。
  • 停顿:压缩但不要压平。 两种风格都针对自然呼吸;tight 让中场暂停变得有力,natural 提供更多空间。章节结尾/被删除重拍后的位置获得软着陆(更多尾部)以便呼吸。
  • 默认渲染两者 tight 和 natural 并让用户选择。

这是频道节奏的真相来源——在冗余上内容激进,在停顿上自然。

风格参数(在 styles 中,通用旋钮——无每个视频常量)

internal_gap(在此暂停处拆分保留为语音运行原子 ≥ 此值) · min_tail/max_tail(单词后对齐音频尾部范围) · head(原子前的引导) · margin(计数为"衰减"的噪声基准以上 dB) · soft_gap(下一个间隙 ≥ 此值 = 章节结尾 → 软着陆) · soft_max_tail/soft_margin(更软的着陆)。 匹配参考剪辑的参考值:tight {internal_gap:0.4, min_tail:0.14, max_tail:0.4, head:0.11, soft_gap:1.2, soft_max_tail:0.6, soft_margin:3.0};natural 将 min_tail:0.26, max_tail:0.45, head:0.19 提高。

将 head 调整为 SPEAKER,不要盲目接受参考。 head 必须超过说话者的起始斜坡——单词的第一个可听能量与 ASR 令牌开始之间的延迟——否则每次切入都会削减单词首音。测量方法:对于实际剪辑连接处的每个原子开始,在 RMS 包络中向后走,直到基准+6 dB 的最后一个点。在 video-1 上,斜坡聚集在 0.18s,所以 tight 的 0.11 削减了词首(14 个硬进入),而 0.15/0.17 给出了 0。将 head 与 analyze_cut 的硬进入计数扫描,选择达到零的最小值——进一步增加会花费实际运行时间(0.19 → 0.42 以 1:39 的引导为代价减少了 3 个进入)。

soft_max_tail 是一个上限,而非固定值 — snap_tail 在干净结束时提前返回,所以提高它只影响真正需要长释放的单词。如果视频最后一个单词被截断则提高它:video-1 的 "...upcoming videos." 需要 0.90s 衰减,0.60 截断了它。

转录关于时间说谎——对照包络交叉检查每个可疑跨度

单词文本通常正确;单词时间不正确,且剪辑引擎完全信任它们(split_atoms 从单词时间中获取每个原子的边界,因此 cuts.json 中的保留边缘编辑无法修复错误定时的令牌 — 你必须纠正令牌)。四种失败模式,均在 video-1 上看到,均通过在 work/audio/<id>.wav 上 RMS 走查发现:

症状它对剪辑的作用如何显示
晚开始(令牌在单词之后开始)切入切进单词analyze_cut 硬进入
膨胀跨度(单词跨越数秒沉默的时间戳)在保留内部保持死音verify_cut 大内部暂停
合并重复(一个令牌中的两次发音)你在转录中看不到的双重用户说"它是双倍的",转录说一次
幻影(没有音频的令牌)你将边界切入真实语音夹紧后的硬进入

最坏情况测量:"post" 时间戳 66.60→72.40 隐藏了句子中 5.24s 的死音;"Connect" 晚 0.44s;一个双倍的 "here's" 合并成一个 1.03s 的令牌;一个没有音频的 "this."。将每个纠正记录在 work/analysis/token-time-fixes.json 中 — transcribe.py --force 会清除它们。

值得在每个预览前运行的检测器:标记持续时间超过 ~1.0s 的保留单词,或其前导/尾随沉默超过 0.35s 的保留单词。通过询问剩余的热跨度是否可能容纳该单词来区分真实和假阳性 — 0.17s 中的 4 个音节意味着检测器在软起始处触发,而非真正的膨胀。

注释

  • 剪辑引擎(tools/cutlib.py)进行感知单词的分割、每个素材的 10% 百分位数噪底和对齐音频尾部,使单词释放不被截断——你不手动调整尾部填充,而是调整风格旋钮。
  • plan_clip 获取素材的 cuts 并将它们应用于保留——它在 cuts.json 开始时间和素材持续时间上工作。
  • A/V 漂移: 第二遍渲染测试(视频 3-6)揭示了一个非确定性 2-6 帧的 v:0>a:0 漂移,原因不明但仍可感知。i 帧边界的舍入(与秒的因子不总是 4K60 帧的整数倍的素材相比)可能是一个因素。预防措施:在渲染后插入两个强制检查(相等持续时间和 H.264 -r 重新戳)。
  • edited-transcript.json 是排版步骤的后端 — 每个单词必须有一个开始/结束,以便 TSX 可以动画化文本。
  • 有关编辑器 UI 用法,请参见 tools/editor/README.md。

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

raisaksham377-bot/youtube-shorts-ai-editor

Makes this repo's videos look like YOUR channel instead of the house default — interviews you for palette, fonts, wordmark, motion energy, delivery specs and SFX taste, then rewrites brand.md + remotion/src/brand.ts + remotion/src/fonts.ts together and renders a proof card so you SEE it. Use whenever the user wants to set up or change their brand, rebrand the repo, "make it my colors/fonts", change the accent color, set their wordmark, adjust the motion feel, or asks why their videos look like someone else's. Run it once before the first video. Not for per-video art direction (that is /make-tsx) and not for thumbnails, which are deliberately louder than the brand (that is /packaging).

raisaksham377-bot/youtube-shorts-ai-editor

Build a split-frame vertical Short/Reel (1080x1920) from talking-head footage — real face cropped into the bottom half throughout, bespoke motion-graphic beats + word-by-word captions in the top half. Use when the user wants a "vertical short", "reel", "9:16 video", "split-frame" format, asks to keep their face on screen the whole time while graphics play above it, wants an in-context app/UI mockup moment (like clicking a button in a browser) without cutting away from their face, or hits caption-pill-covers-my-face / no-GPU-rendering / audio-duration-mismatch problems while building one. Covers the crop-offset technique for framing the face, the caption-pill safe zone, the top-half-only UI-mockup scene pattern, the full pipeline from raw footage to final SFX mix, and the environment gotchas (no NVIDIA GPU, AAC priming gap, comp-native transcode). Topic-agnostic — this is a layout/technique skill, not tied to any one video's content. Builds on /clean-cut, /make-tsx conventions, and /suggest-sfx; doesn't rep...

raisaksham377-bot/youtube-shorts-ai-editor

Voice/audio cleanup step of the AI Video Editor pipeline — diagnose a video's background noise, pick the right denoise method, and produce a cleaned master (voice isolated, levels preserved, video stream copied). Use when the user wants to "clean the audio / voice", "remove background noise", "denoise", "isolate voice", fix outdoor/room/water/hum/hiss noise, run ElevenLabs Voice Isolator or local RNNoise, A/B denoise methods, or produce a cleaned master for a video-N in this repo. Covers diagnosing the noise (spectrogram + levels), choosing eleven vs rnnoise by noise type, the sample A/B, tools/clean_voice.py, preserving levels (RMS-match, not LUFS), and rewiring the pipeline to the clean master. Not the SFX/music mix (that is /suggest-sfx + the final-mix step) and not the cut (that is /clean-cut).

raisaksham377-bot/youtube-shorts-ai-editor

Turn static SCREENSHOTS into a simulated screen recording (TSX) — a fake screencast with an animated cursor that eases to targets and clicks, a browser URL bar that updates per page, hard-cut navigations, in-page filter crossfades, smooth scroll, and a ken-burns zoom onto the payoff. Use when a beat needs to show a walkthrough of a web app / dashboard / settings page and you'd rather build it from screenshots than get (or ask for) a real screen recording — "fake a screen recording", "turn these screenshots into a screencast", "simulate clicking through the dashboard", "animate this UI walkthrough", "cursor moving through the app". Built on remotion/src/lib/screencast.tsx. This is a technique WITHIN step 2 (make-tsx): defer timeline/render/bake orchestration to make-tsx and raw crash-free TSX rules to vidtsx-2d-generator. Not for a single static page clone (use WebBrowserFrame directly) and not when the point is genuine proof of real speed/output (use a real recording).

raisaksham377-bot/youtube-shorts-ai-editor

Step 2 of the AI Video Editor pipeline — build the visual beats (Remotion TSX shots) over a project's master cut and bake a composited preview. Use when the user wants to add/edit overlays or full-screen animation segments, "make a shot / beat", implement an edit plan or a v2 update, retime a beat to the narration, re-render shots, or re-bake the video-N preview in this repo. Covers reading the plan + edited-transcript + brand + reusable kit, authoring shots library-first, syncing reveals to word times, updating timeline.json (cutaway vs overlay), rendering, verifying by screenshot, and baking with tools/bake.py. Defers raw TSX authoring rules to vidtsx-2d-generator and the cut itself to clean-cut.

raisaksham377-bot/youtube-shorts-ai-editor

Generates click-optimized YouTube packaging — 3 thumbnail bets under one fixed title, engineered for YouTube's built-in A/B/C thumbnail test, plus a value-forward description, then renders the thumbnails as real images. Use this whenever you want to package a long-form video or turn a video idea into titles and thumbnails. Triggers include how would you package this, title ideas for, thumbnail concept, package this video, A/B variations, and make this clickable. Calibrates to your channel's own CTR data if you have it. Long-form only, never Shorts. Not for non-YouTube copywriting.

raisaksham377-bot/youtube-shorts-ai-editor

Step 4 of the AI Video Editor pipeline — the SFX pass. Analyze a video's beats + narration and propose tasteful sound effects synced to them, drawing from (and growing) a shared, reusable SFX library, then render an SFX-mixed audition preview. Use when the user wants to "add SFX / sound effects", "suggest sfx", "score the transitions", "sound-design this beat", generate/source sound effects, build or extend the sfx library/catalog, author or audit a sfx-plan, or mix SFX over a video-N preview in this repo. Covers reading timeline + edited-transcript + brand §10, the library-first flow, generating misses with the ElevenLabs Sound Effects API, the per-video sfx-plan.json, the hard user-audit gate, and mixing with tools/mix_sfx.py (light voice ducking). Not the music bed (that is the final-mix step) and not the visual beats (that is /make-tsx).

raisaksham377-bot/youtube-shorts-ai-editor

Generate production-ready 2D TSX video files for VidTSX (Remotion-based) from a shot, scene, or video description. Use whenever the user wants to create or generate a VidTSX video, a 2D TSX shot or scene, an animated clip, title card, or rendered motion graphic — including when they describe a visual animation they want built, or say "make a shot", "build this scene", "generate the TSX", or "turn this into a video". Covers the mandatory file structure and composition config, dimension presets (horizontal/vertical/square), six style presets (minimalist, memphis, neo-brutalism, glassmorphism, neon, corporate), and the hard rules that keep renders from crashing, covering frame-based animation only (no useState/useEffect/setTimeout), strictly monotonic interpolate ranges, Easing.bezier not wrapper syntax, and the chroma-js and @remotion/paths import gotchas. Not for 3D/three.js compositions, general React work, or editing video files.

相关技能