Repository avatar
Multimedia
v0.1.2
active

shotnode-studio

io.github.naveen6768/shotnode-studio

Local video creation with ShotNode CLI and MCP tools.

Documentation

ShotNode Studio

ShotNode Studio

Agent-first video framework — describe a video, get a deterministic MP4 you can still edit.

ShotNode Studio is the desktop/agent companion to the ShotNode mobile editor. An AI agent builds the video as a declarative ShotNode project (plain JSON), ShotNode Studio validates it, previews it frame-exactly, and renders it to MP4 deterministically — same project, same assets, same output, every time. No cloud, no per-render fees, no account.

agent writes project.json  →  shotnode check  →  preview frames  →  (you approve)  →  shotnode render

Why it looks like this

PrincipleWhat it means here
DeterministicEvery input is seeked/trimmed explicitly; -bitexact; fixed encoder presets. Randomness and wall-clock sources are forbidden by the validator.
Editable by humans and agentsThe project is plain JSON with stable ids. Agents edit through a validated JSON Patch protocol — a bad patch is refused atomically, the file never corrupts.
Human approval loopcheck → preview PNGs → you look → only then render. Preview and render never skip the gate.
Local-firstEverything runs on your machine with Node 22+ and FFmpeg. Nothing is uploaded, nothing phones home.
Mobile twinThe patch protocol mirrors the ShotNode mobile editor's timeline patch applier, so agent-authored projects translate to the app world model.

Quickstart

# prerequisites: Node 22+, FFmpeg on PATH (any build; drawtext/freetype NOT required)
npm install -g shotnode-studio
bash "$(npm root -g)/shotnode-studio/tools/setup_text_tool.sh"  # one-time text renderer setup
shotnode doctor                    # verify the environment

bash examples/demo/make_demo.sh    # builds + renders the demo project (fully synthetic media)
shotnode inspect demo
open ~/ShotNodeProjects/demo/renders/demo-good.mp4

node examples/mcp_motion_graphics.mjs   # full motion-graphics teaser produced THROUGH the MCP tools end to end

The CLI and local MCP server are also available from the public npm registry.

CLI

JobCommands
Startinit <name> --width 1080 --height 1920 (vertical), add-asset <project> <file>
Readinspect <project>, projects, check <project> --json
Editapply <project> <patch.json> (JSON Patch, validated atomically)
Lookpreview <project> --at 1.0,3.5 → PNGs in frames/
Shiprender <project> --quality draft|good|delivery → MP4 in renders/, ffprobe-verified summary
Operatedoctor, version, mcp (MCP server on stdio)

Failure contract: every failure prints ✗ <what> and a Fix: <how> hint, exits non-zero (2 = validation, 1 = runtime). All commands accept --json.

MCP server (ZCode / Claude / Codex / Cursor / Grok / any MCP client)

shotnode mcp    # newline-delimited JSON-RPC 2.0 over stdio (also: node bin/shotnode.js mcp)

Registration snippets for every client (Claude Desktop, Codex, Cursor, ZCode, and the generic stdio pattern for others): docs/MCP_CLIENTS.md.

Desktop app

npm run app launches ShotNode Studio Desktop — a two-engine shell:

  • Home (paper/night chrome, accent packs) — start cards for new projects and a card grid of every project under ~/ShotNodeProjects, with kind chips, meta, and the generation prompt (topic) for JSON-engine projects. Delete/reveal per card; handover via open -b pro.shotnode.studio <dir>.
  • Studio compositions — new composition projects are HTML compositions opened in the embedded Studio editor (visual timeline, live preview, code editor, catalog, renders) served by a local studio server the app owns; the window loads it directly. First render downloads a managed Chrome for Rendering into ~/.cache (deterministic capture + ffmpeg encode).
  • Legacy JSON projects — open in the built-in editor (sidebar, three-lane timeline, one-pass filmstrip, inspector, check/assets tabs, Render MP4 with live progress). Same engine as the CLI and MCP server — literally the same modules (src/*), mutations through the same validated tool implementations, so desktop, agent and CLI edits are one document and one render.
  • Settings — appearance (paper/night/system + green/sunset/ocean/mono accents), engine doctor (ffmpeg, ffprobe, text tool, render browser), agent/MCP guide, about.

Shell patterns (bootstrap guards, <domain>:<action bridge, refusal envelope, theme boot, single instance) follow the harvested desktop blueprint in ../KwaiCut_Editor_Harvest/captures/hyperframes_desktop/. Embedded editor attribution: see NOTICE (Apache-2.0 upstream stack, pinned 0.9.75).

npm run app                 # run the desktop app from source
npx electron . --screenshot out.png [--shot-view settings] [--shot-chrome paper] [--project name] [--shot-legacy]
npx electron-builder --dir  # build the unpacked macOS .app into dist/ (npm run dist:dir)

12 tools: shotnode_create_project, shotnode_list_projects, shotnode_get_project, shotnode_add_asset, shotnode_apply_patch, shotnode_add_clip, shotnode_add_text, shotnode_check_project, shotnode_preview_frame, shotnode_render_project, shotnode_inspect_project, shotnode_probe_media.

Agent registration (ZCode / Claude / Codex / Cursor / others): docs/MCP_CLIENTS.md. ZCode-specific setup: docs/ZCODE_MCP_SETUP.md. Full protocol notes: docs/MCP.md.

Project format

A ShotNode project is a directory:

<project>/
├── project.json     # the timeline document (the only source of truth)
├── assets/          # media copied in via add-asset
├── renders/         # MP4 outputs
└── frames/          # preview PNGs + text cache

project.json (v1) — one visual track (contiguous video/image chain joined by transitions), N overlay tracks (text/image with enable windows and alpha fades), N audio tracks:

{
  "format": "shotnode-project",
  "formatVersion": 1,
  "name": "launch_teaser",
  "resolution": { "width": 1920, "height": 1080 },
  "fps": 30,
  "background": "#000000",
  "tracks": [
    { "id": "t_visual", "kind": "visual", "clips": [
      { "id": "c_a", "type": "video", "src": "assets/a.mp4", "start": 0, "duration": 4,
        "transitionOut": { "type": "fadeblack", "duration": 0.5 } },
      { "id": "c_b", "type": "video", "src": "assets/b.mp4", "start": 3.5, "duration": 3 }
    ]},
    { "id": "t_overlay", "kind": "overlay", "clips": [
      { "id": "c_title", "type": "text", "text": "ShotNode", "start": 0.3, "duration": 2,
        "style": { "position": "center", "fontSize": 140, "fadeIn": 0.4, "fadeOut": 0.5 } }
    ]},
    { "id": "t_audio", "kind": "audio", "clips": [
      { "id": "c_music", "type": "audio", "src": "assets/music.m4a", "start": 0, "duration": 6.5,
        "volume": 0.35, "fadeOut": 1.2 }
    ]}
  ]
}

Transitions consume overlap: with a 0.5s transitionOut, the next visual clip starts at prev.start + prev.duration - 0.5. Full schema, styles and the 27-transition catalog: docs/PROJECT_FORMAT.md.

Agent skills

Shipped in .agents/skills/ — the same skill structure the ShotNode agents use everywhere: /shotnode (orchestrator + work loop + determinism contract), /shotnode-cli, /shotnode-registry (transitions, text presets, recipes), /shotnode-mcp.

Tests

bash test/e2e.sh          # CLI end-to-end: synthetic assets → patch → check → preview → render → ffprobe
node test/mcp_smoke.mjs   # MCP: handshake → tools → create/patch/check/preview/render

Layout

bin/shotnode.js        CLI entry
src/cli.js             command dispatcher (failure contract, --json)
src/project.js         project model, registry, assets
src/patch.js           RFC 6901 JSON Patch subset (the agent edit protocol)
src/validate.js        the `check` gate (schema, contiguity, transitions, assets)
src/render.js          deterministic FFmpeg filtergraph compiler
src/text.js            text → PNG (Pillow) bridge
src/mcp.js             local MCP server (12 tools)
tools/                 setup_text_tool.sh, text_to_png.py
branding/              logo (SVG + PNG)
docs/                  format, MCP, ZCode setup

Documentation

Full documentation lives in docs/ — start at the documentation index (agent-facing machine index: docs/llms.txt):

License

Apache-2.0 — see LICENSE and NOTICE.

NPM
shotnode-studio
Install Command
npm install shotnode-studio