---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "50-Variant Dynamic Ad Matrix with Remotion"
description: "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."
canonical: "https://framesfield.com/workflows/programmatic-ad-variant-matrix-remotion-pipeline"
---

# 50-Variant Dynamic Ad Matrix with Remotion

> 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.

- **Canonical URL:** https://framesfield.com/workflows/programmatic-ad-variant-matrix-remotion-pipeline
- **Difficulty:** Intermediate
- **Estimated Time:** 90 min (initial template) · 5 min (subsequent 50-ad refreshes)
- **Estimated Cost:** ~$9 one-time AI assets · $0.00 per 50-video re-render
- **Last Verified:** 2026-11-30
- **Tools Used:** Runway Gen-4 Turbo (https://framesfield.com/specs/runway-gen-4), Runway Gen-4.5 (https://framesfield.com/specs/runway-gen-4-5), ByteDance Seedream 5.5 (https://framesfield.com/specs/seedream-5-5), Recraft V4.1 (https://framesfield.com/specs/recraft-v4-1), ElevenLabs TTS & SFX (https://framesfield.com/specs/elevenlabs-tts)

## Pipeline Architecture

01. **Conform AI Hook Plates** (Runway Gen-4 Turbo / FFmpeg CFR): Generate 3 textless 5s hooks & conform to 30 fps yuv420p
02. **Compile 3×3×2 JSON Feed** (Catalog JSON / Shopify): Map hooks, SKU PNGs, prices, VO paths & CTA codes
03. **Batch Compile in Remotion** (Remotion CLI + Self-Hosted Fonts): Render all variants locally with --pixel-format=yuv420p
04. **Automated ffprobe & QA Gate** (FFmpeg + Skill 11 & 48): Verify -14 LUFS, yuv420p, +faststart & safe-zone canaries

## Playbook

## 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](/guides/programmatic-ai-video-and-dynamic-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](/specs/runway-gen-4) (`$0.25/5s`), which animates a starting image and renders silent, or [Runway Gen-4.5](/specs/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](/specs/pixverse-v6) bills `$0.045/sec` at 720p silent (`$0.090/sec` at 1080p silent with `generate_audio_switch: false`) and [Pika H3 Flex](/specs/pika-h3-flex) runs `$0.02/sec` at 768p (`$0.035/sec` 1080p upscaled), whereas [Kling 4.0](/specs/kling-4) (`$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:

```bash
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](/specs/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](/specs/recraft-v4-1) SVG icon, and short [ElevenLabs TTS](/specs/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](/fixes/remotion-and-ffmpeg-font-missing-and-emoji-box-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](/skills/ad-creative-and-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](/tools/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](/skills/video-qc-delivery-agent) across `out/final/` to confirm 100% playback compliance across Meta Ads, TikTok, YouTube Shorts, and Safari before uploading.

## Copyable Asset: Node.js Remotion Batch Compiler + Post-Render FFmpeg QC Script (render-ad-matrix.mjs)

```text
// 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}`);
}
```

## FAQ

### 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.
