内容生成
- 作者仓库星标 3,767
- 作者更新于 实时读取
- 作者仓库 AI-Youtube-Shorts-Generator
- 领域
- 数据
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @SamurAIGPT · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 需要 · Vendor-specific
- 兼容的系统
- Windows
- 底层运行要求
- Python >=3.10
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: youtube-shorts-generator
description: Generate viral 9:16 YouTube Shorts (or TikTok/Reels clips) from a long-form YouTube URL or local…
category: 数据
runtime: Python
---
# youtube-shorts-generator 输出预览
## PART A: 任务判断
- 适用问题:表格、CSV、数据集、指标或分析流程。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“When to use this skill / Inputs to collect before running / Prerequisites (verify before first run)”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于表格、CSV、数据集、指标或分析流程,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“When to use this skill / Inputs to collect before running / Prerequisites (verify before first run)”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、读取环境变量、会按任务需要访问外部网络、需要准备 Vendor-specific API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;需要准备 Vendor-specific API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/openai-whisper` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令、读取环境变量。
先用一个小任务确认它会围绕“When to use this skill / Inputs to collect before running / Prerequisites (verify before first run)”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: youtube-shorts-generator
description: Generate viral 9:16 YouTube Shorts (or TikTok/Reels clips) from a long-form YouTube URL or local…
category: 数据
source: SamurAIGPT/AI-Youtube-Shorts-Generator
---
# youtube-shorts-generator
## 什么时候使用
- 把数据处理方向的常用动作沉淀成 Agent 可调用的技能 适合处理表格、CSV、指标、数据集、分析和可视化报告,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步…
- 面向表格、CSV、数据集、指标或分析流程,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「When to use this skill / Inputs to collect before running / Prerequisites (verify before first run)」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;需要准备 Vendor-specific API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "youtube-shorts-generator" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> When to use this skill / Inputs to collect before running / Prerequisites (verify before first run)
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Python | 读取文件、写入/修改文件、执行终端命令、读取环境变量 | 会按任务需要访问外部网络
安全层 -> 需要准备 Vendor-specific API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} YouTube Shorts Generator
End-to-end pipeline that turns one long video into N viral-ready vertical clips. Each clip ships with a viral score (0–100), an opening hook line, and a one-sentence reason it should perform.
Reference implementation: https://github.com/SamurAIGPT/AI-Youtube-Shorts-Generator
When to use this skill
- "Generate shorts from this YouTube video"
- "Find the most viral 60-second clips in this podcast"
- "Auto-crop this interview to 9:16"
- "Give me TikTok clips from this lecture"
If the user only wants transcription, summarization, or thumbnails — this is the wrong skill.
Inputs to collect before running
Ask once, then proceed:
- Source — YouTube URL (preferred) or path/URL to an mp4
num_clips— default 3aspect_ratio— default9:16(also:1:1,4:5)language— default auto-detect (forwarded to MuAPI Whisper as ISO-639-1)- Output JSON path — optional; if set, dump full result there
If the user gave a URL and nothing else, use defaults and don't block on questions.
Prerequisites (verify before first run)
- Python 3.10+
- A MuAPI key — set
MUAPI_API_KEYin.env. Powers download, transcription, highlight ranking, and clipping. If missing, stop and ask the user for it; do not invent one. pip install -r requirements.txtinside a venv
If the repo isn't cloned yet, clone https://github.com/SamurAIGPT/AI-Youtube-Shorts-Generator.git into the working directory.
Pipeline (what to execute)
Run the eight stages in order. Each maps to a module in shorts_generator/.
- Download (
downloader.py) — pull the source video at the requested resolution (360/480/720/1080, default720). - Transcribe (
transcriber.py) — MuAPI/openai-whisperruns Whisper server-side and returns timestampedverbose_jsonsegments. Billed per minute of audio. - Classify content type — LLM tags the video (podcast / interview / tutorial / vlog / lecture / monologue) and density. Tune the highlight prompt per type.
- Chunk if long (
highlights.py) — videos >LONG_VIDEO_THRESHOLD(1800s default) are split intoCHUNK_SIZE_SECONDS(1200s default) windows withCHUNK_OVERLAP_SECONDS(60s default) overlap so cross-boundary highlights aren't missed. - Rank highlights — LLM scans each chunk through
VIRALITY_CRITERIA:- Hook moments — strong opening line that stops the scroll
- Emotional peaks — laughter, anger, vulnerability, awe
- Opinion bombs — spicy, contrarian, debate-bait takes
- Revelation moments — "wait, what?" reframes
- Conflict — disagreement, tension, callouts
- Quotable lines — tight, screenshot-worthy phrasing
- Story peaks — climax of a narrative arc
- Practical value — actionable insight a viewer will save
Each candidate gets
start_time,end_time,score0–100,title,hook_sentence,virality_reason. Aim for 30–75s clips unless content dictates otherwise.
- Dedupe — collapse overlaps. Rule: if two candidates overlap > 50%, keep the higher score, drop the other.
- Top-N selection — sort surviving candidates by score, take
num_clips. - Vertical auto-crop (
clipper.py) — render each highlight ataspect_ratio. Auto-handles face tracking and screen recordings; no Haar cascades.
Invocation
CLI (the standard path):
python main.py "<YOUTUBE_URL>" \
--num-clips 5 \
--aspect-ratio 9:16 \
--output-json result.json
Python API (when embedding in another pipeline):
from shorts_generator import generate_shorts
result = generate_shorts(
"<URL>",
num_clips=5,
aspect_ratio="9:16",
)
for short in result["shorts"]:
print(short["score"], short["title"], short["clip_url"])
Batch mode — urls.txt with one URL per line:
xargs -a urls.txt -I{} python main.py "{}"
CLI flags reference
| Flag | Default | Notes |
|---|---|---|
--num-clips |
3 |
How many shorts to render |
--aspect-ratio |
9:16 |
9:16 for TikTok/Reels, 1:1 square, anything else by flag |
--format |
720 |
Source download resolution |
--language |
auto | Whisper language code (e.g. en) |
--output-json |
— | Dump full result (transcript + all candidates + clip URLs) |
Output schema
{
"source_video_url": "...",
"transcript": { "duration": 1873.4, "segments": [...] },
"highlights": [ /* every candidate, before top-N cut */ ],
"shorts": [
{
"title": "The one mistake that cost me $50K",
"start_time": 124.3,
"end_time": 187.6,
"score": 92,
"hook_sentence": "Nobody talks about this, but it killed my first startup...",
"virality_reason": "Opens with a number + regret, peaks on a contrarian lesson",
"clip_url": "https://.../short_1.mp4"
}
]
}
When reporting back to the user, surface for each clip: rank, score, time range, title, hook, and clip URL. Skip the raw transcript unless asked.
Tunable knobs
shorts_generator/highlights.pyVIRALITY_CRITERIA— reorder or extend signalsHIGHLIGHT_SYSTEM_PROMPT— duration sweet spot, hook rules, JSON schemaCHUNK_SIZE_SECONDS— 1200s defaultLONG_VIDEO_THRESHOLD— 1800s defaultCHUNK_OVERLAP_SECONDS— 60s default
shorts_generator/config.py(or env vars)MUAPI_POLL_INTERVAL— 5sMUAPI_POLL_TIMEOUT— 1800s
Whisper transcription
Audio is transcribed by MuAPI's /openai-whisper endpoint (server-side whisper-1, billed per minute). The CLI passes --language straight through; leave it empty for auto-detection, or pass an ISO-639-1 code (e.g. en) to lock it.
Failure modes — handle, don't paper over
- Whisper produced no segments — likely no detectable speech or a hard language. Retry with
--language <code>(correct ISO-639-1) before declaring failure. - API key missing or rejected — surface the exact error; never fabricate a key.
- Job timed out — bump
MUAPI_POLL_TIMEOUTand retry; don't silently truncate. - Highlight ranker returned <
num_clips— return what survived dedupe with a note; don't pad with low-score filler.
Done criteria
The skill is done when:
result["shorts"]has up tonum_clipsentries, each with a workingclip_url.- The user has been shown the ranked list (score, time range, title, hook, URL).
- If
--output-jsonwas set, the file exists and parses.
If any clip URL 404s on a HEAD check, re-run just the crop stage for that highlight rather than re-running the whole pipeline.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核