Skip to content
FramesField
Intermediate API / Coding Agent
Verified Nov 30, 2026

50-Variant Dynamic Ad Matrix with Remotion

What you’ll make

A Git-versioned Remotion + FFmpeg batch ad pipeline outputting 50 pixel-exact, -14 LUFS, yuv420p MP4 paid social variants driven directly by one catalog JSON file.

Build a repeatable programmatic video compiler that merges 3 text-free AI hook plates ($2.25), clean real-SKU 2K packshots from ByteDance Seedream 5.5 (~$1.75–$2.03), and a single JSON catalog feed into 50 crisp branded MP4 ad variants (9:16, 4:5, 16:9) using Remotion React templates and FFmpeg mastering—allowing instant $0 price, promo-code, and locale refreshes across every video.

Before you start
  • Node.js 20+, FFmpeg installed locally, and a clean Remotion React workspace.
  • 3 text-free 5-second AI visual hook plates (Runway Gen-4 Turbo or Runway Gen-4.5) conformed to 30 fps CFR.
  • Clean real-SKU packshots or ByteDance Seedream 5.5 2K / native RGBA composites + self-hosted .woff2 brand fonts.
Estimated cost
~$9 one-time AI assets · $0.00 per 50-video re-render
Time needed
90 min (initial template) · 5 min (subsequent 50-ad refreshes)
Jump to section (5)
  1. 01Why combining ~$9 of AI assets with React code scales paid social cleanly
  2. 02Step 1: Generate and pre-conform 3 text-free AI visual hook plates (~$2.25)
  3. 03Step 2: Prepare your catalog JSON feed and brand-locked assets (~$6.80)
  4. 04Step 3: Export visual canaries before running the 50-variant compile
  5. 05Step 4: Compile all 50 MP4s and run automated delivery QC
Step-by-step overview
SIGNAL PATH READY Click any node or press “Step Through” to trace data flow from input plate to final deliverable.
01–04
Hybrid AI Hook Plates + Remotion JSON Ad Compiler Matrix
Verified Video Walkthrough · Privacy-Enhanced Player (Zero Cookies Until Click)

Hybrid AI Hook Plates + Remotion JSON Ad Compiler Matrix

Maximilian Schwarzmüller Extended · youtube-nocookie.com
Frame 01 00:00–00:03 · HOOK
Text-Free AI Motion Plate
Runway Gen-4 Turbo · 30 fps CFR

Reusable 3-second sensory action plate under live React headline inside safe focal core.

Frame 02 00:03–00:12 · BODY
JSON-Driven SKU Showcase
Real-Label 2K / RGBA PNG + Price Tag

Animated brand tokens, crisp SKU photo, price badge, and benefit bullet injected from JSON.

Frame 03 00:12–00:15 · CTA
Deterministic Vector Slate
Recraft V4.1 SVG + Promo Code

Zero-shimmer offer badge & URL card protected by apad audio tail and -14 LUFS loudness.

Separating emotional 3-second AI hook plates from React/Tailwind data overlays lets performance teams scale 18–50 test ads cleanly without warped prices or manual After Effects duplication.

Source: Maximilian Schwarzmüller Extended Model: RUNWAY GEN-4 TURBO PLATES + SEEDREAM 5.5 + REMOTION + FFMPEG Verified Nov 30, 2026
Original source ↗

Why combining ~$9 of AI assets with React code scales paid social cleanly

Re-prompting a video AI model 50 times to swap product SKUs, pricing, and seasonal promo codes guarantees warped text and triple-digit API bills—while duplicating 50 After Effects comps manually burns an entire week of editor time. By treating AI purely as the source of 3 reusable, text-free visual hooks and letting a deterministic Remotion + FFmpeg compiler inject SKU photos, prices, voiceovers, and vector brand slates from JSON, your team ships 50 pixel-sharp ads on demand and updates prices across all 50 videos for $0.

For the full economic model comparing manual NLE vs. pure AI vs. hybrid programmatic pipelines, see our Programmatic AI Video and Ad Automation Guide.

Step 1: Generate and pre-conform 3 text-free AI visual hook plates (~$2.25)

Start by generating 3 distinct 00:00–00:03 opening motion concepts (for example: Macro Product Action, Problem Pattern-Interrupt, and Ambient Lifestyle Reveal) from locked opening PNGs via Runway Gen-4 Turbo ($0.25/5s), which animates a starting image and renders silent, or Runway Gen-4.5 ($0.60/5s), Runway’s newer model. Budgeting 3 takes per hook on Gen-4 Turbo is 9 clips × $0.25 = $2.25; the same 9 takes on Gen-4.5 cost $5.40. Keep all three clips 100% free of text and leave calm negative space inside the middle-upper safe core.

Both Runway models render 720p-class frames, so scale the plate up inside the composition, or run Runway Upscale first when the hook fills the whole 1080×1920 frame. For alternative silent plates, PixVerse V6 bills $0.045/sec at 720p silent ($0.090/sec at 1080p silent with generate_audio_switch: false) and Pika H3 Flex runs $0.02/sec at 768p ($0.035/sec 1080p upscaled), whereas Kling 4.0 ($0.79 per 5-second 720p clip) always renders audio you discard here.

Before importing any AI clip into Remotion, read its real frame rate with ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate -of csv=p=0 raw_hooks/hook01.mp4 (Runway’s API docs do not state one for Gen-4.5), then pre-conform it cleanly to constant 30 fps with dense 1-second keyframes (-g 30) so <OffthreadVideo> decodes at maximum speed with zero frame drops:

for raw in raw_hooks/*.mp4; do
  base=$(basename "$raw")
  ffmpeg -y -i "$raw" -r 30 -fps_mode cfr -g 30 -c:v libx264 -crf 16 -pix_fmt yuv420p -an "public/plates/$base"
done

Step 2: Prepare your catalog JSON feed and brand-locked assets (~$6.80)

Export your product rows (SKU title, price, offer code, real-label 2K or native transparent RGBA PNG from ByteDance Seedream 5.5 at $0.020–$0.035 BytePlus / $0.03–$0.0405 fal.ai—with optional /layerize separated foreground/background PNG layers for Remotion parallax—cleaned Recraft V4.1 SVG icon, and short ElevenLabs TTS 48 kHz audio file) into variants.json.

Keep every text field bounded by a strict schema limit (e.g., headline <= 28 chars, badge <= 18 chars) so long product titles never wrap unexpectedly across lines. Bundle your .woff2 brand fonts inside public/fonts/ and await font loading before rendering frame 0—avoiding the broken fallback fonts documented in our Remotion & FFmpeg Missing Font Fix.

Step 3: Export visual canaries before running the 50-variant compile

Always run render-ad-matrix.mjs (above) with its built-in Canary Gate first. Inspect out/canary_hook.png (frame 45) and out/canary_cta.png (frame 405) — or let our read-only Ad Creative & Localization QA Agent check safe-zone clearance (9:16 captions inside y:1220–1420, clear of bottom 420px and right 150px platform icons via the Social Safe-Zone Checker).

Step 4: Compile all 50 MP4s and run automated delivery QC

Once both canary stills pass visual inspection, render-ad-matrix.mjs compiles all 50 variants with --pixel-format=yuv420p, normalizes mixed voiceover + music stems cleanly to -14 LUFS / -1.0 dBTP (48 kHz), and injects -movflags +faststart. Run our read-only Video QC Delivery Agent across out/final/ to confirm 100% playback compliance across Meta Ads, TikTok, YouTube Shorts, and Safari before uploading.

Copy-paste template

Node.js Remotion Batch Compiler + Post-Render FFmpeg QC Script render-ad-matrix.mjs
Reads variants.json, renders a Frame-45 visual canary first, compiles all variants with yuv420p and bounded concurrency, and applies -14 LUFS + faststart mastering.
// Usage: node render-ad-matrix.mjs variants.json
import { execFileSync } from 'node:child_process';
import { mkdirSync, readFileSync } from 'node:fs';
import path from 'node:path';

const feedPath = process.argv[2] || 'variants.json';
const variants = JSON.parse(readFileSync(feedPath, 'utf8'));
mkdirSync('out/raw', { recursive: true });
mkdirSync('out/final', { recursive: true });

// 1. Visual Canary Check on Variant #1 (frame 45 = headline, frame 405 = CTA)
const canaryProps = JSON.stringify(variants[0]);
execFileSync('npx', ['remotion', 'still', 'src/index.ts', 'AdVariant', 'out/canary_hook.png', '--frame=45', `--props=${canaryProps}`], { stdio: 'inherit' });
execFileSync('npx', ['remotion', 'still', 'src/index.ts', 'AdVariant', 'out/canary_cta.png', '--frame=405', `--props=${canaryProps}`], { stdio: 'inherit' });
console.log('Canary frames exported to out/canary_hook.png & out/canary_cta.png');

// 2. Compile full matrix cleanly with bounded concurrency + yuv420p
for (const v of variants) {
  const rawOut = path.join('out/raw', `${v.id}.mp4`);
  const finalOut = path.join('out/final', `${v.id}.mp4`);

  execFileSync(
    'npx',
    [
      'remotion', 'render', 'src/index.ts', 'AdVariant', rawOut,
      '--codec=h264', '--pixel-format=yuv420p', '--concurrency=4',
      `--props=${JSON.stringify(v)}`
    ],
    { stdio: 'inherit' }
  );

  // 3. Enforce broadcast -14 LUFS loudness & +faststart web atom
  execFileSync(
    'ffmpeg',
    [
      '-y', '-i', rawOut,
      '-c:v', 'copy',
      '-af', 'loudnorm=I=-14:TP=-1.0:LRA=11',
      '-c:a', 'aac', '-b:a', '192k', '-ar', '48000',
      '-movflags', '+faststart',
      finalOut
    ],
    { stdio: 'inherit' }
  );
  console.log(`Shipped ${finalOut}`);
}

Helpful prompts & skills for this workflow

Frequently Asked Questions

Why should I pre-conform AI video clips to 30 fps CFR with -g 30 before passing them into Remotion?
Remotion's OffthreadVideo extracts individual frames out of order across parallel CPU threads. Pre-conforming source AI clips to exact 30 fps CFR with tight keyframes (-g 30) eliminates seek latency, frame stutter, and out-of-sync cuts across 50-variant renders.
How do I prevent font fallbacks or broken emoji boxes when rendering Remotion inside Docker or GitHub Actions?
Never depend on live Google Fonts URLs or OS system fonts inside headless CI. Self-host your exact .woff2 files in public/fonts/, block frame 0 with loadFont() and delayRender(), and swap emojis for SVGO-cleaned Recraft V4.1 SVG icons.
How fast does a 50-variant batch render on a modern MacBook Pro or cloud worker?
Fifty 15-second 1080×1920 variants render locally in roughly 6 to 12 minutes using --concurrency=4 on Apple Silicon, or in under 90 seconds fan-out on Remotion Lambda for pennies in AWS compute.
Use this page in AI tools or notes
raw .md