Skip to main content

MCP tool for adding transition directives (fade, dissolve, fadeblack, fadewhite) to an OTIO timeline for realisation by clipwright-render.

Project description

clipwright-transition

MCP tool that adds transition directives (fade, dissolve, fadeblack, fadewhite) to an OTIO timeline for realisation by clipwright-render.

Overview

clipwright-transition accepts an OTIO timeline (typically produced by clipwright-sequence) and annotates it with transition directives at clip boundaries. The directives are stored in metadata["clipwright"]["transition"] and consumed by clipwright-render, which materialises them as xfade/acrossfade filter chains during the final encoding pass.

Design principle (separation of annotation and realisation): clipwright-transition writes only the OTIO directive; it does not transcode or touch media files. All media processing is deferred to clipwright-render.

No FFmpeg or FFprobe is needed at transition-annotation time.

Prerequisites

  • Python 3.11 or later
  • clipwright core package (shared types, envelope, OTIO utils)
  • An OTIO timeline with two or more video clips on a single V1 track (e.g. produced by clipwright-sequence)

MCP Tool: clipwright_add_transition

Parameters

Name Type Default Description
timeline string required Path to the input OTIO timeline file (.otio extension required).
output string required Output OTIO timeline file path (.otio extension required, must differ from timeline). The parent directory must exist.
options AddTransitionOptions required Transition mode: either uniform (apply the same transition to all internal boundaries) or per_boundary (specify per-boundary transitions). Exactly one must be provided.
options.uniform TransitionSpec | null null Apply a single transition spec to every internal clip boundary.
options.uniform.type string required Transition type: "fade", "dissolve", "fadeblack", or "fadewhite".
options.uniform.duration_sec float required Transition duration in seconds (0 < duration ≤ 5.0).
options.per_boundary list[BoundaryTransition] | null null Per-boundary transition list (max 1000 entries). All internal boundaries must be covered (no partial/gapped specification in v1).
options.per_boundary[].after_clip_index int required Zero-based index of the clip before the boundary (≥ 0).
options.per_boundary[].type string required Transition type (same allowlist as uniform.type).
options.per_boundary[].duration_sec float required Transition duration in seconds (same constraint as uniform.duration_sec).

Return value

{
  "ok": true,
  "summary": "Applied dissolve transition (0.5s) to 2 boundary(ies) [uniform mode]. Generated output.otio. Pass it to clipwright-render to materialise the transitions.",
  "data": {
    "boundary_count": 2,
    "mode": "uniform"
  },
  "artifacts": [{"role": "timeline", "path": "output.otio", "format": "otio"}],
  "warnings": []
}

Error codes

Code Cause
INVALID_INPUT output has a non-.otio extension
INVALID_INPUT output parent directory does not exist
INVALID_INPUT output resolves to the same path as timeline
INVALID_INPUT The timeline has fewer than two video clips
INVALID_INPUT The timeline has no video track or two or more video tracks
INVALID_INPUT The timeline already contains an OTIO Transition object
INVALID_INPUT A per_boundary index is out of range [0, n_clips-2]
INVALID_INPUT per_boundary contains duplicate after_clip_index values
UNSUPPORTED_OPERATION per_boundary does not cover all internal boundaries (partial/gapped specification is unsupported in v1; use uniform or specify all n_clips-1 boundaries)
FILE_NOT_FOUND The timeline path does not exist

Three-Phase Workflow

clipwright_build_sequence(clips, output)          # Phase 1 — build multi-clip OTIO
        │
        ▼  OTIO timeline with ordered V1 clips
clipwright_add_transition(timeline, output, opts)  # Phase 2 — annotate transitions
        │
        ▼  OTIO timeline with transition directives
clipwright_render(timeline, output_media)          # Phase 3 — encode with transitions
        │
        ▼  single output video with crossfades

MCP Client Registration

Register clipwright-transition as a standalone MCP server in your client configuration (.mcp.json / claude_desktop_config.json). No environment variables are required at annotation time.

{
  "mcpServers": {
    "clipwright-transition": {
      "command": "clipwright-transition"
    }
  }
}

clipwright-render (which materialises the transitions into a video) requires CLIPWRIGHT_FFMPEG.

Usage Examples

Apply a uniform dissolve between all clips

# Via MCP call_tool
result = await session.call_tool("clipwright_add_transition", {
    "timeline": "/project/sequence.otio",
    "output": "/project/with_transitions.otio",
    "options": {
        "uniform": {"type": "dissolve", "duration_sec": 0.5}
    }
})
# Then render
render_result = await session.call_tool("clipwright_render", {
    "timeline": "/project/with_transitions.otio",
    "output": "/project/final.mp4"
})

Apply per-boundary transitions

result = await session.call_tool("clipwright_add_transition", {
    "timeline": "/project/sequence.otio",
    "output": "/project/with_transitions.otio",
    "options": {
        "per_boundary": [
            {"after_clip_index": 0, "type": "fade", "duration_sec": 1.0},
            {"after_clip_index": 1, "type": "fadeblack", "duration_sec": 0.5}
        ]
    }
})

Note: All internal boundaries must be covered in v1. For a 3-clip timeline (after_clip_index values 0 and 1 are the two internal boundaries), both must be specified. Partial/gapped specification will return UNSUPPORTED_OPERATION.

Non-Destructive Guarantee

clipwright-transition never modifies the input timeline file. It always writes a new OTIO file to output. Existing metadata["clipwright"] keys (from other tools) are preserved; only the "transition" key is added.

Installation

Within a uv workspace:

uv run --package clipwright-transition clipwright-transition

Or install from PyPI:

pip install clipwright-transition
clipwright-transition

License

MIT — See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clipwright_transition-0.2.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clipwright_transition-0.2.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file clipwright_transition-0.2.0.tar.gz.

File metadata

  • Download URL: clipwright_transition-0.2.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for clipwright_transition-0.2.0.tar.gz
Algorithm Hash digest
SHA256 057edfe4d7a597ec7431a22d9f3f40772a523ab3a90f10a135b09c67449e7780
MD5 fba69dac967f438dc9e0fff3e6b8a3ab
BLAKE2b-256 529f767a6bdefb14d84c225b33d0031d5206d1e77e7653ecd5935ef8bd7c2d2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipwright_transition-0.2.0.tar.gz:

Publisher: publish.yml on satoh-y-0323/clipwright

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clipwright_transition-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for clipwright_transition-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5929690d5874967376682fd0ea1f021e9c2e4aa125f65cf15bffeb7aee87a57a
MD5 3f3ccc060b9ae50ca079ec95ef0a8999
BLAKE2b-256 754c96f25a051ad3832e75bae74e3446ae5d3d0b5a925e30c37d90254487ffe3

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipwright_transition-0.2.0-py3-none-any.whl:

Publisher: publish.yml on satoh-y-0323/clipwright

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page