Skip to content

Record & Edit Demos from Your Coding Agent

Capture 1080p browser demos locally, stream MP4 files straight to Cloudflare R2, edit timelines and HyperFrames VFX via MCP, and open Hitfactor Studio.

Use your coding agent to record live browser demos, upload them directly to Hitfactor storage, and assemble a rough cut through MCP. When the agent finishes, click the returned /edit URL to review and polish the cut in Hitfactor Studio.

Run @hitfactor/cli (Node 20+ or Bun) to configure Hitfactor MCP for OpenCode, Claude Code, Cursor, Codex, or Antigravity, install the hitfactor-demo-capture skill, and open the OAuth 2.1 consent screen in your browser:

Terminal window
npx @hitfactor/cli init

To verify ffmpeg, ffprobe, Chromium, MCP config, and your live OAuth session at any time:

Terminal window
npx @hitfactor/cli doctor

You can also sign in or switch accounts from the terminal with npx @hitfactor/cli login and check your connected balance with npx @hitfactor/cli whoami. No separate HITFACTOR_API_KEY is required when using OAuth 2.1.

Write a JSON or TypeScript demo script to drive the browser deterministically.

Use url to capture one 1920x1080 application viewport. Add pause actions (800 to 1500 ms) after state changes to give viewers reading time and create clean cut points.

{
"title": "Feature walkthrough",
"url": "http://localhost:3000",
"output": { "path": "./tmp-demo.mp4", "width": 1920, "height": 1080, "fps": 30 },
"actions": [
{ "type": "wait", "selector": "main" },
{ "type": "pause", "ms": 800, "reason": "Show initial screen" },
{ "type": "click", "selector": "[data-testid='run-btn']" },
{ "type": "waitForText", "text": "Completed" },
{ "type": "highlight", "selector": "[data-testid='result-panel']", "durationMs": 1200, "label": "Result" },
{ "type": "pause", "ms": 1200 }
]
}

Use split with "mode": "dual-context" to compare two live apps side by side, such as AWS on the left and GCP on the right. Dual-context mode opens two isolated headless Chromium contexts and stitches them with FFmpeg hstack, so pages that send X-Frame-Options: DENY record cleanly.

{
"title": "AWS and GCP failover",
"split": {
"mode": "dual-context",
"left": { "url": "http://localhost:4001", "label": "AWS us-east-1" },
"right": { "url": "http://localhost:4002", "label": "GCP us-central1" },
"dividerWidthPx": 4,
"dividerColor": "#111827"
},
"output": { "path": "./tmp-split-demo.mp4", "width": 1920, "height": 1080, "fps": 30 },
"actions": [
{ "type": "wait", "selector": "#app-ready", "pane": "both" },
{ "type": "click", "selector": "#failover-btn", "pane": "left" },
{ "type": "waitForText", "text": "Serving traffic", "pane": "right" },
{ "type": "highlight", "selector": "#traffic-meter", "pane": "right", "durationMs": 1200, "label": "Active" },
{ "type": "pause", "ms": 1200 }
]
}

Validate the script schema before recording:

Terminal window
npx @hitfactor/cli validate --script ./demo.json

Record and normalize the MP4 file:

Terminal window
npx @hitfactor/cli record --script ./demo.json --out ./tmp-demo.mp4 --fps 30

The recorder normalizes output with FFmpeg to libx264, yuv420p, constant 30 or 60 fps, +faststart, and a silent 48 kHz stereo AAC track when the capture has no audio.

Keep binary video bytes out of MCP JSON payloads. With OAuth 2.1, you do not need a separate HITFACTOR_API_KEY in your shell:

  1. Call editor_list_projects to locate an existing project, or call editor_create_project with a title.
  2. Call editor_open_session with projectId to get sessionId, editVersion, and editUrl.
  3. Call editor_upload_start over MCP with sessionId, role, filename, size, and contentType. Save the returned JSON (containing partSize and presigned partUrls) to a temporary manifest file.
  4. Stream the raw file parts directly from disk to R2 with no API key required:
Terminal window
npx @hitfactor/cli upload-parts \
--file ./tmp-demo.mp4 \
--manifest ./upload-start.json
  1. Pass the returned parts array to MCP editor_upload_complete (or call editor_upload_abort on failure), then poll operation_get until the asset reaches READY.

Choose the role that matches your footage:

RoleUse Case
clipCutaway or B-roll demo footage placed over narration or inserted inline
screenStandalone screen recording as the main timeline track
acamPrimary talking-head A-cam recording
bcamSecondary camera angle
imageStill PNG, JPEG, or WebP frame (0 credits, ready immediately)

For headless CI or shell scripts that already set HITFACTOR_API_KEY, upload --file ./tmp-demo.mp4 --session <sessionId> --role clip runs start, part upload, complete, and operation polling in one command.

After the asset status reaches READY, use MCP tools to edit the timeline.

  1. Call editor_get_timeline with sessionId to read editVersion, durationSeconds, transcript lines, optional pauses, uploaded assets, and current placements.
  2. Call editor_place_asset with sessionId, assetId, startSeconds, and expectedEditVersion:
    • Set mode: "overlay" to show the demo over narration as a cutaway.
    • Set mode: "split" to insert the demo into the main flow.
  3. Call editor_cut with sessionId, editVersion, and silence ranges (fromSeconds to toSeconds) to remove dead air without cutting spoken words.
  4. Call editor_update_placement to move, trim, change retime time-lapse speed, or add look transitions and zoom keyframes on a placement oid.
  5. Call editor_validate_vfx to render and validate a custom HyperFrames HTML callout or title card on the GPU browser validator.
  6. Call editor_add_vfx to save the validated HyperFrames asset (or a HyperFrames catalog entry) and place it on the timeline atomically. Use editor_undo_vfx to revert a VFX edit.

Always pass expectedEditVersion on timeline writes. If a human or another agent updates the timeline first, Hitfactor returns 409 (idempotency_conflict). Read editor_get_timeline again and retry with the new editVersion.

Use editor_inspect_frame before setting zoom keyframes or checking overlays.

  1. Call editor_inspect_frame with sessionId, placement oid (or "acam"), and atSeconds on the display clock.
  2. Read the returned 1600x900 JPEG image. Hitfactor draws a 120 px coordinate grid over the 1920x1080 canvas.
  3. Pick the target (x, y) coordinates from the grid and pass them in look zoom keyframes through editor_update_placement.

Every project, session, upload, and timeline tool returns the canonical editUrl:

https://hitfactorapp.com/<workspace>/videos/<projectId>/edit

Open that link in your browser to scrub the cut in Hitfactor Studio.

  • Open Studio tabs poll for agent changes every 3 seconds and display MCP edits with full Undo support.
  • Reviewers can leave timestamped notes in Studio. Your agent reads them with editor_list_review_notes and responds or resolves threads with editor_reply_review_note.
  • When the cut is final, call editor_export (async, 10 credits) and poll operation_get for the signed 24-hour MP4 downloadUrl.
OperationCost / LimitNotes
Project, session, timeline, placement, cut, frame inspect, review notes0 creditsNo charge for reads or non-GPU edits
Image upload (PNG, JPEG, WebP)0 credits, 25 MiB maxReady immediately on upload complete
Video upload (MP4, WebM, MOV)2 credits / min (min 1), 2 GiB / 30 min max0 credits charged if ingest fails
editor_validate_vfx1 creditStrict GPU browser validation + proof frames
editor_add_vfx5 creditsReuses recent validation; 0 credits on refusal or replay
editor_export10 creditsAsync final MP4 export; 0 credits on failure or cancel
Active organization editor storage25 GiB default capNon-failed assets across the organization