Skip to main content
Glama
README.md
<p align="center">
  <img src="assets/icon.png" width="160" alt="Playhead icon: a scowling eye with a play button for a pupil">
</p>

<h1 align="center">Playhead</h1>

<p align="center"><b>Let your AI press play.</b></p>

Playhead is an [MCP](https://modelcontextprotocol.io) server that lets Claude, Codex and other AI agents watch local video files a stretch at a time: what changed on screen, what was said, and when it got loud.

## Why

Most coding agents can't open a video. The usual workaround is to dump a pile of frames to disk first and read through them, which is slow, expensive and loses the sense of time.

Playhead gives the agent a player instead:

- **No pre-cutting.** The file is decoded on demand from the playhead. Nothing is extracted to disk.
- **Changes, not footage.** Up to 10 samples a second are compared, and only moments where the picture changed are shown. A screen that hasn't moved costs no image at all.
- **One image per call.** The picked moments arrive as a single timestamped filmstrip.
- **Sound in sync.** Speech is transcribed on your machine with Whisper, only as far as playback has reached. Loud moments are flagged.
- **Rewind and zoom.** The agent can skim the whole file, jump anywhere, or freeze a frame and zoom in to read small text.

> **What it is, honestly:** the model does not receive a video stream. As of November 2026 the Claude API takes no video input and MCP has no video content type, so Playhead sends still images and text. Very brief events (shorter than the 0.1 to 0.4 s between samples) can be missed.

## What the agent sees

```text
> watch(video_id="v3f9a1c2", seconds=8)

PLAYED 0:08.0 -> 0:16.0 of 0:24.0 | picture: moving
Filmstrip: 9 moment(s) picked from 81 checked, left to right then top to bottom.
Loud moments: 0:12.0, 0:13.0, 0:14.7
Speech (en, machine transcript):
  [0:11.8] The secret password is pineapple.
  [0:14.8] I repeat, pineapple.
Playhead now 0:16.0 (16.0s). Call watch again to keep playing.
```

Plus the filmstrip image for those eight seconds.

## Install

You need [uv](https://docs.astral.sh/uv/). The first launch downloads the dependencies, and the first transcription downloads a Whisper model (about 150 MB for `base`).

**Claude Code**

```bash
claude mcp add playhead -- uvx --from "playhead-mcp[speech] @ git+https://github.com/isaiahagi/playhead-mcp" playhead-mcp
```

**Codex** (`~/.codex/config.toml`)

```toml
[mcp_servers.playhead]
command = "uvx"
args = ["--from", "playhead-mcp[speech] @ git+https://github.com/isaiahagi/playhead-mcp", "playhead-mcp"]
startup_timeout_sec = 180
tool_timeout_sec = 300
```

**Claude Desktop, Cursor and other MCP clients**

```json
{
  "mcpServers": {
    "playhead": {
      "command": "uvx",
      "args": ["--from", "playhead-mcp[speech] @ git+https://github.com/isaiahagi/playhead-mcp", "playhead-mcp"]
    }
  }
}
```

Remove `[speech]` for a smaller, picture-only install.

Then just ask:

> Watch `C:\clips\bug.mp4` and tell me the exact moment the menu glitches.

## Tools

| Tool | What it does |
| --- | --- |
| `open_video(path)` | Loads a file and returns a `video_id`, length and size. |
| `watch(video_id, seconds=10, start?, detail?)` | Plays the next stretch (up to 60 s): filmstrip, speech, loud moments. `detail` is `low`, `normal` or `high` (up to 4, 9 or 16 moments). |
| `look(video_id, time, region?)` | One moment at high resolution. `region` is `[x, y, width, height]` as fractions, for zooming. |
| `skim(video_id, start?, end?, frames?)` | Evenly spaced glances to find the part worth watching. |

Formats: `mp4`, `m4v`, `mov`, `mkv`, `webm`, `avi`.

## Settings

All optional environment variables.

| Variable | Default | Purpose |
| --- | --- | --- |
| `PLAYHEAD_WHISPER_MODEL` | `base` | Any [faster-whisper](https://github.com/SYSTRAN/faster-whisper) model, for example `small` or `base.en`. |
| `PLAYHEAD_WHISPER_DEVICE` | `cpu` | `cuda` to use an NVIDIA GPU. |
| `PLAYHEAD_WHISPER_COMPUTE` | `int8` | CTranslate2 compute type. |
| `PLAYHEAD_SPEECH` | `1` | `0` turns transcription off. |
| `PLAYHEAD_ROOTS` | unset | Folders the server may read, separated by `;` on Windows and `:` elsewhere. |

## Tested

Measured on Windows 11 with a Ryzen 7 5700G, CPU only, `base.en` speech model (November 2026).

**67 real videos** (phone clips, screen recordings and VR gameplay; H.264, HEVC and VP9; 33 of them portrait):

| | |
| --- | --- |
| Played start to finish | 67 of 67, no errors |
| Footage | 31.3 minutes, processed in 4.9 minutes (6.3x real time) |
| `watch` calls | 221, slowest 6.8 s |
| Image cost | about 1,500 tokens per `watch` call at default settings (estimated as width x height / 750) |
| Picture accuracy | the middle frame of every video matched FFmpeg's (mean pixel difference at most 3 of 255) |

**Can an agent actually use it?** A generated 24 s quiz video hid a code on screen for 1.5 s, spoke a password, recoloured a ball twice and added small text near the end. With Playhead as the only way to see the file, Claude Code (Sonnet) and Codex CLI each answered all four questions correctly. That is one run each on one easy synthetic video, a smoke test rather than a benchmark.

The automated tests cover decoding, seeking, rotation, change detection, speech syncing, hostile paths and a full MCP session over stdio.

## Privacy and safety

- Decoding and transcription run on your machine. The filmstrips and transcript are then sent to **whatever model your client uses**, so treat watching a video like pasting it into that chat.
- Without `PLAYHEAD_ROOTS`, the server can open any supported video your user account can read.
- URLs and network paths are rejected, and the demuxer is fixed by file extension, so a playlist renamed to `.mp4` can't make it fetch other files.
- Text and speech inside a video are untrusted input. Playhead labels them as such, but a video can still try to talk your agent into things.

## Limitations

- Fast action is sampled. Use a shorter `seconds` or `detail="high"` when timing matters.
- Loud moments are volume peaks, not sound recognition. The agent does not hear music or tone of voice.
- The audio track is held in memory (about 230 MB per hour of video).
- Recordings still being written usually can't be opened yet.
- On Windows, installing into a very deeply nested folder can break the speech libraries ("filename or extension is too long"). `uvx` avoids this.

## Development

```bash
uv venv
uv pip install -e ".[speech,dev]"
uv run pytest
```

The tests generate their own videos, so the repo holds no media. To try it on a folder of your own files (the report contains frames and transcripts, so keep it private):

```bash
uv run python scripts/batch_check.py path/to/videos --out reports
```

Rebuild the icon after editing `assets/icon.svg`:

```bash
uv run --with resvg-py python scripts/render_icon.py
```

## License

[MIT](LICENSE)

TDQS

A3.7/5.0

Scored across 4 tools

Disambiguation4/5

Each tool occupies a distinct mode of inspection: open_video initializes, watch consumes a forward stretch with audio, look captures a single high-res frame while holding the playhead, and skim provides a picture-only overview for locating content. watch/look/skim are superficially similar verbs, but the descriptions make the temporal semantics (sequential vs. frozen vs. scanning) clear enough to choose correctly.

Naming Consistency4/5

All names are short imperative verbs in lowercase snake_case, which is consistent and readable. The only minor deviation is that open_video uses a verb_noun compound while watch/look/skim are bare verbs, but the convention is still clearly unified.

Tool Count5/5

Four tools is well-scoped for a video-inspection server: load, sequential consume, single-frame capture, and overview scanning are the core operations, and each tool earns its place with no redundancy. Nothing feels bloated or arbitrarily split.

Completeness4/5

The surface covers the main lifecycle of inspecting a video: open, scan for a region, watch sequentially, and freeze a frame. Minor gaps exist, such as retrieving video metadata/duration and watching a specific range with audio (skim is picture-only, and watch only advances forward), but agents can work around these.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues