video-studio
by lgmnemesis
README.md
# Video Studio
Highlight editor with a plan card, a QC gate, and tools over MCP or a CLI.
[](LICENSE)
## What it does
Video Studio (M1) rebuilds a highlight from a reference cut and the original clips it came from. It traces shots, locks frame offsets, lays out a plan card, draws Hebrew titles, mixes a ducked music bed, and refuses a bad export at the QC gate.
The package does not call X and does not upload anywhere. A driving agent (or a person at the CLI) fetches posts itself, passes them in, and handles any Drive upload. Export writes a local archive copy and, when asked, returns a `drive_upload_requested` payload for that agent to use.
## Key features
- One highlight template: reference cut, original clips, captions, ducked music, credits
- Frame matching with cached grayscale thumbnails and an optional A/V pull on later parts
- Plan card with draft, edit, approve, and approve-export actions
- Hebrew titles in logical order, drawn with RAQM and the Heebo font
- Two music layouts (`music_from_start` and `drop_aligned`) with ducking only — no stem split
- Pre- and post-render QC that can block an export
- The same tools on a stdio MCP server and on the `studio` CLI
- A Starship highlight eval under `evals/starship/`
## Tech stack
- Python 3.11+ (src layout, setuptools)
- numpy and Pillow
- ffmpeg on `PATH` (required at runtime)
- Optional dev tools: pytest and ruff
- MCP JSON-RPC protocol `2025-06-18` over stdio (newline-delimited)
## Quickstart
**Prerequisites:** Python 3.11 or newer, ffmpeg on `PATH`, and a Heebo font for Hebrew titles (see `STUDIO_HEEBO` below). Do not install `python-bidi`; Hebrew layout uses Pillow's RAQM support.
```bash
python3 -m venv --system-site-packages .venv
.venv/bin/pip install -e ".[dev]"
```
`--system-site-packages` is useful when the host already has a Heebo font or RAQM build. A plain `python3 -m venv .venv` also works if you point `STUDIO_HEEBO` at a Heebo TTF.
### Environment variables
None are required for a local run. Defaults assume a data root of `/workspace/video-studio`. Override them when you install this repo somewhere else.
| Variable | What it is for |
| --- | --- |
| `STUDIO_DATA_ROOT` | Root for default project, archive, and music paths. |
| `STUDIO_PROJECTS` | Directory of project folders (each with a `project.json`). |
| `STUDIO_ARCHIVE` | Local archive copy written by a clean export. |
| `STUDIO_MUSIC` | Music library directory. |
| `STUDIO_HEEBO` | Path to a Heebo variable TTF used for Hebrew titles. |
### Run the MCP server
```bash
.venv/bin/python -m studio.mcp_server
```
The console script `studio-mcp` is the same process. Stdout is protocol only. Logs go to stderr.
Example client config (no credentials):
```json
{
"mcpServers": {
"video-studio": {
"command": "/path/to/video-studio/.venv/bin/python",
"args": ["-m", "studio.mcp_server"],
"cwd": "/path/to/video-studio"
}
}
}
```
`initialize`, `ping`, `tools/list`, and `tools/call` are implemented. `tools/call` arguments are the tool's JSON object. The result is both `structuredContent` and a text JSON blob. `isError` is set when `ok` is false or QC `blocked` is true.
### CLI
```bash
studio <tool> --project <dir> --args '<json>'
studio render-draft --project <dir> [--max-seconds N] [--force]
studio eval starship [--max-seconds N] [--project <dir>]
```
`python -m studio.cli` is the same entry point. Exit status is non-zero when a tool fails or QC blocks. `render-draft` is `export` with `draft: true`.
### Test, lint, and (there is no web build)
```bash
.venv/bin/pytest
.venv/bin/ruff check src tests evals
```
## Project structure
```
src/studio/ Package root
src/studio/mcp_server.py Stdio MCP server
src/studio/cli.py Command-line entry
src/studio/tools/ Tool implementations (sources, trace, plan, edit, deliver)
src/studio/templates/ Highlight template
src/studio/render/ Picture, captions, and audio mix (including levels)
src/studio/paths.py Data-root and font paths
docs/ QC, project schema, and the Starship eval notes
evals/starship/ Highlight rebuild eval
tests/ pytest suite
```
## How it works
Every tool accepts `project` (a directory or a `project.json` path). Listed tools are what `tools/list` returns. `approve`, `apply_edits`, and `approve_export` are unlisted; call them, or use the matching `plan_card` action.
Typical highlight call order:
1. `fetch_source` — reference media (local files, a public https URL, or an `x_post` object the caller already resolved). Downloads are one anonymous GET: https only, no cookies, no auth headers, no login. Credentials in the URL are refused. The tool never loads x.com pages.
2. `probe_quality` — bitrate, fps, overlays, duration; optionally normalize 29.97 to 30 fps.
3. `trace_original` — match candidate clips to the reference (thumbnail NCC).
4. `match_frames` — lock integer offsets (and later, A/V pull on parts that keep original audio).
5. `plan_card` with a template — build segments and the card. Calling it with a template again wipes the pull and resets status to draft, so do not redo this after a refine.
6. `match_frames` again — refine segments.
7. `plan_card` action `approve`, or `edit` / `apply_edits`.
8. `export` with `draft: true`. Pre-QC runs first. This logs `draft_sent`.
9. Optional `qc_report` without another render. See [docs/qc.md](docs/qc.md).
10. `plan_card` action `approve_export` after the draft is accepted (logs `export_approved`, does not render).
11. `export` with `draft: false`. A clean pass copies files into `exports/` and the archive folder, writes credits, and may return `drive_upload_requested`. Nothing is uploaded by this package.
Other tools: `reframe`, `caption_track`, `mix_audio`, `import_clip`, `list_clips`, `trim`, `arrange`, `concat`, `zoom`, `add_text`, `add_audio` (alias `music`).
Audio is ducking only, then two-pass loudnorm to about -14 LUFS with true peak at or under -1 dBTP. Levels live in `src/studio/render/levels.py` and can be overridden on the project's `music` object. There is one music library track in the default layout; no stem split or dialogue isolation.
The operator has two touchpoints: plan approval (`approve` / `edit`) and draft approval (`approve_export` / `edit`). A QC check wants `first_link`, `plan_approved`, and `export_approved`, and `his_minutes` under 15. If those events are missing or marked `simulated`, the reason is reported and the check does not block the render.
Project JSON shape: [docs/project-schema.md](docs/project-schema.md). Starship eval notes and expected media: [docs/eval-starship.md](docs/eval-starship.md). A full rebuild is long (thousands of frames); clip it with `--max-seconds`. Nice the process if you share a machine (`ffmpeg` is already started with `nice -n 10` inside the renderer):
```bash
nice -n 10 studio eval starship --max-seconds 12
```
M1 is the highlight template only (`template` must be `highlight`). Thumbnail cache keys must stay stable; deleting a project's `cache/` forces a full re-decode.
## Contributing
Issues and pull requests are welcome. Run pytest and ruff before you open a PR. Keep credentials out of the tree: this package talks to local files and public https URLs only.
## License
This project is licensed under the MIT License. Copyright (c) 2026 lgmnemesis. See [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues