AI Ad Video Studio
Complete, self-contained workflow for building and rendering high-converting vertical marketing ad videos (9:16, 1080×1920, H.264 + AAC MP4) from code — zero external stock footage or paid video APIs required.
1. Marketing Ad Structure (5-Beat 15s Blueprint)
Design every ad around 5 crisp, high-contrast beats inside TikTok/Reels/Shorts safe margins (x: 90..990, y: 220..1580):
| Beat | Time | Goal | Visual & Motion Pattern |
|---|---|---|---|
| 1. Hook | 0.0s – 3.0s | Stop the scroll in < 1.5s | Dark high-contrast bg, alert pill, kinetic 2-line question, relatable chat/UI failure + spring-overshoot stamp + screen shake |
| 2. Problem / Agitate | 3.0s – 5.8s | Twist the knife on 3 pain points | Halftone editorial contrast, 3 staggered pain cards (01, 02, 03) with easeOutBack pop-in |
| 3. Hero Reveal | 5.8s – 9.8s | Introduce the product as savior | Spotlight beam sweep + glowing 3D-shaded 2D-canvas product + orbital particles + clear value proposition |
| 4. Proof | 9.8s – 12.6s | Quantify Before vs After | Animated comparison progress bars (Red Before vs Emerald/Gold After) + social proof rating badge |
| 5. CTA End Card | 12.6s – 15.0s | Drive immediate click | Mini hero icon + urgency offer badge + pulsing gradient CTA button + bouncing pointer |
2. Deterministic Rendering Architecture
Never rely on real-time requestAnimationFrame recording (which drops frames under load). Always expose a pure deterministic function:
window.renderFrame = function (t) {
// t = elapsed seconds in [0, duration]
// Draw exact state at timestamp t onto 1080x1920 2D Canvas
};
Memory & Performance Rules
- Prefer 2D Canvas (simulate 3D lighting, capsules, spotlights, and orbital rings mathematically) so 8GB RAM machines render 1080×1920 cleanly without WebGL context crashes.
- Render 1 video at a time and pipe raw PNG screenshots directly into
ffmpegstdin (image2pipe). - Encode with
+faststart:libx264,yuv420p,crf 18,aac 192k,-movflags +faststartfor instant mobile ad playback.
3. Quickstart Commands
Prerequisites
- Python 3.9+ with
playwright(pip install playwright) - Google Chrome or Microsoft Edge installed
ffmpegandffprobeonPATH
Step 1: Customize Template
Copy templates/vertical-ad-9x16.html to your project's index.html and customize the copy, brand colors, product illustration, and benchmark numbers inside window.renderFrame(t).
Step 2: Synthesize Audio (scripts/generate_audio.py)
python scripts/generate_audio.py --out audio.wav --duration 15.0 --bpm 128
Generates a 44.1kHz stereo WAV with an upbeat electronic bass pulse, hook impact, scene-cut whooshes (3.0s, 5.8s, 9.8s, 12.6s), hero sub-drop + chime, and CTA resolve chord.
Step 3: Render MP4 + QA Keyframes (scripts/render.py)
python scripts/render.py --html index.html --audio audio.wav --out ad-final.mp4 --fps 30 --duration 15.0 --qa-dir .
4. Mandatory Deliver-and-Verify QA Loop
Never report a video as done after compilation/rendering alone:
- Probe MP4 metadata:
Confirmffprobe -v error -show_entries format=duration,size -show_entries stream=codec_type,codec_name,width,height,r_frame_rate -of default=noprint_wrappers=1 ad-final.mp41080x1920,h264,aac, expectedduration, and non-zero file size. - Inspect all 5 QA keyframe PNGs (
qa_01_hook.pngthroughqa_05_cta.png):- Check for clipped or overlapping text.
- Check for blank frames or elements outside the
9:16safe zone. - Fix
index.htmland re-render if any visual defect is found.
5. Ecosystem & Companion Workflows
When expanding beyond code-driven 2D Canvas ads:
- NLE Timeline Editing: Use
EditroomMCP (robbietilton/Editroom) for multi-cursor assembly when you need an editable timeline. - React Video: Use
remotion-skills(remotion-dev/skills) for long-form data/SaaS videos. - Motion Craft: Use
vibe-motion-skills,video-shotcraft,emilkowalski-skills, andiart-motion-skills. - Talking-Head & B-Roll: Use
faster-whisper(ms-level word timestamps) +seecut+gbro-collage-broll.