Communitygithub.com

Conz-Wilts/ai-editor - 智能剪辑

将一段长视频或播客(本地文件或YouTube链接)自动提取为3-5个最适合的竖版短视频,每个片段都按用户个人风格裁剪和美化。一次转录,在句子边界处分段并评分,最后生成精选列表供用户挑选。

ai-editor - 智能剪辑 是什么?

该技能旨在将长视频或播客内容高效转化为一系列竖版短视频(如TikTok、Reels)。用户提供本地视频文件或YouTube链接后,技能会先转录一次,利用语音速率、响度、笑声、提到的数字和名字等特征对每个句子边界内的候选片段进行评分,生成一个约1500 token的精选列表(shortlist.md),并自动创建一个交互式预览页面(picks.html)。用户通过提问框选择所需片段后,每个被选中的片段会独立进入裁剪(cut)和风格编辑(style-edit)流程,最终输出多个完成好的竖版视频。该技能支持Claude Code等具备子代理功能的平台,可在同一消息中并行处理所有片段以提升效率。技能强调不重复转录、不读取原始转录文件,以及严格遵守用户个人风格偏好。对于纯音频的播客,它还会将音频叠加在节目封面上生成视频。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Conz-Wilts/ai-editor/tree/HEAD/.claude/skills/clips

在你喜欢的 AI 中提问

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

文档

视频剪辑

路径:${CLAUDE_SKILL_DIR} 表示包含此 SKILL.md 的文件夹,${CLAUDE_SKILL_DIR}/../.. 表示其上层两级所在的编辑器文件夹(即此仓库的 .claude/)。

首先阅读 ${CLAUDE_SKILL_DIR}/../../PRINCIPLES.md:每个视频都必须遵循的规则(提问、看起来真实、动态、叙事和构图、隐私、成本)。

所有向用户提出的问题都应放在问题框中:调用 AskUserQuestion 工具(提供2-4个选项,推荐选项排第一)。仅当使用的代理没有该工具时,才以文本形式列出编号问题。

输入一段长视频,输出少量最佳短视频片段,每个都是按用户风格完成的竖版编辑。

clips/<名称>/
  source.mp4          长视频(本地文件则创建符号链接;切勿修改原始文件)
  source.mp3, cover.jpg  如果是纯音频播客:音频文件和节目封面图
  words.raw.json      整个视频的转录(请勿读取此文件)
  candidates.json     每个候选片段及其特征(请勿读取此文件)
  shortlist.md        排名前8且不重叠的片段,约1500 token:这是唯一需要读取的文件
  shortlist.json      与上相同,供页面使用
  picks.html          用户从中挑选页
edits/<名称>-clip<编号>/ 每个被选中的片段对应一个编辑文件夹:source.mp4、words.raw.json(重新计时)、clip.json

在 Mac 和 Linux 上使用 python3 运行脚本,在 Windows 上使用 py。 PY="${CLAUDE_SKILL_DIR}/../../lib/ai_editor/run.py";使用 python3 "$PY" 运行编辑器的虚拟环境 Python(Windows 上用 py "$PY")。如果缺少该文件,请先运行 setup 技能。K="${CLAUDE_SKILL_DIR}/scripts/clips.py", C="${CLAUDE_SKILL_DIR}/../../skills/cut/scripts",S="${CLAUDE_SKILL_DIR}/../../skills/style-edit/scripts"。

0. 一次性询问

首先读取个人资料和品味设置(python3 "${CLAUDE_SKILL_DIR}/../../lib/ai_editor/profile.py" show, python3 "${CLAUDE_SKILL_DIR}/../../skills/taste/scripts/taste.py" show)。如果尚未创建个人资料,请先运行 start 技能中的风格录入,以确保剪辑出来的片段符合用户的视觉风格。

然后在问题框中发起一次调用,推荐选项排第一:

问题选项
需要多少段剪辑?3 (推荐) / 5 / 1
每段时长应是多少?20-40 秒 (推荐) / 40-60 秒 / 60-90 秒
视频中有几个人说话?1人 (推荐) / 2人(播客或采访)

跳过用户已经回答过的问题。这些问题替代了裁剪技能中的“先裁剪还是全部一起处理”的问题:剪辑流程直接贯穿到底,用户只需批准选中的片段和张贴画。

1. 视频源

本地文件(同一驱动器上使用硬链接,否则使用符号链接,最后手段才复制):

python3 "${CLAUDE_SKILL_DIR}/../../skills/clips/scripts/clips.py" link "<绝对路径>" clips/<名称>

链接:

python3 "${CLAUDE_SKILL_DIR}/../../lib/ai_editor/links.py" fetch "<url>" clips/<名称> --max-height 1080

此脚本使用虚拟环境中的 yt-dlp(setup 会将其安装在虚拟环境中而非系统 PATH 上),将下载分辨率限制在 1080p(1080x1920 的片段不需要4K;一段20分钟的4K视频可能有数GB),并打印输出文件路径:clips/<名称>/source.mp4。退出码3:网站要求登录(例如 YouTube 的“确认你不是机器人”)。请先在问题框中询问用户,然后再使用 --cookies-from-browser chrome(或其他浏览器)重新运行。对于播客(RSS 源或 Apple Podcasts 节目链接):route 会列出其最新剧集作为 ask 选项;在问题框中询问用户选择哪一个(最新的排第一),然后执行 fetch "<选项url>" clips/<选项名称> --direct --cover "<选项图片>":音频会保存为 source.mp3(或原有扩展名),节目封面图保存为 cover.jpg。 只下载用户有权重用的内容:用户自己的视频,或已获得授权的视频。如果链接是他人内容,请明确说明一次。

2. 一次性转录

python3 "$PY" "$C/transcribe.py" clips/<名称>/source.mp4 clips/<名称>/words.raw.json   # 脚本打印的文件路径:音频文件则为 source.mp3

先告知时间:Whisper 在笔记本电脑上每3分钟视频需要1-4分钟(免费),Scribe 对一段13分钟的视频约需20秒。引擎与裁剪技能相同。Scribe 会添加笑声和其他音频事件,评分阶段会用到这些信息。 每个片段都复用此转录结果:无需重复转录。

3. 候选片段与精选列表

python3 "$K" candidates clips/<名称> --min 20 --max 40 [--speakers 2] [--style creator-teardowns/<手柄>/style.json]

传递用户选择的时长。--style 是用户个人资料中的首个创作者:在那里测得的“有效元素”会列在精选列表中。脚本会将转录文本拆分为句子,并构建所有在指定时长内由完整句子组成的候选片段(从不以“嗯”开头或在词中间结束),对每个片段进行度量,根据特征评分,然后写入 shortlist.md。

只读取 shortlist.md。每个条目包含:开场的钩子、中间每个句子的开头词、最后一句以及测得的特征。根据四个问题评判每个条目:钩子是否能独立使用、陌生人是否能理解、是否有收尾、是否包含具体主张、数字或故事。

切勿读取 words.raw.json 或 candidates.json。从精选列表中按最佳优先选择用户指定数量的片段。无论评分如何,都要丢弃以下内容:

  • 广告朗读、赞助段落、开场或结尾部分;
  • 依赖前文语境的钩子(例如“正如我所说”、“这就是为什么”、“这个”);
  • 包含过时主张的片段(例如“在我录制的此刻,它是第40名”),如果该主张此后已发生变化:实时截取今天的页面会与其矛盾。

4. 挑选页面,然后提问框

python3 "$K" page clips/<名称> --recommend c12,c40,c7
open clips/<名称>/picks.html    # Windows: start "" ..., Linux: xdg-open ...

单个页面:每个被选中的候选片段都带有360像素预览、其转录文本(钩子用粗体)、分数分解和测得的特征,你的推荐已标记。然后在问题框中询问(多选):你的推荐排第一,每个标注时间戳和钩子,再加上“从页面中选择另一个”。等待用户回答。

5. 每个被选中的片段

python3 "$K" trim clips/<名称> c12 c40 c7          # -> edits/<名称>-clip1, -clip2, -clip3

每个编辑文件夹都会获得 source.mp4(帧精确,填充后不会截到下一个词)和重新计时后的 words.raw.json。纯音频源(source.mp3)没有画面:trim 会将每个片段的 source.mp4 设为音频叠加在播客自己的封面上(封面模糊并调暗以填满1080x1920,锐化封面位于字幕上方;如果没有封面,则使用黑色背景),并且 clip.json 中包含 audio_only。如果有封面,渲染时会加入动效:封面缓慢推进、背景相对漂移、每个句子开始时轻微“弹出”。对于这些情况,无需询问布局:使用叠加,不重新构图,不抠像,开启字幕(profile.py style 默认保持字幕开启)。告知用户每个片段都是音频叠加在节目封面上,并配有说话者的字幕。在调整片段之前,一次设定好所有片段的音乐(风格-编辑 references/plan.md“音乐”;除非用户设置了 sound.music,否则由风格决定)。

一次性处理所有片段(Claude Code 或任何支持子代理的代理):为每个片段启动一个 clip-editor 代理,所有代理在一条消息中启动,以便它们同时运行。为每个代理提供 EDIT(片段的文件夹,绝对路径)、ROOT(${CLAUDE_SKILL_DIR}/../..)、PY 行以及答案:画幅、布局、音乐、转录引擎,以及是否重新构图(如果是宽屏源,平台非 YouTube 则为是,否则为否),以及源是否含有硬编码字幕。每个代理会将自己的片段依次通过裁剪和风格编辑流程,直到生成张贴画,并返回一个简短 JSON:status、cut_s、verify、cut_page、sheet、error。合并这些结果;切勿打开任何片段的转录或纸质编辑。然后,对每个状态为 ready 的片段的张贴画,再次在一条消息中同时启动 stills-critic 代理进行审核,并修复其未通过的部分(对该片段重新制定计划和生成张贴画)。状态为 failed 的片段:按照下面的手动流程处理。

逐个处理(无子代理),按顺序处理每个片段:

  1. 宽屏视频转为竖版: python3 "$PY" "$K" reframe edits/<名称>-clip<编号> 裁剪为9:16,裁剪点跟随说话者的头部逐镜头移动(使用 ffmpeg 检测镜头切换)。当用户个人资料中的平台为 YouTube 或源视频已经是竖版时,跳过此步骤。
  2. 裁剪: 从裁剪技能的第2步开始(retakes.py propose):转录文件已经就位。然后按照该技能所述进行构建、渲染、验证和生成裁剪页面。语音下的音乐测量按文件进行:build_timeline.py 仅在词之间修剪音频。
  3. 风格: python3 "${CLAUDE_SKILL_DIR}/../../lib/ai_editor/profile.py" style edits/<名称>-clip<编号>,然后从风格编辑技能的第2步开始。如果源视频已包含硬编码字幕,则在编辑文件夹的 style.json 中设置 "captions": {"present": false},否则字幕会叠加。

无论采用哪种方式,都要打开每个片段的 cut-check.html,将所有张贴画集中展示以获得一次批准,一次性询问渲染问题,然后开始渲染。渲染完成后,在每个片段文件夹上运行 python3 "${CLAUDE_SKILL_DIR}/../../skills/cut/scripts/judge_cut.py" score(裁剪 references/judge.md)。将最终渲染结果放在一个审查页面上,每个片段作为一个标签页(使用 start 打开第一个片段,使用 alt 打开其余片段,文件夹为 clips/<名称>;参见 ${CLAUDE_SKILL_DIR}/../../skills/style-edit/references/review.md),然后在后台执行 serve 和 wait。

如果脚本停止

消息操作
没有完整句子构成的运行时长在 <lo>-<hi> 秒内在问题框中询问更宽的时长间隔,然后重新运行 candidates
未找到候选片段 <id>从 shortlist.md 中使用一个有效的 id
links.py fetch 退出码3(要求登录或“确认你不是机器人”)询问用户,然后使用 --cookies-from-browser <浏览器> 重新运行
任何裁剪或风格编辑的消息参考该技能的“如果脚本停止”表格

规则

  1. 屏幕上出现的每个词、数字和名称都必须来自该片段自身的转录文本。不得使用视频其他部分的内容,也不得使用说话者未说过的话。
  2. 不允许出现 AI 生成的视觉效果:${CLAUDE_SKILL_DIR}/../../skills/style-edit/references/ai-tells.md 适用于每个片段。
  3. 近景播客画面没有空白空间:卡片或标识不得覆盖头部。更少的视觉元素是正确的;字幕和缩放足以传达信息。
  4. 切勿在句子中间切断片段。宁可缩短或延长时长,也不能打断一个完整的思路。

每个长视频的成本

基于一段13分钟的双人播客和一段12分钟的 talking-head 视频实测(2026年10月):

  • 转录:Scribe 用时16-18秒;Whisper 免费但更慢。每个长视频只进行一次。
  • 候选片段和特征计算:代码执行4-6秒,费用为0。
  • Claude 读取 shortlist.md(约1500 token),从不读取转录文本(约20000 token)。
  • 挑选页面:ffmpeg 为8个预览耗费30-40秒,大小7-9 MB。
  • 每个片段的成本等于一次裁剪加一次风格编辑的成本。

自检

python3 "$K" demo

文件

  • scripts/clips.py:候选生成、页面生成、裁剪、重新构图以及离线演示(合成转录)。仅依赖标准库,但 reframe 除外(需要虚拟环境中的 OpenCV)。
  • ${CLAUDE_SKILL_DIR}/../../agents/clip-editor.md:将单个片段从裁剪到风格编辑直至生成张贴画的流程说明。

Individual skills in this repo

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

Conz-Wilts/ai-editor

Reverse-engineers a short-form creator's video format from their real numbers. Pulls a TikTok or YouTube Shorts profile (or pasted links, Instagram reels too) with view, like and save counts, transcribes the top videos word for word, measures pace, pauses and fillers, maps each video into timed beats, and writes a teardown.md someone can film from, a teardown.html page of their graphics, motion and sound, and the style.json the style-edit skill edits from (on its own it can write an edit plan as a table and .srt). Use when the user wants to analyse, break down or study a creator ("analyse @handle", "tear down @handle", "teardown of @handle", "break down this creator", "what makes this creator's videos work"), pastes TikTok, YouTube or Instagram links and asks what the pattern is, or asks to set up creator-teardown. Not for editing the user's own video like a creator (that is start), not for researching a topic, and not for cutting raw footage.

Conz-Wilts/ai-editor

Cuts raw talking-head footage into a clean jump cut. Takes one take or several joined (mp4 or mov, any aspect, 4K phone footage is fine), transcribes it word by word, removes retakes, false starts, fillers and dead pauses, and renders cut.mp4 at the source resolution plus words.json timed to the cut. The user approves the cut on a page with the whole transcript and every removed word struck through. Use when the user says "cut my video", "just cut it", "remove my mistakes", "cut out the retakes", "remove the pauses", "clean up this take", "jump cut this", "tighten this clip", or asks only for the cut of a raw take; start calls it for a full edit. Runs before style-edit. Not for a general request to edit a video or to make it look like a creator (that is start), not for adding captions, zooms or cards (style-edit), and not for analysing someone else's videos (creator-teardown).

Conz-Wilts/ai-editor

Generates new footage with Higgsfield and puts it on the edit's timeline. Prices every generation first, asks the user with the dollar amount (and, for their own footage, whether it may be uploaded to Higgsfield), then submits, waits, downloads into the edit's generated/ folder and adds the result to the timeline's Generated track. Covers motion transfer on a clip of the user's video (their moves onto a character or styled look), b-roll from a sentence (text to video), a still brought to life (image to video) and stills for cards (text to image). Use when the user says "generate b-roll", "make a shot of", "AI b-roll", "generate a clip", "use Higgsfield", "motion transfer", "put my moves on", "restyle this part with AI", or asks for footage they did not film. Not for animated diagrams or motion graphics (motion), not for real screenshots and logos (overlays, logo-pack), and not for the cut (cut).

Conz-Wilts/ai-editor

For the editor's maintainers. Turns what users corrected into lasting fixes in this repo, for every user, enforced by code and tests rather than notes. Reads the suggestions users marked "would help everyone" (~/.ai-video-editor/suggestions.jsonl), taste rules said twice (taste.py report), preview corrections (edits/*/corrections.jsonl), review-page notes (*/review.json) and open GitHub issues labelled feedback; groups repeats; for each item the maintainer accepts, writes the general rule into PRINCIPLES.md and the skill that owns it, adds or tightens the check that enforces it, adds a test that fails before and passes after, and runs the full test set. Use when the maintainer says "improve the editor", "turn feedback into fixes", "process suggestions", "what are users complaining about", "go through the feedback issues". Not for one user's own preferences (that is taste), and not for editing a video.

相关技能