{
  "format": "mosael-workflow",
  "version": 1,
  "workflow_revision": 1,
  "name": "任意时长的数字人",
  "description": "一张人物照片加一篇稿子：配成音频，切成一段段，人物接着上一段的尾巴往下说，接成一条不切镜头的长片。要有肖像和声音的授权。",
  "graph_hash": "6171e313cc848bba6ee242ec670707735c312b815d2a5f86529532d663d0468a",
  "graph": {
    "meta": {
      "template_id": "long_talk_video",
      "template_version": 5,
      "source": "official"
    },
    "nodes": [
      {
        "id": "start",
        "type": "start",
        "name": "开始",
        "position": {
          "x": 40,
          "y": 300
        },
        "config": {
          "params": {
            "script": "",
            "face_asset_id": "",
            "voice_id": "",
            "scene": "",
            "consent": "",
            "segment_seconds": 10.125,
            "overlap_seconds": 1.625
          },
          "required_params": [
            "script",
            "face_asset_id",
            "voice_id",
            "consent"
          ],
          "param_options": {
            "consent": [
              {
                "value": "yes",
                "label": "已取得授权 / Consent obtained"
              }
            ]
          }
        }
      },
      {
        "id": "speak",
        "type": "synthesize_speech",
        "name": "把稿子配成音频",
        "position": {
          "x": 340,
          "y": 300
        },
        "config": {
          "text": "{{start.script}}",
          "engine": "builtin:clone",
          "voice": "{{start.voice_id}}"
        }
      },
      {
        "id": "tighten",
        "type": "tighten_pauses",
        "name": "压缩停顿",
        "position": {
          "x": 490,
          "y": 460
        },
        "config": {
          "asset_id": "",
          "max_pause": 0.6
        },
        "inputs": [
          "asset_id"
        ]
      },
      {
        "id": "voice_info",
        "type": "asset",
        "name": "配音有多长",
        "position": {
          "x": 640,
          "y": 300
        },
        "config": {
          "asset_id": ""
        },
        "inputs": [
          "asset_id"
        ]
      },
      {
        "id": "plan",
        "type": "chain_plan",
        "name": "算要几段",
        "position": {
          "x": 940,
          "y": 300
        },
        "config": {
          "target_seconds": "",
          "longest_seconds": "{{start.segment_seconds}}",
          "allowed_seconds": "{{start.segment_seconds}}",
          "overlap_seconds": "{{start.overlap_seconds}}",
          "fps": 24,
          "shortest_seconds": 5.166666666666667
        },
        "inputs": [
          "target_seconds"
        ]
      },
      {
        "id": "video_project",
        "type": "project_sequence_create",
        "name": "建立项目与时间线",
        "position": {
          "x": 940,
          "y": 60
        },
        "config": {
          "name": "数字人",
          "fps": 24,
          "width": 1920,
          "height": 1080
        }
      },
      {
        "id": "voice_open",
        "type": "media_clip",
        "name": "取第一段的配音",
        "position": {
          "x": 1240,
          "y": 300
        },
        "config": {
          "asset_id": "",
          "start": 0,
          "end": ""
        },
        "inputs": [
          "asset_id",
          "end"
        ]
      },
      {
        "id": "opening",
        "type": "ai_generate",
        "name": "说第一段",
        "position": {
          "x": 1540,
          "y": 300
        },
        "config": {
          "provider": "",
          "provider_profile_id": "",
          "model": "",
          "kind": "video",
          "prompt": "<Picture 1> is the person in the reference photo; keep the face, hair and clothes exactly. {{start.scene}} Highest priority: whenever the person is on screen the mouth keeps speaking, the lips, jaw and cheeks follow <Audio 1> syllable by syllable, opening and closing naturally every half second, teeth and the inside of the mouth visible. Photorealistic documentary footage, real skin with pores, natural micro-expressions, eye blinks, subtle breathing, natural available light, film grain, no beauty filter, no CGI look. One continuous shot, the camera stays still, no cut.",
          "parameters": {
            "52.project_folder": "mosael/{{video_project.project_id}}",
            "52.scene_number": 1,
            "7.length": "{{plan.opening_frames}}"
          },
          "source_assets": [
            "{{start.face_asset_id}}:reference_image",
            "{{voice_open.asset_id}}:driving_audio"
          ],
          "consent": "{{start.consent}}"
        }
      },
      {
        "id": "segments",
        "type": "loop_foreach",
        "name": "一段接一段往下说",
        "position": {
          "x": 1840,
          "y": 300
        },
        "config": {
          "items": "",
          "inputs": {
            "scene": "{{start.scene}}",
            "consent": "{{start.consent}}",
            "face_asset_id": "{{start.face_asset_id}}",
            "voice_asset_id": "{{tighten.asset_id}}",
            "latent_folder": "mosael/{{video_project.project_id}}",
            "overlap_seconds": "{{start.overlap_seconds}}"
          },
          "body": {
            "nodes": [
              {
                "id": "voice",
                "type": "media_clip",
                "name": "取这一段的配音",
                "position": {
                  "x": 80,
                  "y": 260
                },
                "config": {
                  "asset_id": "{{input.voice_asset_id}}",
                  "start": "{{loop.item.clip_from}}",
                  "end": "{{loop.item.to_seconds}}"
                }
              },
              {
                "id": "extend",
                "type": "ai_generate",
                "name": "接着往下说",
                "position": {
                  "x": 390,
                  "y": 140
                },
                "config": {
                  "provider": "",
                  "provider_profile_id": "",
                  "model": "",
                  "kind": "video",
                  "prompt": "<Picture 1> is the person in the reference photo; keep the face, hair and clothes exactly. {{input.scene}} Highest priority: whenever the person is on screen the mouth keeps speaking, the lips, jaw and cheeks follow <Audio 1> syllable by syllable, opening and closing naturally every half second, teeth and the inside of the mouth visible. Photorealistic documentary footage, real skin with pores, natural micro-expressions, eye blinks, subtle breathing, natural available light, film grain, no beauty filter, no CGI look. One continuous shot, the camera stays still, no cut.",
                  "parameters": {
                    "50.project_folder": "{{input.latent_folder}}",
                    "50.scene_number": "{{loop.item.previous_scene}}",
                    "52.project_folder": "{{input.latent_folder}}",
                    "52.scene_number": "{{loop.item.scene}}",
                    "7.length": "{{loop.item.frames}}"
                  },
                  "source_assets": [
                    "{{input.face_asset_id}}:reference_image",
                    "{{voice.asset_id}}:driving_audio"
                  ],
                  "consent": "{{input.consent}}"
                }
              }
            ],
            "edges": [
              {
                "id": "voice_extend",
                "source": "voice",
                "target": "extend"
              }
            ]
          },
          "output": "{{extend.asset_id}}",
          "previous_initial": ""
        },
        "inputs": [
          "items",
          "previous_initial"
        ]
      },
      {
        "id": "clear_timeline",
        "type": "timeline_clear",
        "name": "清空时间线",
        "position": {
          "x": 2140,
          "y": 300
        },
        "config": {
          "sequence_id": ""
        },
        "inputs": [
          "sequence_id"
        ]
      },
      {
        "id": "append_opening",
        "type": "timeline_append",
        "name": "摆上第一段",
        "position": {
          "x": 2440,
          "y": 300
        },
        "config": {
          "sequence_id": "",
          "asset_id": ""
        },
        "inputs": [
          "sequence_id",
          "asset_id"
        ]
      },
      {
        "id": "assemble",
        "type": "loop_foreach",
        "name": "把后面每一段接上去",
        "position": {
          "x": 2740,
          "y": 300
        },
        "config": {
          "items": "",
          "inputs": {
            "sequence_id": "{{video_project.sequence_id}}",
            "overlap_seconds": "{{start.overlap_seconds}}"
          },
          "body": {
            "nodes": [
              {
                "id": "append_segment",
                "type": "timeline_append",
                "name": "接到时间线上",
                "position": {
                  "x": 80,
                  "y": 140
                },
                "config": {
                  "sequence_id": "{{input.sequence_id}}",
                  "start": "{{input.overlap_seconds}}",
                  "asset_id": "{{loop.item}}"
                }
              }
            ],
            "edges": []
          },
          "output": "{{loop.item}}"
        },
        "inputs": [
          "items"
        ]
      },
      {
        "id": "export_final",
        "type": "export_sequence",
        "name": "导出成片",
        "position": {
          "x": 3040,
          "y": 300
        },
        "config": {
          "sequence_id": "",
          "quality": "high"
        },
        "inputs": [
          "sequence_id"
        ]
      },
      {
        "id": "output",
        "type": "output",
        "name": "交付成片",
        "position": {
          "x": 3340,
          "y": 300
        },
        "config": {
          "values": {
            "video_asset_id": "{{export_final.asset_id}}",
            "segments": "{{segments.results}}"
          }
        }
      }
    ],
    "edges": [
      {
        "id": "start_speak",
        "source": "start",
        "target": "speak"
      },
      {
        "id": "speak_tighten",
        "source": "speak",
        "target": "tighten"
      },
      {
        "id": "tighten_info",
        "source": "tighten",
        "target": "voice_info"
      },
      {
        "id": "info_plan",
        "source": "voice_info",
        "target": "plan"
      },
      {
        "id": "plan_project",
        "source": "plan",
        "target": "video_project"
      },
      {
        "id": "plan_voice",
        "source": "plan",
        "target": "voice_open"
      },
      {
        "id": "project_opening",
        "source": "video_project",
        "target": "opening"
      },
      {
        "id": "voice_opening",
        "source": "voice_open",
        "target": "opening"
      },
      {
        "id": "opening_segments",
        "source": "opening",
        "target": "segments"
      },
      {
        "id": "segments_clear",
        "source": "segments",
        "target": "clear_timeline"
      },
      {
        "id": "clear_opening",
        "source": "clear_timeline",
        "target": "append_opening"
      },
      {
        "id": "opening_assemble",
        "source": "append_opening",
        "target": "assemble"
      },
      {
        "id": "assemble_export",
        "source": "assemble",
        "target": "export_final"
      },
      {
        "id": "export_output",
        "source": "export_final",
        "target": "output"
      },
      {
        "id": "d-speak-asset_id-tighten-asset_id",
        "source": "speak",
        "target": "tighten",
        "kind": "data",
        "source_output": "asset_id",
        "target_input": "asset_id"
      },
      {
        "id": "d-tighten-asset_id-voice_info-asset_id",
        "source": "tighten",
        "target": "voice_info",
        "kind": "data",
        "source_output": "asset_id",
        "target_input": "asset_id"
      },
      {
        "id": "d-voice_info-duration-plan-target_seconds",
        "source": "voice_info",
        "target": "plan",
        "kind": "data",
        "source_output": "duration",
        "target_input": "target_seconds"
      },
      {
        "id": "d-tighten-asset_id-voice_open-asset_id",
        "source": "tighten",
        "target": "voice_open",
        "kind": "data",
        "source_output": "asset_id",
        "target_input": "asset_id"
      },
      {
        "id": "d-plan-opening_seconds-voice_open-end",
        "source": "plan",
        "target": "voice_open",
        "kind": "data",
        "source_output": "opening_seconds",
        "target_input": "end"
      },
      {
        "id": "d-plan-rounds-segments-items",
        "source": "plan",
        "target": "segments",
        "kind": "data",
        "source_output": "rounds",
        "target_input": "items"
      },
      {
        "id": "d-opening-asset_id-segments-previous_initial",
        "source": "opening",
        "target": "segments",
        "kind": "data",
        "source_output": "asset_id",
        "target_input": "previous_initial"
      },
      {
        "id": "d-video_project-sequence_id-clear_timeline-sequence_id",
        "source": "video_project",
        "target": "clear_timeline",
        "kind": "data",
        "source_output": "sequence_id",
        "target_input": "sequence_id"
      },
      {
        "id": "d-video_project-sequence_id-append_opening-sequence_id",
        "source": "video_project",
        "target": "append_opening",
        "kind": "data",
        "source_output": "sequence_id",
        "target_input": "sequence_id"
      },
      {
        "id": "d-opening-asset_id-append_opening-asset_id",
        "source": "opening",
        "target": "append_opening",
        "kind": "data",
        "source_output": "asset_id",
        "target_input": "asset_id"
      },
      {
        "id": "d-segments-results-assemble-items",
        "source": "segments",
        "target": "assemble",
        "kind": "data",
        "source_output": "results",
        "target_input": "items"
      },
      {
        "id": "d-video_project-sequence_id-export_final-sequence_id",
        "source": "video_project",
        "target": "export_final",
        "kind": "data",
        "source_output": "sequence_id",
        "target_input": "sequence_id"
      }
    ]
  }
}
