将原始文案智能拆分成适合视频展示的场景/句子,每个句子长度适中,语义完整,适合作为视频字幕展示。
Splits video scripts into optimal scenes for subtitles, ensuring semantic completeness and ideal length.
/plugin marketplace add readonme/claude_video_plugin/plugin install video-creator@claude-video-plugin将原始文案智能拆分成适合视频展示的场景/句子,每个句子长度适中,语义完整,适合作为视频字幕展示。
用户会通过以下方式提供输入:
/video-creator:scene path/to/script.txt path/to/project_folder
此命令会在项目文件夹中创建以下结构:
<project_folder>/
├── script.txt # 原始脚本的副本
├── scenes.json # 本命令的输出(拆分后的句子列表)
├── audio/ # 后续命令的输出目录
└── images/ # 后续命令的输出目录
这是最重要的规则,违反此规则视为任务彻底失败:
禁止使用 Python/Bash 脚本拆分文案
python3 << 'EOF' 或任何脚本语言必须使用 LLM 智能拆分
为什么禁止脚本?
audio/ 和 images/输出示例:
📁 创建项目文件夹: /path/to/project
✅ 创建 audio/ 目录
✅ 创建 images/ 目录
✅ 复制脚本文件到项目文件夹
输出示例:
📄 读取原始文案
================================
文件: /path/to/script.txt
语言: 英文
总字符数: 8,500
预估句子数: 150-200
目标长度(适合 YouTube 视频字幕):
拆分原则:
由于文案可能很长,需要分批处理:
| 原文长度 | 每批处理量 | 说明 |
|---|---|---|
| < 2000 字符 | 全部 | 一次处理完 |
| 2000-5000 字符 | 约 1000 字符 | 分 2-5 批 |
| 5000-10000 字符 | 约 1500 字符 | 分 4-7 批 |
| > 10000 字符 | 约 2000 字符 | 根据总量计算 |
对于每一批,必须执行以下流程:
═══════════════════════════════════════════════════════════════
📦 批次 1/5:处理原文第 1-1500 字符
═══════════════════════════════════════════════════════════════
原文片段:
"Your brain on toxic love is like a slot machine player at 3 a.m., same reward patterns, same addiction cycles, same panic when the machine stops paying out. The dopamine hits feel amazing at first..."
拆分结果:
1. "Your brain on toxic love is like a slot machine player at 3 a.m."
2. "Same reward patterns, same addiction cycles, same panic when the machine stops paying out."
3. "The dopamine hits feel amazing at first."
...
✅ 批次 1 完成:生成 25 个句子
═══════════════════════════════════════════════════════════════
正确拆分示例:
| 原文 | 正确拆分 | 错误拆分 |
|---|---|---|
| "He said, 'I love you.' She smiled." | ✅ "He said, 'I love you.'" + "She smiled." | ❌ "He said," + "'I love you.'" + "She smiled." |
| "First, prepare the ingredients; second, mix them well." | ✅ "First, prepare the ingredients." + "Second, mix them well." | ❌ "First," + "prepare the ingredients;" + "second," + "mix them well." |
| "This is amazing—truly incredible!" | ✅ "This is amazing—truly incredible!" | ❌ "This is amazing—" + "truly incredible!" |
避免以下错误:
" 或 —)拆成独立句子拆分完成后,需要清理每个句子中会影响 TTS 朗读的特殊字符:
需要移除的字符:
* 星号(Markdown 强调标记)- 句首的连字符/列表符号" " ' ' " ' 各类引号~ 波浪号# 井号_ 下划线(Markdown 强调标记)清理规则:
- 或 *(列表符号)*、_、#、~)清理示例:
| 原句 | 清理后 |
|---|---|
"This is amazing!" | This is amazing! |
- First, do this. | First, do this. |
*Really* important | Really important |
She said, "Hello." | She said, Hello. |
将拆分结果保存到 <project_folder>/scenes.json:
{
"source_file": "/path/to/script.txt",
"language": "en",
"total_sentences": 174,
"generated_at": "2024-01-15T10:30:00Z",
"sentences": [
{
"index": 1,
"script": "Your brain on toxic love is like a slot machine player at 3 a.m.",
"word_count": 14
},
{
"index": 2,
"script": "Same reward patterns, same addiction cycles, same panic when the machine stops paying out.",
"word_count": 13
}
]
}
字段说明:
source_file:原始文件路径language:检测到的语言(en / zh / mixed)total_sentences:总句子数sentences:句子数组
index:句子序号(从 1 开始)script:句子内容word_count:单词数(英文)或字符数(中文)🎉 文案拆分完成!
================================
📂 项目文件夹: /path/to/project
📄 原始文件: script.txt
📝 输出文件: scenes.json
🌐 语言: 英文
📊 句子数量: 174
📏 平均长度: 15.2 单词/句
句子长度分布:
5-10 单词: 32 句 (18.4%)
11-15 单词: 68 句 (39.1%)
16-20 单词: 52 句 (29.9%)
21-25 单词: 22 句 (12.6%)
后续命令:
1. 生成提示词: /video-creator:prompt /path/to/project
2. 生成音频: /video-creator:audio /path/to/project
3. 生成图像: /video-creator:image /path/to/project
如果输入文件为空,停止执行并提示:
⚠️ 输入文件为空或没有找到有效的内容。
如果输入文件路径不存在,停止执行并提示:
❌ 错误:文件不存在 - {file_path}
如果项目文件夹已存在且包含 scenes.json:
⚠️ 项目文件夹已存在且包含之前的输出
是否覆盖?(y/n)
如果检测到中英文混合:
language: "mixed"✅ 任务成功的标志:
scenes.json 文件