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.
Quick Setup (One Command)
Section titled “Quick Setup (One Command)”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:
npx @hitfactor/cli initTo verify ffmpeg, ffprobe, Chromium, MCP config, and your live OAuth session at any time:
npx @hitfactor/cli doctorYou 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.
Record Single or Side-by-Side Demos
Section titled “Record Single or Side-by-Side Demos”Write a JSON or TypeScript demo script to drive the browser deterministically.
Single Viewport Recording
Section titled “Single Viewport Recording”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 } ]}Side-by-Side Split-Screen Recording
Section titled “Side-by-Side Split-Screen Recording”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 and Record
Section titled “Validate and Record”Validate the script schema before recording:
npx @hitfactor/cli validate --script ./demo.jsonRecord and normalize the MP4 file:
npx @hitfactor/cli record --script ./demo.json --out ./tmp-demo.mp4 --fps 30The 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.
Stream MP4s Direct to Cloudflare R2
Section titled “Stream MP4s Direct to Cloudflare R2”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:
- Call
editor_list_projectsto locate an existing project, or calleditor_create_projectwith a title. - Call
editor_open_sessionwithprojectIdto getsessionId,editVersion, andeditUrl. - Call
editor_upload_startover MCP withsessionId,role,filename,size, andcontentType. Save the returned JSON (containingpartSizeand presignedpartUrls) to a temporary manifest file. - Stream the raw file parts directly from disk to R2 with no API key required:
npx @hitfactor/cli upload-parts \ --file ./tmp-demo.mp4 \ --manifest ./upload-start.json- Pass the returned
partsarray to MCPeditor_upload_complete(or calleditor_upload_aborton failure), then polloperation_getuntil the asset reachesREADY.
Choose the role that matches your footage:
| Role | Use Case |
|---|---|
clip | Cutaway or B-roll demo footage placed over narration or inserted inline |
screen | Standalone screen recording as the main timeline track |
acam | Primary talking-head A-cam recording |
bcam | Secondary camera angle |
image | Still 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.
Assemble, Trim, Zoom, and Add VFX via MCP
Section titled “Assemble, Trim, Zoom, and Add VFX via MCP”After the asset status reaches READY, use MCP tools to edit the timeline.
- Call
editor_get_timelinewithsessionIdto readeditVersion,durationSeconds, transcriptlines, optionalpauses, uploadedassets, and currentplacements. - Call
editor_place_assetwithsessionId,assetId,startSeconds, andexpectedEditVersion:- Set
mode: "overlay"to show the demo over narration as a cutaway. - Set
mode: "split"to insert the demo into the main flow.
- Set
- Call
editor_cutwithsessionId,editVersion, and silence ranges (fromSecondstotoSeconds) to remove dead air without cutting spoken words. - Call
editor_update_placementto move, trim, changeretimetime-lapse speed, or addlooktransitions and zoom keyframes on a placementoid. - Call
editor_validate_vfxto render and validate a custom HyperFrames HTML callout or title card on the GPU browser validator. - Call
editor_add_vfxto save the validated HyperFrames asset (or a HyperFrames catalog entry) and place it on the timeline atomically. Useeditor_undo_vfxto 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.
Inspect Rendered Frames
Section titled “Inspect Rendered Frames”Use editor_inspect_frame before setting zoom keyframes or checking overlays.
- Call
editor_inspect_framewithsessionId, placementoid(or"acam"), andatSecondson the display clock. - Read the returned
1600x900JPEG image. Hitfactor draws a120 pxcoordinate grid over the1920x1080canvas. - Pick the target
(x, y)coordinates from the grid and pass them inlookzoom keyframes througheditor_update_placement.
Review in Hitfactor Studio and Export
Section titled “Review in Hitfactor Studio and Export”Every project, session, upload, and timeline tool returns the canonical editUrl:
https://hitfactorapp.com/<workspace>/videos/<projectId>/editOpen 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_notesand responds or resolves threads witheditor_reply_review_note. - When the cut is final, call
editor_export(async, 10 credits) and polloperation_getfor the signed 24-hour MP4downloadUrl.
Limits and Credit Costs
Section titled “Limits and Credit Costs”| Operation | Cost / Limit | Notes |
|---|---|---|
| Project, session, timeline, placement, cut, frame inspect, review notes | 0 credits | No charge for reads or non-GPU edits |
Image upload (PNG, JPEG, WebP) | 0 credits, 25 MiB max | Ready immediately on upload complete |
Video upload (MP4, WebM, MOV) | 2 credits / min (min 1), 2 GiB / 30 min max | 0 credits charged if ingest fails |
editor_validate_vfx | 1 credit | Strict GPU browser validation + proof frames |
editor_add_vfx | 5 credits | Reuses recent validation; 0 credits on refusal or replay |
editor_export | 10 credits | Async final MP4 export; 0 credits on failure or cancel |
| Active organization editor storage | 25 GiB default cap | Non-failed assets across the organization |