从项目文件夹中读取 `script_output.json`,使用 MiniMax TTS Batch API 批量生成高质量音频文件。
Generates TTS audio files from video scripts using MiniMax Batch API with automatic batching.
/plugin marketplace add readonme/claude_video_plugin/plugin install video-creator@claude-video-plugin从项目文件夹中读取 script_output.json,使用 MiniMax TTS Batch API 批量生成高质量音频文件。
每次调用 text_to_speech_batch 最多处理 10 个句子
这是硬性限制,原因:
批次处理流程:
script_output.json 的目录)--voice / -v: 音色 ID(默认: English_Gentle-voiced_man)--speed / -s: 语速 [0.5-2.0](默认: 1.2)--emotion / -e: 情绪风格(默认: 自动检测)--format / -f: 音频格式 (mp3/wav/flac)(默认: mp3)# 基本用法(从项目文件夹读取)
/video-creator:audio /path/to/project_folder
# 自定义音色和语速
/video-creator:audio /path/to/project_folder --voice English_Graceful_Lady --speed 1.2
# 指定情绪
/video-creator:audio /path/to/project_folder --emotion happy
此命令期望以下项目文件夹结构:
<project_folder>/
├── script_output.json # 输入:脚本+提示词(来自 /video-creator:scene-and-prompt)
└── audio/ # 输出:音频文件将保存到这里
├── audio_001.mp3
├── audio_002.mp3
├── ...
└── audio_metadata.json
<project_folder>/script_output.jsonscript 字段的数组)<project_folder>/audio/ 目录存在输出格式示例:
🎙️ 生成 TTS 音频文件
================================
项目文件夹: /path/to/project
输入文件: script_output.json
句子总数: 14
音色: English_Gentle-voiced_man
语速: 1.2x
输出目录: audio/
准备批量生成音频...
重要规则:
start_index 参数确保文件命名连续根据句子总数自动划分批次(每批最多 10 个):
| 句子总数 | 批次数 | 每批数量 |
|---|---|---|
| 1-10 | 1 | 全部 |
| 11-20 | 2 | 10 + 剩余 |
| 21-30 | 3 | 10 + 10 + 剩余 |
| 31-40 | 4 | 10 + 10 + 10 + 剩余 |
| ... | ... | ... |
情况 A:句子 ≤ 10 个(单批处理)
{
"json_file": "/path/to/project/script_output.json",
"output_dir": "/path/to/project/audio",
"voice_id": "English_Gentle-voiced_man",
"model": "speech-2.6-hd",
"speed": 1.2,
"audio_format": "mp3",
"sample_rate": 32000,
"naming_pattern": "sequential",
"start_index": 1,
"concurrency": 3,
"force_regenerate": false
}
情况 B:句子 > 10 个(多批处理)
必须分批调用,使用 sentences 参数传入每批的句子数组,并设置 start_index:
═══════════════════════════════════════════════════════════════
📦 批次 1/5:处理句子 1-10
═══════════════════════════════════════════════════════════════
批次 1(句子 1-10):
{
"sentences": [
{"script": "第1句脚本..."},
{"script": "第2句脚本..."},
...
{"script": "第10句脚本..."}
],
"output_dir": "/path/to/project/audio",
"start_index": 1,
"voice_id": "English_Gentle-voiced_man",
"model": "speech-2.6-hd",
"speed": 1.2,
"audio_format": "mp3",
"concurrency": 3
}
✅ 批次 1 完成:10/10 成功
📊 累计进度:10/45 (22.2%)
═══════════════════════════════════════════════════════════════
📦 批次 2/5:处理句子 11-20
═══════════════════════════════════════════════════════════════
批次 2(句子 11-20):
{
"sentences": [
{"script": "第11句脚本..."},
...
{"script": "第20句脚本..."}
],
"output_dir": "/path/to/project/audio",
"start_index": 11,
"voice_id": "English_Gentle-voiced_man",
"model": "speech-2.6-hd",
"speed": 1.2,
"audio_format": "mp3",
"concurrency": 3
}
继续处理批次 3, 4, 5...
| 参数 | 说明 | 默认值 |
|---|---|---|
sentences | 当前批次的句子数组(每批最多 10 个) | - |
start_index | 文件命名起始索引,确保跨批次连续 | 1 |
output_dir | 音频输出目录 | ./audio_output |
voice_id | 音色 ID | female-tianmei |
model | TTS 模型 | speech-2.6-hd |
speed | 语速 [0.5-2.0] | 1.0 |
audio_format | 音频格式 (mp3/wav/flac) | mp3 |
concurrency | 并发数 [1-5] | 3 |
force_regenerate | 是否强制重新生成 | false |
批量工具优势:
audio_metadata.json 元数据文件audio_001.mp3, audio_002.mp3, ...批量工具会自动生成 audio_metadata.json,包含:
absolute_path)duration_ms)file_size_bytes)元数据文件格式示例:
{
"source_file": "/path/to/project/script_output.json",
"generated_at": "2024-01-01T12:00:00.000Z",
"total_sentences": 14,
"successful_generations": 14,
"failed_generations": 0,
"skipped_files": 0,
"voice_settings": {
"voice_id": "English_Gentle-voiced_man",
"model": "speech-2.6-hd",
"speed": 1.2,
"audio_format": "mp3"
},
"audio_files": [
{
"index": 1,
"script": "Your brain on toxic love is like a slot machine player at 3 a.m.",
"audio_file": "audio_001.mp3",
"absolute_path": "/path/to/project/audio/audio_001.mp3",
"duration_ms": 3500,
"file_size_bytes": 56000
}
],
"summary": {
"total_duration_ms": 48650,
"total_duration_seconds": 48.65,
"total_size_bytes": 778400
}
}
🎉 音频生成完成!
================================
📝 句子总数: 45
📦 处理批次: 5 批(每批最多 10 个)
✅ 成功: 44/45 个句子
⏭️ 跳过: 0 个(已存在)
❌ 失败: 1 个
📂 输出目录: /path/to/project/audio/
⏱️ 总时长: 156.8 秒
📊 元数据: audio_metadata.json
后续命令:
1. 生成图像: /video-creator:image /path/to/project
2. 创建视频: /video-creator:jianying_draft /path/to/project
English_Gentle-voiced_man - 温和男声(默认)English_Trustworthy_Man - 可信赖男声English_Diligent_Man - 勤勉男声English_Graceful_Lady - 优雅女士Arnold - 浑厚男声(较快语速)Rudolph - 活力男声Grinch - 戏剧性男声(较慢语速)female-tianmei - 甜美女声male-qn-qingse - 清晰男声happy, sad, angry, fearful, disgusted, surprised, calm(默认), fluent
如果音频生成中断,再次运行命令会:
要强制重新生成所有音频,使用 force_regenerate: true 参数。
/video-creator:scene-and-prompt/video-creator:scene-and-prompterrors 字段force_regenerate: true✅ 任务成功的标志:
script_output.jsonstart_index<project_folder>/audio/ 目录audio_metadata.json 元数据文件json_file 和 output_dir 都必须是绝对路径audio/ 子目录中