Launch film
A pipeline that turns product facts + a voiceover into a finished MP4. Every frame is a pure function of time (renderFrame(t) in film/film.js), so stills, previews and the final render always agree, and every caption/cut is driven by a measured word table.
The scripts live in scripts/ next to this file (call it <skill>). They have no npm dependencies: they need Node 20+, ffmpeg/ffprobe on PATH, and any Chromium (Playwright's chromium-headless-shell is found automatically; else set CHROME=). Work in a fresh project folder, e.g. ~/<product>-launch/, and run every script from inside it.
0. Facts first — what the video may claim
Read the real product before writing a word: its landing page, its docs/README, its UI source, an existing intro video (grab frames with ffmpeg). Features in the script and UI in the scenes must be things the product actually does, written in words its users use. Audience matters: for shop owners / non-technical buyers, use short everyday sentences, no jargon.
Brand hygiene, learned the hard way:
- If the product name contains someone else's brand (e.g. a tool for Zalo/Shopee/Notion) and is not officially affiliated, don't use that brand's logo or signature colour; type the name as text.
- Source folders are often forks of an older client project. Grep screenshots/UI strings for leftover client names (old company names, old logos, old sample data) and keep them out of the film. Ask the user if unsure.
- Don't redraw a real company's official logo unless the user supplies it. A product's own logo seen in its intro video may be recreated, but say so and offer to swap in the original file.
- Sample names, prices and chats on screen are illustrative — tell the user.
1. Script
Default shape (adapt it; length follows content, ~9–12 short lines):
This is [Name]. A [category]… built for [value]. [VERB] in ANY [thing]! ← drop · Give it [input], and it just… understands. · The more you use it, the BETTER it gets. · [3 settings/features, one short line each] · Every [output], exactly as you pictured it. · [Name]. Out now.
- One emphasised word only (gradient + glow). Brand-coloured name is fine in addition.
- To cover all key features (user request), give each feature its own short line and let the film run ~27–30 s instead of 22 s.
- Write
script.json(seetemplates/script.example.json):lines[]→units[]split at commas/sentence ends, each withend: ","|".". Lines are what captions and scenes key off.extraBefore(seconds) adds breathing room before a line (used before the logo gather).
2. Voice
Preferred: the VoiceStudio MCP if connected (list_voices, generate_speech with profile_id, language, steps: 32). Otherwise ElevenLabs over HTTPS with the user's key. Generate 4 takes of the full script, copy them into voice/ with readable names, and measure each (ffmpeg -af silencedetect=noise=-38dB:d=0.12): length, longest pause, peak. Present the table and let the user pick; if they don't pick, choose the most fluent take (fewest/shortest pauses) and say so.
Notes: VoiceStudio's instruct is a voice-design attribute string ("female, young adult, american accent"), not emotion tags — emotion comes from punctuation and the voice itself. Its transcribe may return 409 when ASR isn't enabled; the aligner below does not need ASR.
Then align and clean the chosen take:
node <skill>/scripts/voice_align.mjs voice/take.wav script.json build/voice.wav build/words.json 0.9
It splits speech at ≥100 ms pauses, aligns segments to script units with dynamic programming (a comma may or may not pause), trims pauses >0.28 s to 0.2 s, levels each line 85 % toward the median (gain moves only inside pauses), and writes words.json (phrases[], words[] with t0/t1). Check the printed alignment table makes sense (each unit on plausible audio). Word times inside a phrase are syllable-proportional and snapped to envelope dips — good for typing captions; say so if the user expects per-word ASR precision.
3. Assets
node <skill>/scripts/assets.mjs fonts # Be Vietnam Pro (all Vietnamese diacritics) + Geist Mono
node <skill>/scripts/assets.mjs pool 2 11 # ~1000 free thumbnails + contact sheets to choose from
node <skill>/scripts/assets.mjs get <id> <id>… # chosen photos at 640²
node <skill>/scripts/shoot-ui.mjs <product>/public ref/ui index.html other.html # read-only UI screenshots (no backend)
Look at the sheets (Read the .jpg) and pick images that fit the product's world; free stock is mostly landscapes, so draw product visuals procedurally when stock doesn't fit (the template draws flat-lay tees, chat cards, file cards, code cards). Real UI is redrawn in canvas from the screenshots/source — same layout, colours (read the CSS variables), labels and sample flow — not pasted screenshots.
4. Film
Copy templates/film/ into the project as film/, export the word table, then adapt film.js:
node -e "const j=require('./build/words.json');require('fs').writeFileSync('film/words.js','window.WORDS='+JSON.stringify(j)+';')"
Read references/film-template.md before editing — it maps every scene, the helpers (typeWords, glass, tile, aura, cam, push), the timing variables, the sound-event table and META.runs. Keep the rules that make the style work:
- Scene starts land on phrase starts (
B[]), cross-fades straddle them (±0.18 s). Camera pushes 1.00→1.04 per scene; when content carries into the next scene, start that scene at the zoom the previous one ended on. - Nothing pops in: eased fades ≥0.3 s. The only hard cuts are 16th-note runs (image flashes, card swaps, seed rolls), aligned to the grid anchored on the drop.
- No full stops on screen. No selection-box highlights, white flashes, slams, 3D.
- Glass needs something behind it (aura or blurred photo wash) or it disappears.
5. Check stills before the full render
node <skill>/scripts/render.mjs events build/events.json # also proves the page boots
SUB=1 node <skill>/scripts/render.mjs stills build/stills 1.7 3.9 6.4 7.6 … # one per scene + key moments
node <skill>/scripts/finish.mjs sheet build/stills build/contact.jpg
Read the contact sheet yourself and fix what you see before showing the user: chip/label out of sync with the card it names, overlapping badges, text running under glass, an off-topic image ending a sequence, captions cut by the frame edge, untranslated or leftover strings. Re-render the affected stills with SUB=8 to confirm motion blur looks right. Show the user ~8 stills (paths + what each shows) when they asked to approve stills; otherwise proceed.
6. Sound, render, verify
node <skill>/scripts/finish.mjs audio # music+SFX synth, 3-band duck, per-phrase mid trim to ~+9 dB, loudnorm -14 LUFS
node <skill>/scripts/finish.mjs video <name>.mp4 3 # ~1 s/frame/worker; run in the background
audio.mjs synthesises a 130 BPM bed whose bar grid is anchored on the drop (META.D) and one SFX per event at its peak (key per typed letter, click per image change, whoosh, riser into the drop/logo, impact, soft land on the emphasised word), so nothing has to be downloaded. If the user supplies a track, mix it instead and keep the drop on the verb line. Report the printed voice-over-music table honestly: lines after the drop should sit ≈+9 dB; sparse intro/outro lines are higher by design.
finish.mjs video renders in parallel, muxes AAC 320k, scans frame differences for single-frame pops outside META.runs, and prints size/fps/loudness. Then extract a few frames from the final MP4 and look at them before reporting.
7. Report
Give the path to the MP4, its specs, what each scene shows, the check results (pops, LUFS/peak, voice-over-music), and what is illustrative or redrawn (logo, sample data, procedural product shots, synthesized music), plus the one-line offer to swap in real assets. Write to the user in their language and plain words.
Gotchas
- Shell tools on Windows: use
ffmpeg -f concatlists instead of process substitution; setcdinside the same command as long background renders. canvas.letterSpacingandctx.filterneed a recent Chromium — the bundled finder picks the newest Playwright build.- Fonts: Geist lacks some Vietnamese glyph coverage; use Be Vietnam Pro for Vietnamese text.
- Motion blur straddles hard 16th cuts and shows one blended frame — that is expected, and those ranges belong in
META.runs.