Communitygithub.com

Product Trailer

Make a 20–45 second product trailer in code: a sharp recreation of the real UI, rendered frame by frame to MP4 in landscape or vertical.

What is Product Trailer?

It learns the product from the source, then rebuilds only the screens that matter, in the real colors and words. A pure render function and ffmpeg produce a deterministic cut that can be redone when the copy changes. It is a trailer, not a noisy screen recording.

Works with~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/Flologix/product-trailer-skill/tree/HEAD/product-trailer

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

What does Product Trailer do?

You are making a 20-45 second motion piece that explains one product to a stranger scrolling a feed. It is not a screen recording: it is a clean recreation of the product's UI, styled with the product's real colours, font and wording, animated in HTML and rendered to video exactly, frame by frame.

Why this approach: screen recordings of real apps are full of noise (cursors wandering, loading spinners, unreadable text at phone size, private data). A recreation shows only what matters, stays sharp at any resolution, is deterministic, and can be re-cut in minutes when the copy changes.

What you need

  • Node 18+ and ffmpeg on PATH.
  • Chrome or Chromium. scripts/render.mjs looks in the usual places; set CHROME_PATH otherwise.
  • puppeteer-core (no browser download) in the trailer folder: npm init -y && npm i puppeteer-core.

Check these first and tell the user plainly what's missing rather than working around it.

Workflow

1. Learn the product from the source, not from memory

The trailer has to be true. Read what the product actually is before writing any copy:

  • Visual identity: the colour tokens (CSS variables, Tailwind config, theme files), the font, the logo/mark. Copy hex values exactly; use the same font file if it's in the repo.
  • Real wording: button labels, section names, status names, empty states. Using the app's exact words ("Download shortlist PDF", not "Export") makes the recreation feel like the real thing and keeps it honest.
  • What it really does today. Marketing pages often promise more than the code delivers. Show only working features; if something is "coming soon", leave it out or label it.

If there is no codebase (only a website or a description), use the website's colours and copy and ask the user for anything you can't find.

2. Storyboard before code

Write the storyboard as a short list and show it to the user if the brief was vague; if they gave clear direction, proceed. A structure that works:

  1. Hook (3-5 s): the viewer's problem in their own words. Specific beats generic: "Your buyer wants 4 beds, under $500k, no flood zone" beats "Finding homes is hard".
  2. Input (4-6 s): what the user gives the product (a form, a file, a prompt), shown as the real UI.
  3. The mechanism (5-8 s): the thing only this product does, made visible: items being filtered, ranked, merged, generated. This is the scene people remember; give it the most motion.
  4. The result (4-6 s): the output, with the detail that proves value (the reason, the number, the before/after).
  5. Payoff (3-4 s): what the user walks away with (sent, shipped, saved).
  6. End card (3-4 s): name, one-line promise, URL, offer.

One caption per scene, at most ~8 words, readable on a phone. Captions say what the scene means; the animation shows how.

3. Build the page from the template

Copy assets/template.html into a new folder (e.g. <project>/trailer/) along with scripts/render.mjs, and adapt it. The template already has the frame setup, easing helpers, a caption track, a scaled UI card, a hook, a result beat and an end card; read it once, it is short.

The rules that keep the output correct:

  • Everything is a function of t. render(t) sets opacity and transforms for that moment. No CSS transitions, @keyframes, timers or Date.now(). The renderer jumps between arbitrary times and captures each frame once, so anything on its own clock will stutter or drift.
  • Build the DOM once at load, then only change styles in render. Creating elements per frame is slow and leaks.
  • Design UI cards at a fixed size and scale them with slot()/place(). A card designed at 820 CSS px wide renders crisply in both formats.
  • Use the U unit for type on the stage (captions, end card) so both aspect ratios get proportionate text.
  • Portrait is not landscape squeezed. Use V to give captions their own line breaks, put grids in fewer columns, and centre cards vertically.
  • Label invented data. A small "Sample data" tag (or "Sample buyer and listings" etc.) whenever made-up names, numbers or listings are on screen. Never invent testimonials, customer logos, user counts or benchmark numbers; use real ones the user gives you, or none.
  • Fonts must be local files (@font-face with a relative url()): the page is opened over file:// and the renderer waits for document.fonts.ready; webfonts from a CDN may not arrive in time.

See references/craft.md for motion recipes (staggered lists, filtering, re-ranking, typing, cursor clicks, counters) and the pitfalls list.

4. Check stills before rendering video

Rendering takes minutes; stills take seconds. Pick one moment per scene (when it is fully on screen) and render them in both formats:

node render.mjs trailer.html 1920 1080 --stills 3.5,8,13,18,24,30 stills
node render.mjs trailer.html 1080 1920 --stills 3.5,8,13,18,24,30 stills
bash contact-sheet.sh stills/sheet-x.png 3 stills/still-1920x1080-*.png
bash contact-sheet.sh stills/sheet-v.png 3 stills/still-1080x1920-*.png

Look at the contact sheets yourself (read the PNG) and fix what you see: overlaps, text running off the edge, awkward line breaks, empty space in cards, elements visible in the wrong scene, text too small for a phone. Expect two or three rounds. Also check a transition moment or two: half-faded states are where overlap bugs hide.

5. Render both formats

node render.mjs trailer.html 1920 1080 out/<name>-16x9.mp4 30
node render.mjs trailer.html 1080 1920 out/<name>-9x16.mp4 30

A 35 s trailer is ~1,050 frames per format and takes a few minutes; run it in the background if you can. Afterwards pull a frame or two from the MP4 (ffmpeg -ss 12 -i out/x.mp4 -frames:v 1 check.png) to confirm the encode matches the stills.

6. Hand over

Tell the user where both files are, how long they are, the scene list, and:

  • The video has no audio: suggest adding licensed music in the platform's editor (X, Instagram, TikTok and CapCut all have libraries), or give them the ffmpeg line in references/craft.md to mux a track.
  • How to change copy or timing: edit the page, re-run the two render commands.
  • What is invented on screen, so they don't mistake sample data for claims.

Revising

When the user asks for changes, edit the existing page rather than starting over, re-check stills for the scenes you touched (in both formats), then re-render. Keep timing changes local: shifting one scene's window means shifting the captions and every later scene, so prefer adjusting within a scene's existing window.

Related Skills