Communitygithub.com

vidforge

Create scripted, reproducible product videos as code for any web application: Playwright records real UI actions + element bounding boxes, xAI TTS (via llm-gateway or direct XAI_API_KEY) generates single- or multi-language voiceovers with native character/word timestamps and WebVTT subtitles, and pinned HyperFrames compiles deterministic 1080p MP4 videos (docs-16x9, social-9x16, raw-16x9) with smooth cursor, auto-zoom, safe-zone captions, optional click/step SFX, ducked background music, and automated QA. Use whenever the user asks for feature review videos, PR/autonomous-cycle demos instead of text and screenshots, help-center tutorials, onboarding walkthroughs, narrated demos, or vertical/landscape re-renders — e.g. «запиши видео», «сними демо фичи», «видео-ревью», «покажи на видео, как это работает», "record a demo video", "feature walkthrough", "tutorial video" — in ReplyBuddy or any other product. Not for raw talking-head phone footage.

Qu'est-ce que vidforge ?

vidforge is a Cursor agent skill that create scripted, reproducible product videos as code for any web application: Playwright records real UI actions + element bounding boxes, xAI TTS (via llm-gateway or direct XAI_API_KEY) generates single- or multi-language voiceovers with native character/word timestamps and WebVTT subtitles, and pinned HyperFrames compiles deterministic 1080p MP4 videos (docs-16x9, social-9x16, raw-16x9) with smooth cursor, auto-zoom, safe-zone captions, optional click/step SFX, ducked background music, and automated QA. Use whenever the user asks for feature review videos, PR/autonomous-cycle demos instead of text and screenshots, help-center tutorials, onboarding walkthroughs, narrated demos, or vertical/landscape re-renders — e.g. «запиши видео», «сними демо фичи», «видео-ревью», «покажи на видео, как это работает», "record a demo video", "feature walkthrough", "tutorial video" — in ReplyBuddy or any other product. Not for raw talking-head phone footage.

Compatible avec~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/NikolayTV/vidforge/tree/HEAD/skill

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

vidforge — Scripted Multi-Language Product Tutorial Videos

Videos are code. One Playwright scenario (scenario.mjs) + one multilingual narration file (script.yaml) produce crisp H.264 MP4 tutorials and .vtt subtitle tracks in any language and any layout (docs-16x9, social-9x16, raw-16x9).

Engine & CLI root: /Users/nikolaytv/workspace/vidforge (alias VF=/Users/nikolaytv/workspace/vidforge/bin/vidforge.mjs). Detailed references inside this skill folder:

  • references/capture-contract.md — stage API, timeline.json, audio.json, locale-independent selectors
  • references/hyperframes-rules.md — pinned HyperFrames invariants (fgrid, fromTo, H.264, approval gate)
  • references/layouts-and-effects.md — docs-16x9, social-9x16, raw-16x9, safe-zone guard, SFX & ducked music

Two Operating Modes

Choose the mode that matches the user's request:

Mode A — Feature Review Demo (PR / autonomous-cycle / showing a finished feature)

Use when demonstrating a new feature or fix for owner review instead of a wall of text and static screenshots:

  • Language & quality: single language (--lang ru by default unless the user works in English), full 1080p (docs-16x9, no --draft — sharp and pleasant to watch).
  • Burned captions ON (--captions): standalone MP4s opened in QuickTime, Telegram, or chat don't load external .vtt tracks, so pass --captions (with auto safe-zone guard) and --sfx.
  • Duration: match the feature's real acceptance flow — 20–40 s for a focused change, or several minutes (as many steps as needed) for complex multi-screen features. Never artificially rush or skip important states.
  • No git pollution: create the temporary scenario folder outside git (e.g. /tmp/vidforge-demos/<feature-slug>/) and point --config at the product's adapter (for ReplyBuddy: frontend/help/videos/video.config.mjs). Hand the rendered 1080p MP4 file path directly to the user.
DEMO=/tmp/vidforge-demos/<feature-slug>
CFG=/Users/nikolaytv/workspace/buddy/frontend/help/videos/video.config.mjs

node $VF record $DEMO --config $CFG --lang ru --rehearsal
node $VF voice  $DEMO --config $CFG --lang ru
node $VF record $DEMO --config $CFG --lang ru
node $VF build  $DEMO --config $CFG --lang ru --layout docs-16x9 --captions --sfx
node $VF render $DEMO --lang ru --layout docs-16x9

Mode B — Help Center / Product Documentation Tutorial (published, multi-language)

Use when publishing persistent tutorials into documentation (e.g. VitePress Help Center) or marketing:

  • Clean 1080p video + .vtt tracks: docs-16x9 defaults to burnCaptions: false so HTML5 <video><track kind="subtitles"> never produces double subtitles when switching languages.
  • Multi-language & multi-layout: author script.yaml for all target languages (ru, en, ...), keep scenario.mjs locale-independent, and emit docs-16x9 (docs) + social-9x16 (vertical reels with burned word-highlighted captions).
  • Keep focused: 4–6 steps, 20–45 s per single user goal; commit scenario.mjs + script.yaml under the product's videos/ folder.

Core Design Rules

  1. One deterministic builder, zero bespoke HTML per video. Never hand-author HyperFrames HTML/GSAP for individual tutorials. An agent writes only two small files per tutorial: scenario.mjs (~30 lines) and script.yaml (~15 lines). build.mjs compiles every layout deterministically.
  2. One video = one fresh helper. When producing a batch of tutorials (e.g. 5 help-center articles), spawn a fresh subagent per tutorial so context never bloats across renders.
  3. Never skip the Approval Gate. Always inspect build/approval-<lang>-<layout>.html (and its extracted step frames) BEFORE running a full 1080p HyperFrames render.
  4. Never guess selectors or API shapes. Inspect the product's actual DOM/components first, run --rehearsal (~5s) to prove selectors work, and verify rendered frames with your own eyes.
  5. No Whisper needed for TTS tutorials. xAI POST /v1/tts (xai/grok-tts) with with_timestamps: true returns character-level timestamps natively (graph_chars + graph_times).

Step-by-Step Workflow

0. Preflight check (once per session / new product)

node $VF doctor [projectDir]

Checks Node >= 22, FFmpeg/FFprobe, pinned HyperFrames (HF_VERSION), built-in CC0 SFX (click.wav, step.wav), and xAI/Gateway credentials (LLM_GATEWAY_URL + LLM_GATEWAY_TOKEN or direct XAI_API_KEY; --mock works offline for pipeline verification). Placing credentials once in /Users/nikolaytv/workspace/vidforge/.env (gitignored) makes them available automatically across all projects and /tmp/vidforge-demos/* runs.

1. Wire the product adapter (once per product repository)

Copy templates/video.config.example.mjs to <product-repo>/videos/video.config.mjs (for ReplyBuddy Help Center: frontend/help/videos/video.config.mjs) and fill:

  • baseUrl — dev/staging URL of the product
  • auth(page, context, { config, locale }) — dedicated QA/demo login (never hardcode passwords; read from gitignored credentials/env)
  • setLocale(context, lang) — switch UI locale cleanly. Gotcha: if the backend returns an account language (like GET /users/me) that overrides localStorage, intercept that GET with context.route(...) to override language in the browser without mutating the QA account on the server!
  • setTheme(context, theme) — light / dark
  • hideSelectors — cookie banners, chat widgets, debug bars
  • brand — name, accent, onAccent, bgStart, bgEnd, captionBg, fontFamily
  • tts — default xAI model (xai/grok-tts), voiceByLang (eve, ara, rex, sal, leo)
  • effects — optional sfx (enabled, clickRelDb: -14, stepRelDb: -16) and music (enabled, file, baseDb: -22, duckDb: -32, fadeOutS: 0.8)

2. Storyboard before coding

Write script.yaml first:

  • Mode A (Feature Review Demo): include as many steps as the real acceptance flow needs — from 20–40 s for a focused change up to several minutes for a complex multi-screen feature. Single language (ru by default).
  • Mode B (Help Center tutorial): keep focused on one user goal (4–6 steps, 20–45 s total) and put every target language (ru, en, es, ...) under languages.<lang>.steps.<step_id>.
  • Each step sentence: 10–18 words, active present tense, says what to do and why (not raw button clicks only).
  • Do NOT use em-dashes in short social captions if they split awkwardly; keep punctuation clean so subtitle chunking lands naturally.

3. Write locale-independent scenario.mjs and rehearse

Write videos/<slug>/scenario.mjs using stage.step(id), stage.click(loc), stage.type(loc, text), stage.focus(loc), stage.cut(fn):

  • Locale-independent selectors: prefer data-testid, semantic CSS structure, input[type=...], href^="..." over localized visible button labels so ONE script records RU, EN, and ES UIs!
  • Clean state: put pre-recording cleanup in prepare(stage) and post-recording off-camera cleanup in cleanup(stage) so QA workspaces stay clean.
  • Rehearse first (5–10 seconds, no encoding):
node $VF record ./videos/<slug> --lang ru --rehearsal

Fix any broken selector here before recording a single frame.

4. Generate voiceover & timestamps FIRST (voice)

Audio-first order lets record hold each live screen for the exact voiceover duration (zero freeze-frames, zero A/V drift):

# Live xAI TTS (via llm-gateway or XAI_API_KEY)
node $VF voice ./videos/<slug> --lang ru,en

# Offline/CI smoke test without API key
node $VF voice ./videos/<slug> --lang ru,en --mock
  • Outputs -16 LUFS 48 kHz WAVs + build/audio-<lang>.json with word-level timings.
  • SHA-256 cached in build/tts-cache/: editing one sentence only re-synthesizes that one step.

5. Record real UI (record)

# Native localized UI for each language (recommended for Help Center)
node $VF record ./videos/<slug> --lang ru
node $VF record ./videos/<slug> --lang en

# Optional native mobile capture for 9:16
node $VF record ./videos/<slug> --lang ru --viewport mobile
  • Outputs build/raw-<locale>-<theme>-<viewport>.mp4 + frame-snapped build/timeline-<locale>-<theme>-<viewport>.json with click (x, y) coordinates and element bbox.
  • To re-voice an existing capture in a new language without re-recording the browser, skip record for that language and pass --capture <existing-capture-key> to build.

6. Build layouts, effects, VTT & Approval Sheet (build)

# Feature Review Demo (standalone MP4 with burned captions + UI SFX)
node $VF build /tmp/vidforge-demos/<slug> --config <path/to/video.config.mjs> --lang ru --layout docs-16x9 --captions --sfx

# Landscape Help Center (clean video + .vtt) + Vertical Social from the same recording, with UI SFX
node $VF build ./videos/<slug> --lang ru --layout docs-16x9,social-9x16 --sfx

# With licensed background music (auto-ducked under voice)
node $VF build ./videos/<slug> --lang ru --layout social-9x16 --sfx --music ./assets/bed.mp3

STOP AND CHECK THE APPROVAL GATE:

  1. Read build/plan-<lang>-<layout>.json — verify warnings is empty (or justified), check holdDuration per step, and note any captionAutoFlipped: true steps (safe-zone guard moved caption to top because active element bbox sat in the bottom 30%).
  2. Inspect at least 2 extracted step PNGs in build/approval-frames-<lang>-<layout>/ (start + modal/save step) to verify:
    • UI is in the intended language and theme,
    • no sensitive/personal data, cookie banners, or broken layouts appear,
    • build/<slug>-<lang>.vtt has crisp, readable subtitle cues.

7. Preview, Render & Automated QA (render)

# Fast 720p preview (~20s)
node $VF render ./videos/<slug> --lang ru --layout docs-16x9 --draft

# Full 1080p H.264 8-bit yuv420p BT.709 +faststart master + automatic QA
node $VF render ./videos/<slug> --lang ru --layout docs-16x9
node $VF render ./videos/<slug> --lang ru --layout social-9x16
  • Runs hyperframes lint --json (fails on any lint error), renders via pinned HyperFrames with --video-frame-format png --sdr --strict, re-encodes to browser-safe H.264 8-bit yuv420p, copies <slug>-<lang>.vtt, and executes qa.
  • out/<video>.mp4.qa.json MUST report "pass": true:
    • h264 + yuv420p, exact target resolution,
    • A/V duration drift <= 250 ms,
    • no black frames in final 0.5 s,
    • integrated loudness in range.

8. Final Visual Verification (Mandatory)

Never hand over a rendered video solely because qa passed. Extract 2–3 frames from the final MP4 and inspect them with your eyes:

ffmpeg -y -loglevel error -ss 1.5 -i out/<file>.mp4 -frames:v 1 build/verify-1.png
ffmpeg -y -loglevel error -ss 12.0 -i out/<file>.mp4 -frames:v 1 build/verify-2.png
ffmpeg -y -loglevel error -ss 21.0 -i out/<file>.mp4 -frames:v 1 build/verify-3.png

Check: crisp readable text (Cyrillic & Latin), cursor & click ring aligned with UI target, zoom keeps key UI inside frame, captions never cover the active input/button, clean title/header in 9:16.

9. Optional Cover / Thumbnail Generation (cover)

When a tutorial or landing embed needs a custom poster image (uses xai/grok-imagine-image-2.0 via llm-gateway or direct XAI_API_KEY):

node $VF cover ./videos/<slug> --prompt "Minimal dark SaaS illustration of a knowledge base card glowing purple" --aspect-ratio 16:9

Troubleshooting & Gotchas

  • Double subtitles in Help Center <video>: Never combine burned-in captions (--captions) with an enabled <track default> subtitle track. docs-16x9 defaults to clean video (burnCaptions: false) + .vtt sidecars; social-9x16 defaults to burned word-highlighted captions.
  • Dashboard UI stayed in English during --lang ru: Server user settings (GET /users/me) overrode localStorage. Intercept the profile response in video.config.mjs setLocale() via context.route(...).
  • hyperframes render exited with render_cancelled_parent_exited: Never launch render with nohup ... &; always run it as a foreground/tracked process.
  • Static freeze-hold warning (> 2.5 s) in approval.html: Audio for that language is much longer than the recorded UI step. Either tighten the narration copy in script.yaml or re-record audio-first (voice then record --lang <lang>).
  • Mock audio vs real xAI voice: Videos built with --mock are for pipeline/layout verification only — never publish mock-voiced MP4s to production docs. Re-run voice (without --mock) → build → render to swap in real xAI speech without re-recording the browser.

Reporting Format

  1. Outcome first: which videos/layouts/languages were built, duration & file size, QA status (PASS/FAIL), and whether voiceover is real xAI TTS or --mock.
  2. Three verification buckets (never mix them):
    • Verified visually on rendered frames (and approval.html),
    • Verified automatically by qa.mjs / tests (ffprobe, A/V sync, loudness, H.264),
    • Not yet verified (e.g. real xAI TTS audio listen, production deploy).

Skills associés