feat(video-pipeline): 重构多阶段生成管线并集成 CosyVoice TTS
- 重写 `phase-images`:改为并发 3 张并行生成,每个 item 完成立即写入 manifest,支持 MJ task ID 恢复 - 重写 `phase-videos`:先恢复已有 task ID 再提交新任务(并发 3),支持中断恢复 - 迁移 TTS 引擎:从 Qwen-TTS HTTP 接口切换为 CosyVoice WebSocket 接口,支持音色/语气参数透传 - 精简账号系统:移除 `styles/` 目录、`taskId` 过滤和 `--id` 正则校验,`references` 改为顶层字段 - 调整 `slugify`:限制中文字符 5 个、其他 10 个,避免文件名过长 - 更新文档:`manifest-schema.md` 中 `narration` 改为完整原文案,`account-creation.md` 新增 TTS 配置项 - 配置更新:默认 TTS 模型切换为 `cosyvoice-v3.5-plus`,新增 `localAudio` 参数
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* CapCut 成片组装脚本
|
||||
*
|
||||
@@ -167,6 +166,7 @@ async function assemble(args) {
|
||||
apiKey = '',
|
||||
duration = '4',
|
||||
animation = 'kenburns-zoom',
|
||||
localAudio = 'false',
|
||||
} = args
|
||||
|
||||
if (!input) throw new Error('缺少 --input 参数')
|
||||
@@ -295,7 +295,7 @@ async function assemble(args) {
|
||||
// -- 添加 TTS 配音 --
|
||||
step++; console.log(`[${step}/${totalSteps}] 添加 TTS 配音...`)
|
||||
if (voiceover === 'true' && hasTTS) {
|
||||
await addVoiceover(draftUrl, inputDir, items, timeline)
|
||||
await addVoiceover(draftUrl, inputDir, items, timeline, localAudio === 'true')
|
||||
} else {
|
||||
console.log(' 跳过(无 TTS 音频或未启用)')
|
||||
}
|
||||
@@ -567,7 +567,7 @@ async function batchUploadAudio(inputDir, items) {
|
||||
// 添加 TTS 配音(每段音频按时间线排列)
|
||||
// ============================================================================
|
||||
|
||||
async function addVoiceover(draftUrl, inputDir, items, timeline) {
|
||||
async function addVoiceover(draftUrl, inputDir, items, timeline, localAudio = false) {
|
||||
// 收集需要上传的音频
|
||||
const audioItems = items.filter(item => item.audio)
|
||||
if (audioItems.length === 0) {
|
||||
@@ -576,8 +576,10 @@ async function addVoiceover(draftUrl, inputDir, items, timeline) {
|
||||
}
|
||||
|
||||
// 上传本地音频到 OSS(已有的 URL 直接通过)
|
||||
console.log(' 上传 TTS 音频到 OSS...')
|
||||
const audioUrls = await batchUploadAudio(inputDir, items)
|
||||
// 根据 localAudio 参数决定是否上传
|
||||
const audioUrls = localAudio
|
||||
? {} // 本地模式:不上传,使用本地路径
|
||||
: await batchUploadAudio(inputDir, items)
|
||||
|
||||
const audioInfos = []
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user