Skip to main content

clipwright-color

MCP tool for video brightness detection and OTIO timeline color annotation generation.

Overview

Measures average luma using the ffmpeg signalstats filter, writes a color correction directive (brightness offset, eq parameters) to timeline-level metadata["clipwright"]["color"].

Performs detection only (OTIO annotation); realization (eq filter application) is done once by clipwright-render (design M3: separation of detection and application).

Brightness derivation:

  • Samples frames at a configurable interval using fps=1/<interval> and signalstats=stat=brng.
  • Computes mean luma (YAVG) across sampled frames.
  • Derives brightness offset as clamp((target_luma - YAVG) / 255.0, -1.0, 1.0).
  • Contrast, saturation, and gamma are left at neutral defaults (1.0 / 1.0 / 1.0); only brightness is auto-derived from the measured luma.

Prerequisites

  • Python 3.11 or later
  • ffmpeg must exist on PATH or full path set in environment variable CLIPWRIGHT_FFMPEG.
export CLIPWRIGHT_FFMPEG=/path/to/ffmpeg
export CLIPWRIGHT_FFPROBE=/path/to/ffprobe

MCP Tool

clipwright_detect_color

Parameters

Name Type Default Description
media string required Input video file path (video stream required)
output string required Output OTIO timeline path (.otio, same directory as media)
options.target_luma float 128.0 Target average luma on the 0-255 scale (default: mid-grey)
options.sample_interval_sec float 1.0 Frame sampling interval in seconds (ffmpeg fps=1/interval, must be > 0)
timeline string | null null Existing OTIO timeline path (if specified, append color directive to it)

Return value

The tool returns a ToolResult envelope:

{
  "ok": true,
  "summary": "Color analysis complete. measured_luma=96.4 ...",
  "data": {
    "measured_luma": 96.4,
    "brightness": 0.123,
    "contrast": 1.0,
    "saturation": 1.0,
    "gamma": 1.0,
    "target_luma": 128.0,
    "sampled_frames": 12
  },
  "artifacts": [{"role": "timeline", "path": "out.otio", "format": "otio"}],
  "warnings": []
}

When measurement is not possible (measured=None, U-1), the color directive is not written but the timeline is still saved and a warning is returned.

Dependencies

Package Purpose
clipwright Shared types, envelope, errors, process.run
mcp[cli] MCP server
pydantic Parameter validation

ffmpeg is invoked as a separate process (via PATH or environment variable) for license independence.

Detection and Render Two-Phase Flow

  1. detect (this tool): ffmpeg -i <media> -vf "fps=1/1,signalstats=stat=brng,metadata=print" -f null - extracts per-frame YAVG and saves the derived eq directive to OTIO annotation.
  2. render (clipwright-render): reads metadata["clipwright"]["color"]["eq"] and applies eq=brightness=...:contrast=...:saturation=...:gamma=... in the ffmpeg filter graph.

Installation and Startup

Within a uv workspace:

uv run --package clipwright-color clipwright-color

Or install directly:

uv add clipwright-color
clipwright-color

Download files

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

Source Distribution

clipwright_color-0.3.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

clipwright_color-0.3.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file clipwright_color-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for clipwright_color-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f94038eceab917d1f2e31434b9981cc58dd876e2ba1ab674298f2523878d9ee4
MD5 535662a2174b44262a3ae4a584330841
BLAKE2b-256 c7980bf3ac9a1cf4a22b82ae39a006a4ec48ee6a44e019fae93e03ea9f5e9849

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipwright_color-0.3.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_color-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for clipwright_color-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba0fb607a6539b838e4ce62dcd4701ac019e7ab5bfb4718a75e622e179ecdc54
MD5 ac718aa8df79cabf23b14f2ef336e77a
BLAKE2b-256 d3e53b8131c764069fb0020531da01627896f5e5f06fcc62d071a156e0b8e92d

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipwright_color-0.3.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