aiwatch
by NarihitoM
README.md

# aiwatch
aiwatch is an AI video-watching tool you can plug into any agent's toolset. It uses ffmpeg to read local files and video URLs, extracts frames, and hands them to your agent's own vision model — so no API key or vision setup is needed inside aiwatch. One `npm install aiwatch-mcp-by-narihito` brings the bundled ffmpeg binaries, detects your MCP client, and registers the tools automatically.
## Install
```bash
npm install aiwatch-mcp-by-narihito
```
The postinstall step detects Claude Desktop, Claude Code, Cursor, Windsurf/Devin and VS Code, then writes an `aiwatch` entry to their MCP config. Existing configs are backed up to `.bak`. Set `AIWATCH_SKIP_SETUP=1` (or run in CI) to opt out.
To register manually or re-run setup:
```bash
npx aiwatch-mcp-by-narihito setup --dry-run
npx aiwatch-mcp-by-narihito setup --force
```
Manual MCP config entry:
```json
{
"mcpServers": {
"aiwatch": {
"command": "npx",
"args": ["-y", "aiwatch-mcp-by-narihito", "serve"]
}
}
}
```
VS Code uses `servers` instead of `mcpServers`.
Check the installation:
```bash
npx aiwatch-mcp-by-narihito doctor
```
## MCP tools
| Tool | What it does |
| --- | --- |
| `inspect_video` | Returns duration, resolution, codecs and file size without extracting frames. |
| `watch_video` | Extracts evenly spaced frames (default 8, max 32) from a local file or URL and returns them as inline JPEG images with timestamps. |
| `frame_at` | Returns one frame at an exact timestamp. |
| `save_video` | Saves a local file or URL (including `.m3u8`) as `.mp4`. Copies bytes when the source is already h264/aac in mp4, otherwise transcodes with libx264/aac and `+faststart`. |
| `trim_video` | Trims a local file or URL to a timeframe (`start` plus `duration`) and saves the resulting `.mp4`. |
| `crop_video` | Crops a local file or URL to a region of the frame and saves the resulting `.mp4`. |
| `resize_video` | Resizes a local file or URL to the given dimensions and saves the resulting `.mp4`. |
| `rotate_video` | Rotates a local file or URL by 90, 180 or 270 degrees and saves the resulting `.mp4`. |
| `concat_videos` | Concatenates multiple local videos into one `.mp4`. |
| `extract_audio` | Extracts audio from a local video as mp3 or wav. |
| `burn_subtitles` | Burns subtitles into a local video and saves as mp4. |
| `image_to_video` | Creates an mp4 from a still image (optional audio). |
| `add_text_overlay` | Draws text overlay on a video and saves as mp4. |
| `overlay_image` | Overlays an image onto a video and saves as mp4. |
| `fade_video` | Applies fade in/out to video and audio. |
| `change_speed` | Changes video/audio playback speed. |
| `adjust_video` | Adjusts brightness, contrast, saturation, gamma. |
| `xfade_transition` | Joins two videos with an xfade transition. |
| `add_audio` | Adds or replaces audio track on a video. |
`source` accepts a local path or an `http(s)` URL. Downloads are capped at 200 MB by default and run with a 60 second timeout.
Example prompts to an agent:
- `Use inspect_video on C:\videos\demo.mp4, then watch_video with 12 frames and tell me what happens.`
- `Use frame_at on https://example.com/clip.mp4 at 45 seconds.`
- `Save https://example.com/stream.m3u8 as ./clip.mp4.`
## CLI
```bash
aiwatch serve # MCP stdio server (used by MCP clients)
aiwatch setup # register with detected MCP clients
aiwatch setup --dry-run # show what would change
aiwatch setup --force # replace an existing aiwatch entry
aiwatch doctor # show ffmpeg paths, versions and detected clients
aiwatch help
```
## Programmatic API
```ts
import { probeVideo, extractFrames, getBinaries, saveVideo } from 'aiwatch-mcp-by-narihito'
const binaries = getBinaries()
const info = await probeVideo('./demo.mp4', binaries)
const frames = await extractFrames('./demo.mp4', info, { frames: 8 }, binaries)
```
## ffmpeg binaries
aiwatch uses `ffmpeg-static` and `ffprobe-static` to provide ffmpeg/ffprobe binaries. It falls back to `ffmpeg` and `ffprobe` on `PATH` if the static packages are unavailable.
## Development
```bash
npm install
npm run build
npm test
npm run typecheck
npm run build:binaries -- --only=win32-x64
```
`build:binaries` verifies pinned SHA-256 checksums and writes each platform package into `packages/`. Publishing those packages requires your own npm account.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues