feat(video-pipeline): 重构视频流水线,优化成片时间线规则和状态管理
- 引入 manifest.json 作为唯一状态源,所有子 Agent 操作回写 manifest - 重构 timebuilder 逻辑,支持四种视频适配策略(加速/裁剪/放缓/画面停顿) - 统一 TTS 阶段输出结构,单句和多句均写入 segments[] - 重写字幕和配音生成,基于 segments 精确时长实现音画同步 - 新增 confirm 命令支持按 id 范围确认,上传阶段分离图片和视频 - 添加中间产物写入 output/ 目录的约束,清理废弃配置参数
This commit is contained in:
@@ -112,13 +112,23 @@ function applyRetryFailed(manifest, phases) {
|
||||
for (const item of manifest.items) {
|
||||
if (item.status === 'failed' || item.status === 'partial') {
|
||||
if (item.url && item.videoPrompt && !item.video) {
|
||||
// 图片已上传但视频未生成 → 直接重试视频阶段
|
||||
item.status = 'done'
|
||||
item.error = ''
|
||||
resetCount++
|
||||
} else if (!item.url && item.imagePrompt) {
|
||||
item.status = 'pending'
|
||||
item.error = ''
|
||||
resetCount++
|
||||
// 图片未上传 → 重试图片阶段
|
||||
// 如果首帧已存在但 lastFrame 失败,只重置 lastFrame 相关
|
||||
if (item.file && manifest.mode === 'framePair' && !item.lastFrame) {
|
||||
item.status = 'done' // 保留首帧,只补 lastFrame
|
||||
item.error = ''
|
||||
resetCount++
|
||||
} else {
|
||||
item.status = 'pending'
|
||||
item.error = ''
|
||||
delete item.file // 清除旧文件引用,避免重复
|
||||
resetCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,7 +138,7 @@ function applyRetryFailed(manifest, phases) {
|
||||
}
|
||||
}
|
||||
if (phases.includes('images')) {
|
||||
if (manifest.items.some(it => !it.status || it.status === 'pending')) {
|
||||
if (manifest.items.some(it => (!it.status || it.status === 'pending') || (it.status === 'done' && manifest.mode === 'framePair' && !it.lastFrame))) {
|
||||
manifest.pipeline.phases.images = 'pending'
|
||||
}
|
||||
}
|
||||
@@ -159,7 +169,6 @@ function parseArgs(argv) {
|
||||
else if (argv[i] === '--image-model' && argv[i + 1]) args.imageModel = argv[++i]
|
||||
else if (argv[i] === '--video-model' && argv[i + 1]) args.videoModel = argv[++i]
|
||||
else if (argv[i] === '--references' && argv[i + 1]) args.references = argv[++i]
|
||||
else if (argv[i] === '--style' && argv[i + 1]) args.style = argv[++i]
|
||||
else if (argv[i] === '--all') args.all = true
|
||||
else if (!args.command) args.command = argv[i]
|
||||
}
|
||||
@@ -219,6 +228,7 @@ async function main() {
|
||||
console.log(' pipeline.js init --account <id> --mode <single|framePair> --items <JSON> [--items-file <path>] [--image-model gemini|mj] [--video-model veo3-fast|grok|kling] [--format 9:16]')
|
||||
console.log(' pipeline.js validate --manifest <path>')
|
||||
console.log(' pipeline.js confirm --manifest <path> --all')
|
||||
console.log(' pipeline.js confirm --manifest <path> --items 1,3,5')
|
||||
console.log(' pipeline.js run --manifest <path> [--account id] [--phase p1,p2] [--resume] [--retry-failed]')
|
||||
console.log(' pipeline.js status --manifest <path>')
|
||||
console.log('')
|
||||
|
||||
Reference in New Issue
Block a user