name: localization-dub
version: "2.0"
description: >
  Transcript-first localization pipeline for producing translated subtitles, dubbed audio,
  and optional lip-synced language variants from an existing source video. EP orchestration
  adds quality gates for translation accuracy, timing preservation, and per-locale consistency.
category: custom
stability: beta
default_checkpoint_policy: guided

orchestration:
  mode: executive-producer
  skill: pipelines/localization-dub/executive-producer
  budget_default_usd: 3.00
  max_revisions_per_stage: 3
  max_send_backs: 3
  max_wall_time_minutes: 15

required_skills:
  - pipelines/localization-dub/executive-producer
  - pipelines/localization-dub/idea-director
  - pipelines/localization-dub/script-director
  - pipelines/localization-dub/scene-director
  - pipelines/localization-dub/asset-director
  - pipelines/localization-dub/edit-director
  - pipelines/localization-dub/compose-director
  - pipelines/localization-dub/publish-director
  - meta/reviewer
  - meta/checkpoint-protocol

compatible_playbooks:
  - clean-professional
  - flat-motion-graphics

stages:
  - name: idea
    skill: pipelines/localization-dub/idea-director
    produces:
      - brief
    tools_available: []
    checkpoint_required: true
    human_approval_default: true
    review_focus:
      - Source language and target languages are explicit
      - Deliverable mode is clear per language
      - Review and glossary requirements are captured
    success_criteria:
      - Schema-valid brief artifact
      - Brief records localization scope and dub mode

  - name: script
    skill: pipelines/localization-dub/script-director
    required_artifacts_in:
      - brief
    produces:
      - script
    required_tools:
      - transcriber
    tools_available:
      - transcriber
    checkpoint_required: true
    human_approval_default: true
    review_focus:
      - Transcript truth is strong enough for downstream localization
      - Glossary and protected terms are preserved
      - Target-language script package is reviewable before synthesis
    success_criteria:
      - Schema-valid script artifact
      - Script contains source transcript structure and translated sections

  - name: scene_plan
    skill: pipelines/localization-dub/scene-director
    required_artifacts_in:
      - script
    optional_artifacts_in:
      - brief
    produces:
      - scene_plan
    optional_tools:
      - frame_sampler
      - scene_detect
    tools_available:
      - frame_sampler
      - scene_detect
    checkpoint_required: true
    human_approval_default: true
    review_focus:
      - Dub mode is chosen realistically for each deliverable
      - Timing drift and on-screen text risks are mapped
      - Lip-sync use is limited to shots that can support it
    success_criteria:
      - Schema-valid scene_plan artifact
      - Every deliverable has a defined localization treatment

  - name: assets
    skill: pipelines/localization-dub/asset-director
    required_artifacts_in:
      - scene_plan
      - script
    optional_artifacts_in:
      - brief
    produces:
      - asset_manifest
    required_tools:
      - tts_selector
      - subtitle_gen
    optional_tools:
      - lip_sync
      - audio_enhance
    tools_available:
      - tts_selector
      - subtitle_gen
      - lip_sync
      - audio_enhance
    checkpoint_required: true
    human_approval_default: false
    review_focus:
      - Subtitle and dubbed-audio assets exist for each language
      - Timing and pronunciation risks are recorded
      - Lip-sync remains optional and clearly marked
    success_criteria:
      - Schema-valid asset_manifest artifact
      - All referenced asset files exist on disk

  - name: edit
    skill: pipelines/localization-dub/edit-director
    required_artifacts_in:
      - scene_plan
      - asset_manifest
    optional_artifacts_in:
      - script
    produces:
      - edit_decisions
    tools_available: []
    checkpoint_required: true
    human_approval_default: false
    review_focus:
      - Source structure is preserved unless localization timing forces change
      - CTA and legal copy survive translation cleanly
      - Language variants are organized consistently
    success_criteria:
      - Schema-valid edit_decisions artifact
      - Edit decisions cover all planned language outputs

  - name: compose
    skill: pipelines/localization-dub/compose-director
    required_artifacts_in:
      - edit_decisions
      - asset_manifest
    optional_artifacts_in:
      - scene_plan
    produces:
      - render_report
    required_tools:
      - video_compose
      - audio_mixer
    optional_tools:
      - video_trimmer
      - audio_enhance
    tools_available:
      - video_compose
      - audio_mixer
      - video_trimmer
      - audio_enhance
    checkpoint_required: true
    human_approval_default: false
    review_focus:
      - Each language output is intelligible and correctly timed
      - Subtitle and dub timing match the chosen treatment
      - Version labeling is unambiguous
    success_criteria:
      - Schema-valid render_report artifact
      - Output file exists and passes ffprobe validation

  - name: publish
    skill: pipelines/localization-dub/publish-director
    required_artifacts_in:
      - render_report
    optional_artifacts_in:
      - brief
      - script
    produces:
      - publish_log
    tools_available: []
    checkpoint_required: true
    human_approval_default: true
    review_focus:
      - Every language package contains the right assets and metadata
      - Locale labels and titles are consistent
      - Review notes remain attached to the published package
    success_criteria:
      - Schema-valid publish_log artifact
      - Export package contains localized video and metadata outputs

