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>andsignalstats=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
- 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. - render (clipwright-render): reads
metadata["clipwright"]["color"]["eq"]and applieseq=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
Metadata
Release files for clipwright-color 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clipwright_color-0.4.1.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clipwright_color-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.8 kB
Release files / clipwright_color-0.4.1.tar.gz
| Download URL | clipwright_color-0.4.1.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a195bd3554551924da9375acaef0753059bdee71f4df60a8ef0e9f49b5195a9
|
|
BLAKE2b-256 checksum How to use checksums |
5714640197d8a0c56375194afd2d5c2078806e6804bc19567337edc602b5dae0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.
Transparency logRelease files / clipwright_color-0.4.1-py3-none-any.whl
| Download URL | clipwright_color-0.4.1-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83043e7a289782e4d4becf1c246b9c20d234e36ad2194e131f1209d2e9742f79
|
|
BLAKE2b-256 checksum How to use checksums |
16d3bad5e6212dbf7099d65a8c5806e4b219be6c825c30b2248d165c458cce94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.
Transparency log