{ "name": "transcript_to_video", "displayName": "逐字稿AI视频生成", "description": "端到端编排:从输入逐字稿文本,到AI拆分镜脚本、批量生成视频素材、汇总输出视频URL列表+SRT字幕文件。覆盖分镜生成、文生视频/图生视频、任务轮询、结果汇总的完整链路。", "version": "1.0.0", "input": { "type": "object", "required": ["transcript"], "properties": { "transcript": { "type": "string", "description": "逐字稿全文(中文),将被AI拆分为分镜段", "example": "回到开头那个数字,500美元。这个数字之所以让人震撼不是因为它小,而是因为它背后站着的是一个人用了几年的时间在没有任何文档没有任何团队支援的黑暗中..." }, "segmentDuration": { "type": "number", "description": "每段目标时长(秒),影响分镜拆分粒度", "default": 15 }, "videoModel": { "type": "string", "enum": ["720p", "1080p", "pro"], "description": "视频生成模型:720p(默认,性价比最高) / 1080p(高清) / pro(最高质量)", "default": "720p" }, "videoMethod": { "type": "string", "enum": ["text2video", "img2video"], "description": "text2video=纯文生视频(快速省钱),img2video=先生图再图生视频(效果更可控)", "default": "text2video" }, "aspectRatio": { "type": "string", "enum": ["16:9", "9:16", "1:1", "4:3"], "description": "视频画面比例,16:9横屏(默认) / 9:16竖屏(抖音) / 1:1方形", "default": "16:9" }, "frames": { "type": "integer", "enum": [121, 241], "description": "视频帧数:121=5秒(默认) / 241=10秒", "default": 121 } } }, "stages": [ { "id": "stage_1", "name": "AI分镜脚本生成", "description": "Agent将逐字稿拆分为分镜JSON数组 + SRT字幕文件", "parallel": false, "steps": [ { "id": "1.1", "name": "逐字稿拆分为分镜脚本", "type": "ai", "aiConfig": { "systemPrompt": "你是专业的视频分镜脚本编写专家。将逐字稿拆分为分镜段,每段约40-45个中文字(约15秒语速)。为每段生成英文视频生成提示词(prompt),描述画面内容、镜头类型、氛围和画质。prompt必须是英文,要具体、富有画面感、适合AI视频生成。", "userPromptTemplate": "请将以下逐字稿拆分为分镜脚本,每段约{{input.segmentDuration}}秒(约40-45个中文字)。\n\n逐字稿:\n{{input.transcript}}\n\n请输出两部分:\n\n**Part 1: 分镜JSON**\n```json\n[\n {\n \"id\": \"S-01\",\n \"act\": \"段落名称\",\n \"narration\": \"中文旁白原文(从逐字稿截取)\",\n \"type\": \"ai-gen\",\n \"prompt\": \"Detailed English prompt for AI video generation. Include: camera movement, scene description, lighting, mood, style. End with quality keywords like 'Cinematic 4K, dramatic lighting'\",\n \"duration\": \"15s\"\n }\n]\n```\n\n**Part 2: SRT字幕**\n```srt\n1\n00:00:00,000 --> 00:00:15,000\n中文旁白原文\n\n2\n00:00:15,000 --> 00:00:30,000\n...\n```", "temperature": 0.3, "maxTokens": 8000 }, "output": { "storyboard": "分镜JSON数组", "srt": "SRT字幕文件内容" }, "description": "Agent解析逐字稿,生成带英文prompt的分镜脚本和SRT字幕" } ], "aggregation": { "output": "storyboardData", "fields": ["storyboard", "srt"] } }, { "id": "stage_2", "name": "批量生成视频素材", "description": "对每个分镜段调用即梦API生成视频素材,支持text2video和img2video两种模式", "dependsOn": ["stage_1"], "parallel": true, "steps": [ { "id": "2.1", "name": "文生图(img2video模式首帧)", "condition": "input.videoMethod === 'img2video'", "skill": "jimeng-img-v4", "iterate": "storyboardData.storyboard", "iterateAs": "segment", "input": { "prompt": "{{segment.prompt}}", "sizeDate": { "width": "{{input.aspectRatio === '16:9' ? 2560 : input.aspectRatio === '9:16' ? 1440 : 2048}}", "height": "{{input.aspectRatio === '16:9' ? 1440 : input.aspectRatio === '9:16' ? 2560 : 2048}}" } }, "output": "imageWorkIds[{{segment.id}}]", "rateLimit": { "maxConcurrent": 5, "delayMs": 1000 }, "description": "为每个分镜段生成首帧图片(仅img2video模式)" }, { "id": "2.2", "name": "轮询图片生成结果", "condition": "input.videoMethod === 'img2video'", "skill": "jimeng-task-query", "dependsOn": ["2.1"], "iterate": "imageWorkIds", "iterateAs": "workId", "input": { "workId": "{{workId}}", "routerName": "getImgV4" }, "pollingConfig": { "intervalMs": 3000, "maxAttempts": 30, "completionCondition": "data.isFinish === true" }, "description": "每3秒轮询一次图片生成状态" }, { "id": "2.3", "name": "获取图片URL", "condition": "input.videoMethod === 'img2video'", "skill": "jimeng-work-result", "dependsOn": ["2.2"], "iterate": "imageWorkIds", "iterateAs": "workId", "input": { "workId": "{{workId}}" }, "output": "imageUrls[{{segmentId}}]", "responseExtract": "images[0]", "description": "获取生成的图片永久URL作为视频首帧" }, { "id": "2.4", "name": "生成视频(text2video或img2video)", "skill": "jimeng-video-v3-720p", "skillSelector": { "720p": "jimeng-video-v3-720p", "1080p": "jimeng-video-v3-1080p", "pro": "jimeng-video-v3-pro" }, "skillSelectorKey": "input.videoModel", "dependsOn": ["2.3"], "iterate": "storyboardData.storyboard", "iterateAs": "segment", "input": { "prompt": "{{segment.prompt}}", "method": "{{input.videoMethod === 'img2video' ? '2' : '1'}}", "frames": "{{input.frames}}", "config": { "aspect_ratio": "{{input.aspectRatio}}", "image_urls": "{{input.videoMethod === 'img2video' ? [imageUrls[segment.id]] : undefined}}" } }, "output": "videoWorkIds[{{segment.id}}]", "rateLimit": { "maxConcurrent": 5, "delayMs": 1000 }, "description": "为每个分镜段生成视频。text2video用method=1,img2video用method=2+首帧图" } ], "aggregation": { "output": "generationResults", "fields": ["videoWorkIds", "imageUrls"] } }, { "id": "stage_3", "name": "轮询视频生成结果", "description": "轮询所有视频生成任务,获取最终视频URL", "dependsOn": ["stage_2"], "parallel": true, "steps": [ { "id": "3.1", "name": "轮询视频任务状态", "skill": "jimeng-task-query", "iterate": "generationResults.videoWorkIds", "iterateAs": "entry", "input": { "workId": "{{entry.workId}}", "routerName": "{{input.videoModel === '720p' ? 'getVideoV3_720p' : input.videoModel === '1080p' ? 'getVideoV3_1080p' : 'getVideoV3_Pro'}}" }, "pollingConfig": { "intervalMs": 5000, "maxAttempts": 60, "completionCondition": "data.isFinish === true", "timeoutMs": 300000 }, "rateLimit": { "maxConcurrent": 10, "delayMs": 500 }, "description": "每5秒轮询一次视频生成状态,最多5分钟" }, { "id": "3.2", "name": "获取视频URL", "skill": "jimeng-work-result", "dependsOn": ["3.1"], "iterate": "generationResults.videoWorkIds", "iterateAs": "entry", "input": { "workId": "{{entry.workId}}" }, "output": "videoResults[{{entry.segmentId}}]", "responseExtract": { "videoUrl": "videos[0]", "images": "images" }, "description": "获取生成的视频永久URL" } ], "aggregation": { "output": "allVideoResults", "logic": "合并所有视频结果,按分镜段ID排序" } }, { "id": "stage_4", "name": "结果汇总与输出", "description": "汇总所有生成结果,合并分镜脚本与视频URL,统计成功/失败", "dependsOn": ["stage_3"], "parallel": false, "steps": [ { "id": "4.1", "name": "合并分镜与视频结果", "type": "compute", "logic": "mergeStoryboardWithVideos(storyboardData, allVideoResults, imageUrls)", "algorithm": { "merge": "将每个分镜段的videoUrl和imageUrl写入对应的storyboard item", "stats": "统计 totalSegments, successCount, failedCount, failedIds", "sort": "按分镜ID排序确保顺序正确", "srtUpdate": "如果视频实际时长与SRT不同,标注差异供用户参考" }, "output": "finalOutput", "description": "生成最终输出:带videoUrl的分镜JSON + SRT字幕 + 统计信息" } ] }, { "id": "stage_5", "name": "可选:一键成片", "description": "将生成的视频素材通过Quickly AI合成短视频(最长30秒)", "dependsOn": ["stage_4"], "optional": true, "condition": "用户明确要求一键成片 && finalOutput.successCount <= 50", "steps": [ { "id": "5.1", "name": "提交一键成片任务", "skill": "quickly-video-create", "input": { "material_list": "{{finalOutput.segments.filter(s => s.videoUrl).map(s => ({ type: 'video', value: s.videoUrl }))}}", "tags": "{{extractKeywordsFromTranscript(input.transcript)}}", "proportion": "{{input.aspectRatio === '16:9' ? '9:16' : input.aspectRatio}}", "video_duration": { "min": 15, "max": 30 }, "pre_id": "{{Date.now().toString()}}", "ai_voice": 1, "ai_bgm": 1, "ai_subtitle": 1 }, "output": "quicklyTaskId", "description": "将视频素材提交Quickly AI合成短视频(注意:最长30秒限制)" }, { "id": "5.2", "name": "轮询成片结果", "skill": "quickly-video-query", "dependsOn": ["5.1"], "input": { "taskId": "{{quicklyTaskId}}" }, "pollingConfig": { "intervalMs": 15000, "maxAttempts": 40, "completionCondition": "data.length > 0" }, "output": "quicklyResult", "description": "每15秒轮询,最多10分钟" } ] } ], "output": { "type": "object", "description": "工作流最终输出", "properties": { "storyboard": "带videoUrl的完整分镜JSON", "srt": "SRT字幕文件内容", "segments": "视频片段URL列表(按顺序)", "totalSegments": "总分镜段数", "successCount": "成功生成的视频数", "failedCount": "失败的视频数", "failedIds": "失败的分镜段ID列表(可重试)", "quicklyResult": "(可选)一键成片结果" } }, "estimatedTime": { "stage_1": "10-30秒(AI生成分镜)", "stage_2_text2video": "1-3分钟/5段并行(视频生成)", "stage_2_img2video": "2-5分钟/5段并行(图片+视频)", "stage_3": "与stage_2重叠(轮询)", "stage_4": "< 1秒(汇总)", "total_20segments": "约3-8分钟", "total_71segments": "约10-25分钟" }, "userDelivery": { "immediate": "视频片段URL列表 + SRT字幕文件 + 分镜脚本JSON", "userAction": "导入剪映/CapCut → 按SRT时间轴排列视频 → 配音 → 成片", "optional": "一键成片(≤30秒短视频预览)" } }