Communitygithub.com

clip-shorts:一条成片切出多条独立 YouTube Shorts

把完成的长视频切成 YouTube Shorts 的 Agent 技能:复用成片的逐词时间戳,通读全文转写,挑出可独立成立的片段,加文字钩子和评论引导,用 Remotion 渲染 1080x1920 竖屏片段,并附带含 Instagram 文案的上传清单。

clip-shorts:一条成片切出多条独立 YouTube Shorts 是什么?

YouTube 单集配方第 3 步(Shorts),来自 SrigadaAkshayKumar/ai-video-editor(2026-10-09 发布;AI-clipper 目录是整条流水线的 Shorts 环节,README 称一整集从配音、剪辑、Shorts 到上传 Drive 在免费 4 核 GitHub runner 上用时 1 小时 13 分)。它直接用成片的干净画面和 -14 LUFS 母带,不用再跑一遍 Whisper,也不会出现双层字幕。Agent 必须先读完全部转写再挑片段。好的 Short 要零上下文也能看懂,有铺垫、张力和爆点,以有力的一句开场,爆点之后立刻收尾,时长自然、最长 70 秒。同一秒素材不会出现在两条片段里。每条都有不超过 8 个词的屏幕钩子、可选的倒叙开场、具体的评论提问、YouTube 标题、话题标签和单独的 Instagram 文案。画幅可选黑边、模糊背景、居中裁切或人脸跟踪。输出 1080x1920、30fps、H.264 MP4 和 UPLOAD_SHEET.md。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/SrigadaAkshayKumar/ai-video-editor/tree/HEAD/AI-clipper/.claude/skills/clip-shorts

在你喜欢的 AI 中提问

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

文档

长视频 → YouTube Shorts

流程:AI 编辑项目(../projects/<p>)→ 转录(复用编辑的单词;纯文件才使用 Whisper)→ Claude 读取完整转录并编写 clips.json → 准备(剪切、字幕、追踪)→ 渲染(Remotion)→ output/<slug>/。

0. 收集任务设置

从用户消息中获取(仅询问缺失项):

设置值说明
源../projects/ 中的 AI 编辑项目名称没有输入文件夹:视频来自编辑器的项目。一个长视频的多个部分 → 全部列出 + --slug。
语言en / te / hi设置 Whisper 语言、字幕字体、钩子/行动号召语言
构图black(9:16 中的 16:9,黑边)· blur(模糊背景)· center(中心裁剪)· track(裁剪跟随说话者的脸)无面孔频道 → black/blur;有面孔频道 → center/track(或 black/blur)。每个片段可以不同。
模型(可选)small、medium、large-v3Whisper 仅在(纯文件,--from final,--whisper)运行:en→small,te/hi→medium

1. 转录

从 AI-clipper/ 运行(或从仓库根目录运行 npm run shorts:transcribe -- …):

npm run transcribe -- <project>                               # ../projects/<project>,干净源
npm run transcribe -- <part1> <part2> <part3> --slug <name>    # 一个长视频的各个部分,按顺序合并
npm run transcribe -- <project> --from final                  # 已交付的 final-16x9.mp4 替代
npm run transcribe -- <joined-name|file.mp4> --lang te        # ../output/<name>-16x9.mp4(npm run join)或任何文件

源:

  • clean(默认,使用此项):项目的 work/visuals-16x9.mp4 + work/master.wav(完成的画面、图形和 -14 LUFS 混音,但没有内嵌字幕和开场/结尾)混流为 jobs/<slug>/source.mp4。单词直接来自 work/cleancut.words.json,因此无需运行 Whisper(即时完成,泰卢固语/印地语保留 ElevenLabs 转录)。需要编辑已最终确定(npm run finalize -- <p>);如果画面/主文件比 clean cut 旧,它会发出警告。
  • final(--from final):交付的 output/final-16x9.mp4,使用 Whisper 重新转录。其字幕已烧录,因此生成的 Shorts 会显示两层字幕;仅在 clean 文件丢失时使用。合并的长视频(../output/<name>-16x9.mp4)同理:建议列出其部分项目。

语言默认为项目的语言(--lang 覆盖)。--format 9x16 从 9:16 编辑中剪辑。Whisper 在 CPU 上运行较慢(small 模型约 20 分钟/小时视频,medium 约 45 分钟):请在后台运行。输出:jobs/<slug>/,包含 source.mp4、transcript.txt(带时间戳)、transcript.json(单词时间戳)、meta.json(记录来源项目)。

2. 阅读全部内容,然后规划片段(这是 Claude 的工作)

在选择任何内容之前,完整阅读 jobs/<slug>/transcript.txt(如果较长则分块读取)。理解整个脚本:主题、故事、论点、笑话、前后呼应。不要只是将视频平均分成几段。

一个好的 Short 是一个自成一体的对话时刻:

  • 在零上下文下有意义(没有“正如我之前所说”,没有开头未解决的“他/那个”)。
  • 有一个弧线:铺垫/问题 → 紧张感 → 回报(答案、点睛之笔、揭示、强烈观点、数字/结果)。
  • 以一句强有力的台词开始,绝不从填充词开始(“所以”、“嗯”、“好的那么”、“అయితే”、“तो”)。
  • 在回报之后立即结束,以一个完整的句子结束,而不是在思考中途。
  • 自然长度,最长 70 秒。 在每个片段的时间点结束时剪切:30 秒的时刻对应 30 秒的 Short,40 秒的时刻对应 40 秒的 Short。大多数落在 30–40 秒。70 秒只是上限(prepare.py 拒绝任何更长的)。永远不要为了延长片段而从其他地方拉伸、合并或拼接台词;这是用户在 2026-10-06 纠正的一个错误。适用于每种类型的视频。
  • 绝不重复使用素材。 任何源秒数都不应出现在两个片段中,任何片段都不应重复播放同一句台词。每个片段都是视频的不同部分。没有“完整版”片段会重复使用其他片段。prepare.py 拒绝重叠的计划。

钩子(两种,有益时都使用):

  1. 文本钩子(hook):前 3 秒屏幕上显示 ≤ 8 个单词。好奇心、大胆断言或“你”的问题。必须忠实于片段。将 1–2 个冲击词用 *星号* 括起来(例如 Recruiters notice *THIS* coding contest 👀):在黑边构图中它们会获得一个黄色高亮框。以视频的语言和文字书写(泰卢固语 → తెలుగు,印地语 → हिन्दी),除非用户要求英语/泰卢固语英语混用/印地语英语混用。
  2. 冷开场(可选):将第一个片段设置为片段中最令人惊讶的 1–3 秒台词(其回报或震撼性陈述),然后播放直到该台词之前的铺垫部分,然后再继续其后,以便该台词不被听到两次。例如:[{"start": 754.2, "end": 756.1}, {"start": 731.0, "end": 754.2}, {"start": 756.1, "end": 770.0}]。当回报很强但自然开头较慢时使用。

如果演讲仍然流畅自然,你也可以通过将平淡的中段拆分为多个片段来删除它。

评论提示(cta):显示在最后 3.5 秒内(黑边构图:在结束卡前约 7 秒的顶栏中)。一个与片段相关且人们可以用一句话回答的具体问题(“你会选哪个,1 还是 2?👇”),而不是泛泛的“点赞和订阅”。语言与钩子相同。

多少个片段? 这取决于内容,而不是公式。计算每个符合上述规则的时刻,按 score 排名(1–10:钩子强度 × 自含清晰度 × 回报 × 可分享性),并保留所有 ≥ 6 的。粗略检查:实质性谈话每 1–3 分钟约 1 个片段(5 分钟 → 3–5,10 分钟 → 4–8,30 分钟 → 10–18)。较短的片段意味着更多。当视频缓慢或重复时,较少也可以。告知用户真实的数字和原因。

编写 jobs/<slug>/clips.json,按分数排序(最佳在前):

{
  "framing": "blur",
  "summary": "完整视频的一段摘要以及选择这些时刻的原因。",
  "clips": [
    {
      "id": 1,
      "title": "YouTube 标题,< 70 字符,以视频的语言",
      "hook": "屏幕上显示的钩子文本",
      "cta": "具体的评论问题 👇",
      "segments": [{ "start": 731.0, "end": 768.4 }],
      "framing": "track",
      "description": "1–2 行 YouTube 描述",
      "hashtags": ["#shorts", "#topic", "#niche"],
      "score": 8.5,
      "why": "为什么这个时刻适合作为独立的 Short",
      "instagram": {
        "caption": "钩子行\n\n2-4 行简短的价值点(✅ 可包含项目符号)\n\n相同的评论问题 👇\n\n💾 保存此...\n📌 完整视频:个人主页链接",
        "hashtags": ["#topic", "#niche", "...8-12 个标签", "#reels"]
      }
    }
  ]
}

Instagram(始终): 用户也会将每个片段发布为 Instagram Reel,因此每个片段都要有一个 instagram 块。为 Instagram 编写,而不是复制 YouTube 描述:首先是钩子行,然后是简短可扫描的行、评论问题、保存提示和“📌 完整视频:个人主页链接”(Instagram 描述和评论中的链接不可点击)。使用 8–12 个标签,其中 #reels 替代 #shorts。上传表格会在 Instagram 说明 下打印此内容。如果缺失,表格会从 YouTube 字段构建备用内容。仅重写表格:npm run render -- <slug> --sheet-only。

可选的黑边构图覆盖(每个片段或顶层):"topTexts": ["📌 完整视频链接在置顶评论", "💬 在下方评论你的想法"] 和 "endCard": {"title": "观看完整视频", "subtitle": "链接在置顶评论中"}。如果使用默认值,则省略它们。仅当用户要求时,才以视频的语言编写它们。

时间戳来自 transcript.txt(秒,允许小数)。它们会自动对齐到单词边界,因此选取句子开始/结束,让脚本处理填充。每个片段的 framing 是可选的,并覆盖顶层设置。

黑边构图布局(仅限信箱模式视频)

使用 framing: "black"(且黑条高度至少 300 像素)时,渲染使用黑条区域,而非画面:

  • 开始: 白色闪光 + 视频上的推进效果,然后钩子逐字在顶栏中弹出(高亮单词用黄色框框住),并带有弹跳的 👇,3 秒后缩小成一条标题并停留在屏幕上。
  • 顶栏,中间: 动画标签在标题下方旋转(topTexts),然后评论问题(cta)作为黄色标签。
  • 底栏: 逐字字幕,位于视频下方,绝不覆盖视频。视频底部边缘是一根黄色进度条。
  • 最后 2.5 秒: 动画结束卡:“观看完整视频 · 📌 链接在置顶评论”。音频继续播放,因此让片段在其最后一个完整句子上结束(回报后 2–3 秒),而不是在回报中途。

其他构图(blur、center、track)保留经典叠加层。代码:src/BlackBars.tsx。

每个 Short 都指向置顶评论,因此提醒用户在每次上传时置顶一条包含完整视频链接的评论,并同时在描述中放入该链接。

3. 显示计划,然后准备 + 渲染

向用户显示一个表格(id、分数、时长、钩子、一行原因)和总数量。然后运行:

npm run prepare-clips -- <slug> [--framing blur] [--only 1,3]
npm run render -- <slug> [--only 1,3]

在 CPU 上渲染每个片段大约需要 1–2 分钟,因此在后台运行。输出:output/<slug>/NN-title.mp4(1080×1920,30 fps,H.264)和 output/<slug>/UPLOAD_SHEET.md(标题、YouTube 描述 + 标签、Instagram 说明、源时间戳)。

抽查 1–2 个片段:使用 ffmpeg 提取 ~1 秒(钩子)、中间(字幕、顶栏标签)和最后 2 秒(结束卡/评论提示)的帧并查看。使用 track 构图时,确保说话者的脸在画面内。

之后编辑单个片段

更改其在 clips.json 中的条目,然后运行 npm run prepare-clips -- <slug> --only N 和 npm run render -- <slug> --only N。对于视觉调整(字体、颜色、位置),编辑 src/BlackBars.tsx(黑边构图)、src/Captions.tsx、src/Overlays.tsx、src/Framing.tsx;使用 npm run studio 预览。

文件

  • pipeline/transcribe.py:源来自 ../projects/<p>(干净画面 + 主文件 + 编辑的单词),纯文件使用 Whisper
  • pipeline/prepare.py:单词对齐、ffmpeg 剪切/合并、字幕、YuNet 人脸追踪(模型自动下载至 models/)
  • scripts/render.mjs:Remotion 打包 + 渲染 + 上传表格
  • src/:Remotion Short 合成(1080×1920):Framing、Captions、Hook/CallToAction

Individual skills in this repo

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

SrigadaAkshayKumar/ai-video-editor

Choose, fetch and place background music for an edit — Openverse search (commercial-use CC, or CC0-only), music_cues in work/audio-plan.json with fades, offsets and a deliberate silence gap; tools/mix.mjs conditions every bed, sets it to one measured house level under the voice and sidechain-ducks it. Use when adding, swapping or re-levelling music.

SrigadaAkshayKumar/ai-video-editor

Generate and style word-synced captions (Telugu, Hindi, English, code-mixed) as the HyperFrames captions pass over each format's Remotion picture, fix caption text, black captions out under on-screen text, and check caption content at every cut join. Use when creating, restyling, correcting or repositioning captions in any edit.

SrigadaAkshayKumar/ai-video-editor

Editorial rules for turning a raw talking video or voiceover into a clean cut — removing retakes, repetitions, false starts, stutters, fillers, mispronounced words, contradictions/inconsistencies, off-script chatter and dead air — by writing work/edl.json for tools/cut.mjs. Telugu, Hindi, English and code-mixed speech. Use for stage 2 of edit-video or whenever the user asks to tighten/re-cut a video.

SrigadaAkshayKumar/ai-video-editor

Turns a bare voiceover (no presenter on camera) into a finished faceless documentary/explainer for YouTube 16:9 and Instagram 9:16 — clean-cuts the narration, DIRECTS it (story spine, tension curve, hooks, involvement beats), researches the claims and screenshots the real sources, plans a scene track (stock b-roll, stills, news screenshots, pure-graphic beats) with motion graphics, designs music + SFX, renders, captions and credits it. Use when the user gives a voiceover/narration file (or says "faceless video", "make a video from this VO", "documentary").

SrigadaAkshayKumar/ai-video-editor

End-to-end editor for TALKING-HEAD videos (a person on camera) in this repo. Use when the user hands over a raw video with a speaker and wants a finished edit, or asks to continue/resume/redo any stage of an existing talking-head project — clean cut, motion graphics, b-roll, SFX, music, captions, final render, thumbnail. Delivers YouTube 16:9 and Instagram 9:16. Telugu, Hindi, English and code-mixed speech. For a voiceover with no presenter use edit-video-faceless.

SrigadaAkshayKumar/ai-video-editor

Plan the picture of an edit in work/visual-plan.json — motion graphics (28 component types across six stage layouts that dock/shrink/dim the video), b-roll cutaways from Pexels/Pixabay, camera moves, a-roll framing for 9:16 — validate it, QA it with stills in both formats, and render it with Remotion. Use for any titles, charts, stats, lower thirds, diagrams, b-roll or zooms in a talking-head or faceless edit.

SrigadaAkshayKumar/ai-video-editor

Design the sound effects of an edit in work/audio-plan.json sfx_events — which effect, where, how often — using the measured SFX library (repo assets/sfx, HyperFrames' bundled set, CC0 fetches from Openverse) and the spectral rule that sub-band cues carry structure while vocal-band cues are rationed. Mixed and levelled by tools/mix.mjs. Use when adding or adjusting SFX in any edit.

SrigadaAkshayKumar/ai-video-editor

Write the upload package for a video this repo edited — YouTube title options, description with chapters, tags, pinned comment, thumbnail text, and the Instagram Reels caption + hashtags for the 9:16 cut — optimised for whichever channel/client the user says it is for (config/brands/ profiles, only when named). Use when the user asks what to title a video, for a description, tags, chapters, "the YouTube metadata", an Instagram caption, or SEO/CTR advice on a finished render.

SrigadaAkshayKumar/ai-video-editor

Design and build a high-CTR thumbnail for a video this repo edited — hook selection, the real face frame pulled from the footage, background cut-out, type set with real fonts (Telugu/Devanagari included), the YouTube 1280x720 thumbnail and the Instagram 1080x1920 cover, an optional image-generation prompt for the background layer, and a feed-size legibility check. Use when the user asks for a thumbnail, thumbnail ideas, a cover image, or how to make the thumbnail more clickable.

相关技能