muapi-ai-clipping
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAI Clipping
AI剪辑
One API call: long video in → ranked vertical short clips out.
Each clip ships with a viral score (0–100), an opening hook line, a one-sentence "why it works" reason, and a hosted mp4 URL.
Underlying API: https://muapi.ai/playground/ai-clipping
Reference implementation (open source): https://github.com/SamurAIGPT/AI-Youtube-Shorts-Generator
一次API调用:输入长视频 → 输出已排名的垂直短视频。
每个片段都会附带传播度分数(0–100)、开场钩子文案、一句“为何有效”的说明,以及托管的mp4链接。
底层API:https://muapi.ai/playground/ai-clipping
参考实现(开源):https://github.com/SamurAIGPT/AI-Youtube-Shorts-Generator
When to Use
适用场景
- Auto-clip a podcast, interview, lecture, vlog, or stream into TikTok / Reels / Shorts.
- Extract the best 30–75s moments from any hosted video URL.
- Get face-tracked vertical (9:16), square (1:1), or portrait (4:5) crops without running ffmpeg locally.
If you only need raw timestamps for your own renderer, set to skip cropping and just get the highlight ranges.
--coords-only- 将播客、采访、讲座、vlog或直播自动剪辑为TikTok / Reels / Shorts格式的短视频。
- 从任何托管视频链接中提取最佳的30–75秒片段。
- 无需本地运行ffmpeg,即可获取人脸追踪的垂直(9:16)、方形(1:1)或竖屏(4:5)裁剪视频。
如果您只需要原始时间戳用于自定义渲染,可设置参数跳过裁剪,仅获取精彩片段的时间范围。
--coords-onlyAgent Execution Protocol
Agent执行流程
Step 1 — Collect Inputs
步骤1 — 收集输入
| Input | Required | Default | Notes |
|---|---|---|---|
| yes | — | Hosted mp4 URL, or local file path (auto-uploaded), or YouTube URL (if backend supports it) |
| no | | Number of highlights to extract |
| no | | |
| no | off | Return just the highlight time ranges, skip cropping |
If the user gave only a video URL, run with defaults — don't block on questions.
| 输入参数 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|
| 是 | — | 托管mp4链接、本地文件路径(会自动上传)或YouTube链接(若后端支持) |
| 否 | | 要提取的精彩片段数量 |
| 否 | | |
| 否 | 关闭 | 仅返回精彩片段的时间范围,跳过裁剪 |
如果用户仅提供了视频链接,使用默认参数运行,无需额外询问。
Step 2 — Verify Prerequisites
步骤2 — 验证前置条件
- installed and authed (
muapi-cli)muapi auth configure - available (env var or
MUAPI_API_KEYpasses)muapi auth status
That's it. No , no Python, no Whisper install, no LLM keys. Everything runs server-side.
ffmpeg- 已安装并授权(执行
muapi-cli)muapi auth configure - 可用(环境变量或
MUAPI_API_KEY验证通过)muapi auth status
仅此而已。无需、Python、Whisper安装或LLM密钥。所有处理均在服务器端完成。
ffmpegStep 3 — Run the Skill
步骤3 — 运行该技能
bash
bash library/edit/ai-clipping/scripts/run-ai-clipping.sh \
--video "https://example.com/podcast.mp4" \
--num-clips 5 \
--aspect-ratio 9:16 \
--viewThe script:
- Resolves to a hosted URL (uploads local files via
--videoif needed).muapi upload file - Calls with the supported parameters.
muapi edit clipping - Polls until the job is done (or returns the immediately under
request_id).--async - Prints a ranked summary and, if is set, writes the full result.
--output-json
bash
bash library/edit/ai-clipping/scripts/run-ai-clipping.sh \
--video "https://example.com/podcast.mp4" \
--num-clips 5 \
--aspect-ratio 9:16 \
--view该脚本会:
- 将解析为托管链接(若为本地文件,会通过
--video自动上传)。muapi upload file - 使用支持的参数调用。
muapi edit clipping - 轮询直到任务完成(若设置则立即返回
--async)。request_id - 打印已排名的摘要,若设置则写入完整结果。
--output-json
What Happens Server-Side
服务器端处理流程
The endpoint internally runs the full pipeline so the agent doesn't have to:
/ai-clipping- Transcribe with Whisper.
- Classify content type (podcast / interview / tutorial / vlog / lecture / monologue).
- Rank highlights through the virality framework:
- 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
- Dedupe overlapping candidates by score.
- Top-N select and face-track auto-crop to the requested aspect ratio.
This is why the skill is small: the heavy lifting is on the API.
/ai-clipping- 转录:使用Whisper完成。
- 内容类型分类(播客/采访/教程/vlog/讲座/独白)。
- 精彩片段排名:通过传播度框架完成:
- 钩子时刻 — 能吸引用户停留的强力开场
- 情感峰值 — 笑声、愤怒、脆弱、惊叹等时刻
- 争议观点 — 尖锐、逆向、引发讨论的言论
- 揭秘时刻 — 颠覆认知的观点
- 冲突 — 分歧、紧张、指责等场景
- 金句 — 简洁、适合截图传播的语句
- 故事高潮 — 叙事弧的顶点
- 实用价值 — 用户会保存的可操作见解
- 去重:按分数去除重叠候选片段。
- Top-N选择与人脸追踪自动裁剪:裁剪至指定宽高比。
这就是该技能体积小巧的原因:繁重的计算都由API完成。
Quick Invocation Patterns
快速调用示例
Defaults — three 9:16 clips:
bash
bash run-ai-clipping.sh --video "https://example.com/long.mp4"Podcast — more clips, view in player:
bash
bash run-ai-clipping.sh --video "<URL>" --num-clips 8 --viewSquare clips for Instagram feed:
bash
bash run-ai-clipping.sh --video "<URL>" --aspect-ratio 1:1 --num-clips 3Just the timestamps (build your own renderer):
bash
bash run-ai-clipping.sh --video "<URL>" --coords-only --output-json result.jsonAsync submit (returns request_id, poll later):
bash
REQUEST_ID=$(bash run-ai-clipping.sh --video "<URL>" --async --output-json - | jq -r '.request_id')
muapi predict wait "$REQUEST_ID" --download ./outputsLocal file:
bash
bash run-ai-clipping.sh --video ./recording.mp4 --num-clips 5 --viewBatch — with one URL per line:
urls.txtbash
xargs -a urls.txt -I{} bash run-ai-clipping.sh --video "{}"默认配置 — 3个9:16格式片段:
bash
bash run-ai-clipping.sh --video "https://example.com/long.mp4"播客场景 — 更多片段,在播放器中查看:
bash
bash run-ai-clipping.sh --video "<URL>" --num-clips 8 --view适合Instagram Feed的方形片段:
bash
bash run-ai-clipping.sh --video "<URL>" --aspect-ratio 1:1 --num-clips 3仅获取时间戳(自定义渲染):
bash
bash run-ai-clipping.sh --video "<URL>" --coords-only --output-json result.json异步提交(返回request_id,稍后轮询):
bash
REQUEST_ID=$(bash run-ai-clipping.sh --video "<URL>" --async --output-json - | jq -r '.request_id')
muapi predict wait "$REQUEST_ID" --download ./outputs本地文件:
bash
bash run-ai-clipping.sh --video ./recording.mp4 --num-clips 5 --view批量处理 — 每行一个链接:
urls.txtbash
xargs -a urls.txt -I{} bash run-ai-clipping.sh --video "{}"Aspect Ratio Picker
宽高比选择指南
| Platform | Ratio | Sweet-spot duration |
|---|---|---|
| TikTok / Reels / YouTube Shorts | | 30–75s |
| Instagram Feed | | 15–45s |
| Pinterest / portrait | | 30–60s |
Default to unless the platform is specified.
9:16| 平台 | 宽高比 | 最佳时长 |
|---|---|---|
| TikTok / Reels / YouTube Shorts | | 30–75秒 |
| Instagram Feed | | 15–45秒 |
| Pinterest / 竖屏 | | 30–60秒 |
除非指定平台,否则默认使用。
9:16Output Schema
输出格式
json
{
"source_video_url": "...",
"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 is set, each entry has / but no — render locally with ffmpeg.
--coords-onlystart_timeend_timeclip_urlWhen reporting back to the user, surface for each clip: rank, score, time range, title, hook, and clip URL.
json
{
"source_video_url": "...",
"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"
}
]
}当设置时,每个条目仅包含/,无 — 需使用ffmpeg本地渲染。
--coords-onlystart_timeend_timeclip_url向用户反馈时,需展示每个片段的排名、分数、时间范围、标题、钩子文案及视频链接。
Common Mistakes to Avoid
需避免的常见错误
- Wrong aspect ratio for the platform — Shorts / TikTok / Reels are . Default to that.
9:16 - Padding to hit — if the API returns fewer survivors than requested, return what you have. Don't pretend.
num_clips - Re-running on a 404'd clip URL — the same can be re-fetched with
request_idrather than re-clipping.muapi predict wait <id> - Trying to tune Whisper / chunk size / LLM prompts — those knobs aren't exposed; the endpoint handles them.
- 平台宽高比错误 — Shorts / TikTok / Reels使用。默认使用该比例。
9:16 - 凑数达到数量 — 如果API返回的有效片段少于请求数量,返回实际结果即可,不要伪造。
num_clips - 重新调用已失效的片段链接 — 可通过重新获取同一个
muapi predict wait <id>的结果,无需重新剪辑。request_id - 尝试调整Whisper/分块大小/LLM提示词 — 这些参数未对外开放,由端点自行处理。
Failure Modes
故障场景
- API key missing or rejected — surface the exact error; never fabricate a key.
- Job timed out — bump poll timeout () and retry.
--poll-timeout - Source URL not reachable from the backend — upload locally with first, then pass the returned URL.
muapi upload file <path> - Fewer clips returned than requested — the source had fewer rankable highlights. Return what came back with a note.
- API密钥缺失或被拒绝 — 显示具体错误;切勿伪造密钥。
- 任务超时 — 增加轮询超时时间()并重试。
--poll-timeout - 后端无法访问源链接 — 先使用上传本地文件,再传入返回的链接。
muapi upload file <path> - 返回片段数量少于请求数量 — 源视频中可排名的精彩片段不足。返回实际结果并附带说明。
Done Criteria
完成标准
The skill is done when:
- has up to
result.shortsentries, each with a workingnum_clips(orclip_url/start_timeunderend_time).--coords-only - The user has been shown the ranked list (score, time range, title, hook, URL).
- If was set, the file exists and parses.
--output-json
满足以下条件时,技能执行完成:
- 包含最多
result.shorts个条目,每个条目均有可用的num_clips(或设置clip_url时包含--coords-only/start_time)。end_time - 已向用户展示已排名的列表(分数、时间范围、标题、钩子文案、链接)。
- 若设置,文件已存在且可正常解析。
--output-json