remotion-saas
1st-party AIQ Labs seed library · Video & Motion
Helps build SaaS applications with Remotion, including embedding video players and setting up client- or server-side rendering.
Pass rate with the skill minus without, same tasks, same model.
- Content Lift forced arm
- −25pp [−75, +25]
- Trigger rate
- 100%
- Trials
- 24 · 8 tasks
- Model
- GLM-5.3-flash
- Measured
- 2026-10-15
Content Lift = the skill's instructions injected into the system prompt, so it measures what the content does once loaded, apart from whether the agent chooses to load it. Method →
Embed this score · live badge for your README
The badge shows the real benchmark number and updates itself when we re-bench — including the honest states (“did not trigger”, “not benched yet”). All badge options →
[](https://skillzbench.com/skills/remotion-saas)[](https://skillzbench.com/skills/remotion-saas)<a href="https://skillzbench.com/skills/remotion-saas"><img src="https://skillzbench.com/api/badge/remotion-saas.svg" alt="SkillzBench benchmark" height="20"></a>A/B outputs — median trial per arm
Chat harness (v2): the agent's final message without the skill (left) vs with it (right).
remotion-saas--m1
Basic Architecture for a Form-to-Video Web App
Here's the typical pipeline, broken into its main pieces:
1. Frontend (Form + Status UI)
- A simple form (text fields, image uploads, template/style choices).
- On submit, it doesn't wait for the video — it POSTs the input to your backend and receives a
job_id. - It then polls a status endpoint (or subscribes via WebSocket/SSE) to show progress ("Rendering… 40%") and displays/downloads the video when done.
2. Backend API (Job Orchestrator)
- Validates form input, applies rate limits/auth.
- Creates a job record in a database (input params, status:
queued → rendering → done/failed, output URL, timestamps). - Pushes the job onto a queue (Redis, SQS, RabbitMQ, etc.) so rendering happens asynchronously.
3. Rendering Service (Worker)
- Pulls jobs off the queue. This is the core piece. Common approaches:
- Programmatic composition: Remotion (React → video), Motion Canvas, or FFmpeg scripts that assemble text/images/animations from a template.
- Headless browser capture: render an animated web page in Puppeteer/Playwright and record frames → encode with FFmpeg.
- Cloud video APIs: Shotstack, Creatomate, Mux — they handle rendering infra for you.
- Writes the output file to object storage (S3, GCS), updates the job record with the URL, and emits a completion event.
4. Storage + Delivery
- Videos live in object storage; serve via CDN with signed URLs so users can download/stream.
Data flow at a glance
User → Form → POST /api/videos → DB (job) → Queue
↓
Worker renders
↓
S3 output → DB updated → CDN URL
User polls GET /api/videos/:id → gets final video link
Key design points for beginners
- Always async. Rendering takes seconds to minutes; never do it inside the HTTP request.
- Templatize. Define a few video templates with placeholders; the form just fills slots. This keeps rendering predictable.
- Idempotency + retries. Workers crash; make jobs re-runnable.
- Start simple: one server running a queue (even a DB-backed one) + Remotion or FFmpeg is enough for an MVP. Split into separate worker services only when you need to scale.
If you tell me your stack (Node/Python, cloud provider), I can sketch a more concrete setup.
Here's the standard architecture, using Remotion (the most common choice for this) as the concrete example.
The three pieces
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ Frontend │ │ Composition │ │ Rendering service │
│ (form + preview)│ ───▶ │ (video as code) │ ───▶ │ (server → MP4) │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
JSON props ──────────────▶ same component used for both
The key insight: the video is a React component parameterized by props. The user's form input becomes a JSON object, and that same JSON drives both the live preview and the final render. One source of truth.
1. Frontend: form + live preview
- The form collects structured input: title text, subtitle, colors, an image URL, etc. Don't think of it as "form data" — think of it as video props.
- Validate the shape with a schema (Zod is the convention in Remotion) and share that schema between frontend and backend.
- Embed a
<Player>component in your React app. It renders your composition in the browser in real time — as the user types, the video preview updates instantly. No server involved in previewing.
<Player
component={MyVideo}
inputProps={{ title: "Hello", color: "#ff0000" }}
durationInFrames={120}
fps={30}
compositionWidth={1920}
compositionHeight={1080}
/>
2. Composition: the video as code
A single component that reads its props and animates over time:
const MyVideo: React.FC<{ title: string }> = ({ title }) => {
const frame = useCurrentFrame();
const opacity = interpolate(frame, [0, 30], [0, 1]);
return <h1 style={{ opacity }}>{title}</h1>;
};
You get animation primitives (interpolate, spring) instead of CSS keyframes, and the output is deterministic — frame 45 always looks the same. This determinism is what makes server-side rendering possible.
3. Rendering service: async job, not a request handler
Rendering takes seconds to minutes, so it must be an async background job, never part of the HTTP request/response cycle:
POST /api/render {props} → validate with Zod, enqueue job, return renderId
Worker / Lambda → renders composition to MP4
Storage (S3, etc.) → upload output file
GET /api/render/:id → frontend polls until status = done, then download link
Rendering options, roughly in order of fit for a SaaS:
- Remotion Lambda — renders in parallel across AWS Lambda functions; scales to zero, pay per render. The default choice for production SaaS.
- Node.js server with a queue (BullMQ +
renderMedia()) — simpler to reason about, fine for low volume, but you manage capacity and long-running processes. - Cloudflare / Vercel-flavored options — exist if you're committed to those platforms.
Practical gotchas for your first build
- **Never render
remotion-saas--m2
Generating a 10-Second Animated Video from Form Input
The cleanest modern approach is Remotion — a React-based video rendering framework. You compose the video as React components, then trigger server-side renders and serve the MP4.
1. Video composition (shared code)
// src/video/GreetingVideo.tsx
import {
AbsoluteFill, interpolate, spring, useCurrentFrame,
useVideoConfig, Sequence,
} from 'remotion';
export const GreetingVideo: React.FC<{
name: string;
message: string;
}> = ({ name, message }) => {
const frame = useCurrentFrame();
const { fps, durationInFrames } = useVideoConfig();
// Name slides in with a spring
const nameScale = spring({ frame, fps, config: { damping: 12 } });
// Message fades in after 1s
const msgOpacity = interpolate(frame, [fps, fps * 2], [0, 1], {
extrapolateLeft: false,
});
// Gentle drift throughout
const drift = interpolate(frame, [0, durationInFrames], [0, 40]);
return (
<AbsoluteFill
style={{
background: 'linear-gradient(135deg, #667eea, #764ba2)',
justifyContent: 'center', alignItems: 'center',
}}
>
<Sequence from={0}>
<h1 style={{ transform: `scale(${nameScale}) translateY(${drift}px)`, color: '#fff' }}>
{name}
</h1>
</Sequence>
<Sequence from={fps}>
<p style={{ opacity: msgOpacity, color: '#fff', fontSize: 32 }}>{message}</p>
</Sequence>
</AbsoluteFill>
);
};
// src/video/Root.tsx
import { Composition } from 'remotion';
import { GreetingVideo } from './GreetingVideo';
export const RemotionRoot = () => (
<Composition
id="Greeting"
component={GreetingVideo}
durationInFrames={300} // 10s at 30fps
fps={30}
width={1920}
height={1080}
defaultProps={{ name: '', message: '' }}
/>
);
2. Server-side render endpoint
Rendering headless Chrome is heavy, so do it on the server (a Node/Next.js route), not the browser. Use Remotion's renderMedia with a Lambda or plain Node renderer:
// app/api/render/route.ts (Next.js App Router example)
import { bundle } from '@remotion/bundler';
import { renderMedia, selectComposition } from '@remotion/renderer';
import path from 'path';
const bundled = await bundle({
entryPoint: path.join(process.cwd(), 'remotion/index.ts'),
});
export async function POST(req: Request) {
const { name, message } = await req.json();
const composition = await selectComposition({
serveUrl: bundled,
id: 'Greeting',
inputProps: { name, message },
});
const { waitForFinish } = await renderMedia({
composition,
serveUrl: bundled,
codec: 'h264',
outputPath: `/tmp/${crypto.randomUUID()}.mp4`,
inputProps: { name, message },
});
await waitForFinish;
// Stream the file back or upload to S3 and return a signed URL
return Response.json({ downloadUrl });
}
3. Frontend trigger + download
const handleSubmit = async ({ name, message }) => {
setRendering(true);
const res = await fetch('/api/render', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, message }),
});
const { downloadUrl } = await res.json();
setRendering(false);
// Trigger download
const a = document.createElement('a');
a.href = downloadUrl;
a.download = 'greeting.mp4';
a.click();
};
Key recommendations
- Render on the server, never in the browser. A 10s 1080p render takes several seconds and needs headless Chrome.
- For production scale, use Remotion Lambda (
@remotion/lambda) — renders complete in seconds on distributed workers and you get an S3 URL directly. A self-hosted Node renderer will queue under load. - Long-running requests: a 10s render may exceed serverless timeouts. Either use Lambda rendering, or return a job ID immediately and poll a status endpoint (
/api/render/:id) until the MP4 is ready. - Sanitize/limit inputs (max lengths) since they're baked into the video.
- Alternative: if you want zero server infrastructure, client-side options exist (e.g.,
ffmpeg.wasm+ Canvas recording viaMediaRecorder), but they're slower, memory-heavy, and less reliable for 1080p — Remotion server-side is the robust choice.
Here's a solid architecture for this using Remotion (the standard choice for programmatic video in JS):
1. The composition
Create a shared Remotion project with a parameterized composition:
// src/Greeting.tsx
import {
AbsoluteFill, interpolate, spring, useCurrentFrame, useVideoConfig, Sequence,
} from "remotion";
export const Greeting: React.FC<{ name: string; message: string }> = ({ name, message }) => {
const frame = useCurrentFrame();
const { fps, durationInFrames } = useVideoConfig();
const titleProgress = spring({ frame, fps, config: { damping: 12 } });
const titleY = interpolate(titleProgress, [0, 1], [80, 0]);
const titleOpacity = interpolate(frame, [0, 15], [0, 1], { extrapolateRight: "clamp" });
const msgProgress = spring({ frame: frame - 20, fps, config: { damping: 12 } });
const msgX = interpolate(msgProgress, [0, 1], [-120, 0]);
const fadeOut = interpolate(frame, [durationInFrames - 20, durationInFrames], [1, 0], {
extrapolateLeft: "clamp",
});
return (
<AbsoluteFill style={{ backgroundColor: "#0b1020", justifyContent: "center", alignItems: "center", opacity: fadeOut }}>
<h1 style={{ transform: `translateY(${titleY}px)`, opacity: titleOpacity, color: "#fff", fontSize: 90 }}>
{name}
</h1>
<p style={{ transform: `translateX(${msgX}px)`, opacity: msgProgress, color: "#a5b4fc", fontSize: 40 }}>
{message}
</p>
</AbsoluteFill>
);
};
Register it:
// src/Root.tsx
import { Composition } from "remotion";
import { Greeting } from "./Greeting";
export const RemotionRoot = () => (
<Composition
id="Greeting"
component={Greeting}
durationInFrames={300} // 10s @ 30fps
fps={30}
width={1920}
height={1080}
defaultProps={{ name: "Ada", message: "Hello!" }}
/>
);
2. Live preview in the form (optional but great UX)
Use <Player> so users see the animation before rendering:
import { Player } from "@remotion/player";
<Player
component={Greeting}
inputProps={{ name, message }}
durationInFrames={300}
fps={30}
compositionWidth={1920}
compositionHeight={1080}
controls
style={{ width: "100%" }}
/>
3. Render trigger — server-side
Rendering MP4s client-side is impractical; do it on the server. Two main options:
Option A: Node.js server (simplest) — a route that renders and returns the file:
// server/render.ts (Express example)
import { bundle } from "@remotion/bundler";
import { renderMedia, selectComposition } from "@remotion/renderer";
const bundlePromise = bundle({ entryPoint: "./src/index.ts" }); // cache this!
app.post("/api/render", async (req, res) => {
const { name, message } = req.body;
const bundleLoc = await bundlePromise;
const composition = await selectComposition({
serveUrl: bundleLoc,
id: "Greeting",
inputProps: { name, message },
});
await renderMedia({
composition,
serveUrl: bundleLoc,
codec: "h264",
outputPath: `out/${id}.mp4`,
inputProps: { name, message },
});
res.json({ downloadUrl: `/api/download/${id}` });
});
Option B: Remotion Lambda (recommended for production/SaaS) — renders in parallel on AWS Lambda, typically finishing a 10s video in seconds and far cheaper/scalable:
import { renderMediaOnLambda } from "@remotion/lambda/client";
const { lambdaName, bucketName } = await renderMediaOnLambda({
region: "us-east-1",
functionVersion: "default",
serveUrl: REMOTION_SITE_URL, // deployed bundle
composition: "Greeting",
inputProps: { name, message },
codec: "h264",
framesPerLambda: 20,
});
// result includes output S3 URL — hand it to the client
4. Frontend flow
- User submits the form →
POST /api/renderwith{ name, message }. - Server returns a render ID / job ID (or poll Lambda status).
- When done, give the user a download link (
<a href={url} download>), or stream the MP4 withContent-Disposition: attachment.
Key tips
- Validate/sanitize input props — they're injected into the render.
- Cache the bundle — bundling is slow; do it once at server startup.
- Queue renders (BullMQ, etc.) if you expect concurrency; rendering is CPU-heavy.
- 10s @ 30fps = 300 frames; use 60fps only if you need smoother motion (doubles render cost).
- If you're on Vercel, note serverless functions have time/size limits — Lambda or a separate render worker is the safer path there.
This gives you instant preview in the form plus a scalable MP4 download pipeline.
remotion-saas--m3
This is a classic Remotion use case — it's designed exactly for "preview in browser + render on server" workflows. Here's the recommended architecture:
1. Project structure
my-video-app/
├── remotion/ # shared video composition code
│ ├── Root.tsx # <Composition> definitions
│ └── MyVideo.tsx
├── web/ # your frontend (Next.js, etc.)
└── api/ # serverless render endpoint
Keep the composition code in a shared package (or workspace) so both the preview and the renderer import the same components — this guarantees what the user previews is what gets rendered.
2. Interactive preview in the browser
Use @remotion/player — it's a standalone React component, no bundling of the full Remotion studio needed:
import { Player } from '@remotion/player';
import { MyVideo, myVideoSchema } from './remotion/MyVideo';
<Player
component={MyVideo}
durationInFrames={300}
fps={30}
compositionWidth={1920}
compositionHeight={1080}
inputProps={{ title: userTitle, clips: userClips }}
controls // gives you scrubbing/playback UI for free
style={{ width: '100%' }}
/>
The Player ships with a scrub bar, play/pause, and keyboard controls out of the box. You can also drive it programmatically via a ref (playerRef.current.seekTo(frame)) if you want a custom timeline UI.
Dynamic props: pass anything serializable via inputProps. For complex/typed props, define a Zod schema with @remotion/zod-types and use zod() in your <Composition> and calculateMetadata — the same schema validates props on both client and server.
If props are huge (e.g. long asset lists), pass a small ID and have the composition fetch data with delayRender() + continueRender() or staticFile().
3. Serverless rendering
Use @remotion/lambda — Remotion's official Lambda-based renderer. It handles chunked rendering (frames distributed across concurrent Lambdas), S3 upload, and progress tracking.
Deploy once (CLI or programmatically):
npx remotion lambda sites create remotion/index.ts --site-name my-video
npx remotion lambda functions deploy --region us-east-1
Trigger a render from your serverless API route:
import { renderMediaOnLambda } from '@remotion/lambda/client';
const { renderId, bucketName } = await renderMediaOnLambda({
region: 'us-east-1',
functionName: process.env.REMOTION_FUNCTION_NAME!,
serveUrl: process.env.REMOTION_SITE_URL!, // the deployed bundle
composition: 'MyVideo',
inputProps: { title: body.title, clips: body.clips }, // same props as preview
codec: 'h264',
downloadName: 'video.mp4',
});
Key point: inputProps here must match what you passed to the Player — that's how "preview = final render" is guaranteed.
4. Handling the async render job
renderMediaOnLambda returns immediately with a renderId — the render continues in the background. Pattern:
- API route kicks off the render, writes a job record to your DB (
{ renderId, userId, status: 'rendering' }), returns the job ID to the client. - Poll progress from client or a background check:
import { getRenderProgress } from '@remotion/lambda/client';
const progress = await getRenderProgress({
region: 'us-east-1',
functionName: process.env.REMOTION_FUNCTION_NAME!,
bucketName,
renderId,
});
// progress.progress (0–1), progress.done, progress.outputFile, progress.fatalErrorEncountered
- When
progress.doneis true,progress.outputFileis a signed S3 URL — store it, mark the job complete, notify the user (or let the client poll your job endpoint every ~2s and show a progress bar fromprogress.progress).
For production, consider a queue (SQS / Upstash QStash / your job table + cron) between the API and the render trigger so a cold-started API route doesn't get cut off mid-render — the render itself survives in Lambda, but you want the kickoff to be reliable.
Practical tips
- Cost control: set
framesPerLambdaandconcurrencyPerLambdato balance speed vs. Lambda invocation count; cap video length per tier. - Timeouts: the render orchestrator Lambda has a 15-min max; very long videos need chunking (Remotion handles this, but be aware).
- Auth on assets: pass short-lived signed URLs in
inputPropsrather than proxying through your API. - Webhooks:
renderMediaOnLambdasupportswebhook: { url, secret }so Remotion calls you on completion instead of you polling — cleaner for serverless.
That's the whole loop: shared composition → Player with inputProps for preview → renderMediaOnLambda with the same props → poll/webhook for job status → S3 output URL.
Here's the standard Remotion-based setup for exactly this workflow:
1. Architecture overview
- Shared composition code in a package (or monorepo folder) imported by both your frontend and your renderer.
<Player>in the browser for interactive preview (scrub, play, pause).@remotion/lambdafor serverless rendering (works great on Vercel/Netlify functions, or any Node backend).
2. The composition (shared)
// remotion/MyVideo.tsx
export const videoSchema = z.object({
title: z.string(),
color: z.string(),
});
export const MyVideo: React.FC<z.infer<typeof videoSchema>> = ({ title, color }) => {
return (
<AbsoluteFill style={{ backgroundColor: color, justifyContent: 'center' }}>
<h1>{title}</h1>
</AbsoluteFill>
);
};
// remotion/Root.tsx
export const RemotionRoot = () => (
<Composition
id="MyVideo"
component={MyVideo}
schema={videoSchema}
durationInFrames={120}
fps={30}
width={1920}
height={1080}
defaultProps={{ title: "Hello", color: "#111" }}
/>
);
3. Interactive preview with <Player>
npm i @remotion/player
import { Player } from '@remotion/player';
import { MyVideo, videoSchema } from './remotion/MyVideo';
<Player
component={MyVideo}
inputProps={{ title, color }} // dynamic props — same shape as render
schema={videoSchema}
durationInFrames={120}
fps={30}
compositionWidth={1920}
compositionHeight={1080}
controls // built-in scrubber
style={{ width: '100%' }}
/>
The Player is fully interactive: users can scrub, play, pause, and you can drive it programmatically via a ref (playerRef.current.seekTo(frame), .play(), etc.). Since inputProps is just React state, edits in your UI update the preview instantly.
4. Serverless render with Lambda
npm i @remotion/lambda aws-sdk
npx remotion lambda sites render src/index.ts serve.json # deploy your bundle once
Then in an API route (e.g. Vercel function):
import { renderMediaOnLambda, getRenderProgress } from '@remotion/lambda';
const { renderId, bucketName } = await renderMediaOnLambda({
region: 'us-east-1',
functionName: 'remotion-render-...-lambda',
serveUrl: 'https://your-bucket.s3.amazonaws.com/sites/...',
composition: 'MyVideo',
inputProps: { title, color }, // same props as the Player
codec: 'h264',
framesPerLambda: 100, // parallelization
});
// Poll (or use webhook: onInit/onStart/onProgress/onSuccess callbacks)
const progress = await getRenderProgress({
renderId, bucketName, functionName, region: 'us-east-1',
});
// progress.doneOverall, progress.renderProgress, progress.outputFile
5. Handling the async render job
Don't block the HTTP request — render jobs can take seconds to minutes:
- Kick off the render in your API route, immediately return
{ renderId }to the client. - Poll
getRenderProgressfrom the client every ~1–2s, or better, use the webhook option (webhook: { url }) so Lambda POSTs completion to your endpoint. - Persist job state in your DB:
queued → rendering → done/failed, withoutputFile(S3 URL) when done. - Show progress in the UI (
progress.renderProgressgives 0–1) and present the final MP4 URL whendoneOverallis true.
// webhook handler
app.post('/api/render-webhook', (req, res) => {
if (req.body.status === 'success') {
await db.jobs.update(req.body.renderId, { status: 'done', url: req.body.outputFile });
}
res.sendStatus(200);
});
Key tips
- Same
inputPropseverywhere: validate with the shared Zod schema so the preview and the render always match. - Bundle once, reuse: deploy the site bundle on code change (CI step), not per-request.
- Cost control: set
framesPerLambdaand useoutNameto write directly to your own S3 bucket. - If you'd rather avoid Lambda,
@remotion/cloudrun(Cloud Run) or plain Node rendering (renderMediafrom@remotion/renderer) are alternatives — Lambda is the most common for serverless SaaS.
The docs pages for Player and Lambda rendering cover all the props and lifecycle options in detail.
remotion-saas--m4
Architecture for a Personalized Video Rendering Platform
High-Level Pipeline
Upload → Asset Validation/Storage → Job Queue → Render Workers → Output Storage → Progress Events → Delivery
1. Asset Ingestion & Storage
- Uploads: Presigned URLs to object storage (S3/GCS). Client uploads directly; your API never proxies large files.
- Validation: On upload completion, run a probe job (ffprobe) to extract duration, codec, resolution, sample rate. Store metadata in your DB.
- Normalization: Transcode uploads to a canonical format (e.g., H.264/AAC, normalized loudness for audio via
loudnorm). This makes downstream rendering deterministic. - Fonts: Treat fonts as assets too — store in a versioned bucket, load at render time (or bake into worker images for a known set).
2. Template & Composition Model
Separate template definition from render execution with a declarative spec:
{
"template_id": "birthday_wish",
"version": 3,
"canvas": { "width": 1080, "height": 1920, "fps": 30 },
"tracks": [
{ "type": "image", "asset": "user_image", "fit": "cover", "ken_burns": true },
{ "type": "text", "font": "brand-font-v2", "content": "{{name}}", "position": "center" },
{ "type": "audio", "asset": "user_audio", "mode": "duration_driver" }
],
"duration_policy": { "source": "audio", "min_s": 5, "max_s": 60 }
}
Key points:
- Dynamic duration: The renderer resolves
duration_policyfirst — probe the user's audio, clamp to min/max, then lay out all visual tracks against that resolved timeline. Design animations/transitions to be duration-relative (percent-based keyframes) rather than absolute seconds, so a 12s and 45s render both look intentional. - Multiple templates: Templates are versioned documents. Renditions reference
template_id + versionso old renders are reproducible. A template compiler step converts the JSON spec into a concrete render plan (resolved asset URLs, computed timings, font files) before hitting the worker. - Custom fonts: Bundle fonts per-template; workers mount or fetch them. Ensure the font license permits server-side rendering/embedding.
3. Rendering Engine Choice
| Option | Best for |
|---|---|
| FFmpeg (filter graphs) | Simple overlays, text, image slideshows — cheap, fast |
| Remotion (React → video) | Complex layouts, web fonts, rich animation |
| Headless browser + capture | Pixel-perfect HTML/CSS templates |
| Compositor libs (e.g., editly, moviepy) | Middle ground, Python stacks |
A pragmatic approach: Remotion or FFmpeg for the render core, with your template compiler emitting the input each engine needs. Keep the engine swappable behind a RenderPlan → video file interface.
4. Job Queue & Workers
- Queue: SQS/RabbitMQ/Redis + BullMQ/Celery. One job per video render.
- Job payload: render plan ID (not raw assets) — workers fetch the compiled plan; keeps messages small and lets you re-render.
- Worker pools: Autoscale on queue depth. Each worker is a stateless container with FFmpeg/engine installed. GPU workers only if you need them (most personalized video is CPU-bound and fine on CPU with
libx264presetveryfast). - Concurrency control: Limit renders per worker (FFmpeg is memory-hungry at 1080p+); set per-tenant rate limits and priority tiers (paid users → priority queue).
- Idempotency & retries: Deterministic render plans + idempotency keys so retries are safe. Dead-letter queue for poison jobs; timeout renders (e.g., 10 min) and kill.
5. Progress Updates
Split rendering into reportable stages:
queued → preparing_assets (10%) → rendering (10–90%, frame progress) → encoding (90–97%) → uploading → done
- Workers publish progress to Redis (throttled, e.g., every 2s or 5% change).
- API layer exposes progress via SSE or WebSocket; fall back to polling
GET /renders/{id}. - For frame-level progress: parse FFmpeg's
-progress pipe:1output or Remotion's render progress callback.
6. Output & Delivery
- Render to an intermediate master (high bitrate), then optionally transcode renditions (1080p/720p, platform-specific aspect ratios) as a fan-out step.
- Store outputs in object storage with lifecycle rules; serve via CDN with signed URLs.
- Cache: identical (template version + assets + text params) hashes → reuse existing render.
7. Observability & Cost Control
- Metrics: queue depth, render duration p95, failure rate, worker saturation.
- Structured logs per job with template version and asset IDs for debugging bad renders.
- Preview mode: render a low-res 480p watermarked preview instantly for UX, full render async.
Suggested Stack Summary
- API: Node/Go/Python service, presigned uploads
- Queue: SQS + BullMQ (Node) or Celery (Python)
- Render: Remotion (if JS) or FFmpeg pipelines, in Docker workers on ECS/Fargate/K8s
- State: Postgres (jobs, templates, assets) + Redis (progress, locks)
- Storage/CDN: S3 + CloudFront
Start simple (single worker pool, FFmpeg, polling), and add GPU rendering, multi-region workers, and rendition fan-out only when scale demands it.
Here's a solid architecture for your platform, built around Remotion:
1. Composition layer (templates + dynamic inputs)
Template registry pattern. Each template is a React component conforming to a shared props schema:
type TemplateProps = {
images: { src: string; durationInFrames?: number }[];
audioSrc: string;
captions?: Caption[];
theme: { primaryColor: string };
};
Register templates in a map (templateId → { component, schema, defaults }) so the frontend can render a config form from the schema (Zod) and the renderer can resolve the right component dynamically.
Dynamic duration from audio. Don't hardcode durationInFrames. Measure the audio server-side (or client-side via getAudioDurationInSeconds from @remotion/media-utils) at upload time, store it, and compute:
const fps = 30;
const durationInFrames = Math.ceil(audioDuration * fps) + TAIL_PADDING;
Pass durationInFrames into <Composition> (or use calculateMetadata so the composition derives duration from its own props — this keeps the Player preview and the render consistent):
<Composition
id="Main"
component={MyTemplate}
calculateMetadata={({ props }) => ({
durationInFrames: Math.ceil(props.audioDuration * 30) + 30,
fps: 30,
width: 1080,
height: 1920,
})}
defaultProps={...}
/>
Custom font. Use @remotion/google-fonts if it's a Google font, or @remotion/fonts / staticFile() with font-family declared in a global style loaded in the composition root. For user-uploaded fonts, store the font file per-user in blob storage and load it via delayRender + FontFace API so rendering waits for it.
Assets. Users' images/audio go to S3/GCS. In compositions, always reference via staticFile() locally and pass full URLs (presigned) when rendering on Lambda — keep asset URLs as props, never baked into code.
2. Preview
Embed Remotion <Player> in the editor so users see their personalized video before rendering. Player props = the same props object you'll send to the render API, so preview ≡ output.
3. Rendering pipeline at scale
Recommended: Remotion Lambda — it's built for exactly this (parallel rendering, built-in queue semantics via function concurrency, cheap burst scaling).
Flow:
- API server (Node/Next.js) receives render request → validates props against the template's Zod schema → creates a
render_jobsrow (status:queued). - Worker/queue (SQS, BullMQ, or just Lambda invocation): call
renderMediaOnLambda()withinputProps,composition, and aframesPerLambdatuned for your template complexity. - Progress: Lambda render emits progress via
renderProgresscallback — write it to the job row, and push to clients via WebSocket/SSE or have the client pollGET /renders/:id. Remotion also hasgetRenderProgress()for polling from your API. - Output: rendered MP4 lands in S3 under
renders/{jobId}/out.mp4; store the URL + metadata when done; mark jobcompleted(orfailedwith error logs fromrenderMediaOnLambda's error handling).
If you prefer your own infra, @remotion/renderer (Node.js) on beefy machines behind a job queue (BullMQ + Redis) works too — you get renderMedia() with an onProgress callback — but Lambda is less ops burden for spiky personalization traffic.
4. Key operational details
- Bundle once, render many: build the Remotion bundle (
bundle()) at deploy time and upload to Lambda/S3; don't rebuild per render. - Idempotency + retries: job IDs as idempotency keys; retry failed renders with the same inputProps.
- Concurrency limits: cap Lambda concurrency per account/plan to control cost; use a queue in front.
- Webhooks: notify user systems on completion rather than only polling.
- Caching: hash
inputProps→ skip re-render if identical job already succeeded. - Validation: never trust client props — re-validate server-side, and presign asset URLs with short expiry.
This gives you: template registry + Zod schemas for multi-template support, calculateMetadata for audio-driven duration, font loading inside the composition, and Lambda + job table + progress polling for scale. Want me to sketch the actual code for any piece (e.g., the Lambda render worker or the template registry)?
remotion-saas--m5
Basic Architecture for a "Type Text → Get Animated Video" Web App
High-level flow
SPA (browser) → API server → render worker → storage (video file) → SPA downloads/plays it
The pieces
1. Frontend (your SPA)
- A simple form: name input, message input, submit button.
- On submit, POST the text to your API:
POST /api/videos { name, message }. - The server responds immediately with a job ID (video rendering takes seconds, so don't hold the HTTP request open).
- The SPA then polls
GET /api/videos/:idevery ~1–2 seconds (or uses WebSockets) until the status isdone, then shows a<video>player pointing at the file URL.
2. API server (Node/Express, Fastify, etc.)
Responsibilities:
- Validate input (length limits, sanitization — never trust user text).
- Create a job record:
{ id, name, message, status: "queued", createdAt }in a database (even SQLite or a simple table works to start). - Push the job onto a queue. For a small app you can skip real queue software (RabbitMQ, SQS) and just process in-process or use a library like BullMQ with Redis.
- Serve status endpoints and (later) the finished video.
3. Render worker (the interesting part)
A separate process (or the same server initially) that:
- Picks up a job from the queue.
- Generates the video from the text.
How the video is actually created — common options:
- Headless browser + canvas (easiest in JS): Render your animation in a
<canvas>(or CSS/HTML) inside Puppeteer/Playwright, and capture frames. Libraries likeccapture.jsor frame-by-frame screenshotting + ffmpeg stitch them together. - ffmpeg directly: Generate frames as PNGs (with node-canvas, drawing text with your animation math), then pipe them to ffmpeg to encode an MP4. Very reliable, no browser needed.
- Remotion: A React-based framework built exactly for this — you write the animation as React components, and it renders to MP4 server-side. Strong recommendation for a JS stack.
- Motion Canvas: Similar idea, TypeScript-based animation-to-video tool.
Typical render step:
frames (canvas/PNG sequence) → ffmpeg → H.264 MP4 (10s, ~1280×720, 30fps)
- Uploads the MP4 to object storage (S3, or a local
/videosfolder to start) and updates the job:status: "done", videoUrl: "...".
4. Delivery
- Serve the video via a direct URL (signed S3 URL in production, static file route locally).
- Set proper headers (
Content-Type: video/mp4) and support HTTP Range requests so the browser can stream/seek — most static servers and S3 do this automatically. - The SPA's
<video src={videoUrl} controls>just works.
Minimal version to build first
- Express endpoint that takes
{name, message}. - Render function: node-canvas draws animated text frames → ffmpeg encodes 10s MP4.
- Save file to disk, return the URL.
- Add polling/status + a queue only when renders get slow or concurrent users show up.
Things to plan for early
- Concurrency: rendering is CPU-heavy; one render at a time per worker, queue the rest.
- Timeouts/cleanup: delete old videos, cap job duration.
- Fonts: bundle the fonts you want; text rendering depends on them.
- Input limits: max message length keeps render time predictable.
If you want the fastest path, look at Remotion first — it handles the frame-rendering/encoding pipeline for you and fits a JavaScript stack perfectly.
Here's the basic architecture for this kind of app. The most popular way to build it is with Remotion, a framework for creating videos programmatically in React — so I'll frame the explanation around that, but the architecture applies generally.
The pieces
1. Video template (shared code)
A React component that defines your 10-second animation — text, timing, transitions, music. It takes props like { name, message } instead of hardcoding them. This is just code, not a video file; the video is "rendered" from it frame by frame (e.g., 30 fps × 10 s = 300 frames).
2. Frontend (your SPA)
- A form: name input, message input, submit button.
- Two common options:
- Live preview: embed Remotion's
<Player>component to show the animation instantly in the browser as the user types. No server needed for preview. - Final video: when the user clicks "Download," call your backend to render the real MP4.
- Live preview: embed Remotion's
3. Backend API server
Receives POST /render with { name, message }, then triggers a render. You have a few rendering options:
- Server-side render (Node.js): your API server runs Remotion's renderer (headless Chrome captures frames, ffmpeg encodes them into MP4). Simple, but rendering is CPU-heavy and slow-ish — best with a job queue so the HTTP request doesn't block.
- Lambda render (Remotion Lambda): render distributed across AWS Lambda functions. Fast (often seconds for a 10s video), scales well, pay-per-use. This is the standard choice for SaaS.
- Client-side rendering (WebCodecs): render entirely in the browser — no server render cost, but limited codec/feature support.
4. Delivery
The render writes an MP4 to storage (S3, or a /renders folder served statically). The flow:
- User clicks button → SPA calls
POST /render. - Server kicks off the render and returns a job/render ID immediately (or, for Lambda, this can take just a few seconds and you can await it).
- SPA polls
GET /render/:idor receives a webhook/SSE event when done. - Response includes a URL like
https://cdn.example.com/renders/abc123.mp4; the SPA shows a download link or auto-downloads.
How it fits together
SPA (form + <Player> preview)
│ POST /render {name, message}
▼
API server ──► render job (Node worker or Remotion Lambda)
│ uses the shared video template
▼
MP4 in object storage ──► URL returned to SPA ──► user downloads
Key point: the same template code powers both the in-browser preview and the server render, so what the user sees is exactly what they get. Start simple (Node render + local file serving), and move to Lambda when you need speed or scale.
- Results are for the SkillzBench reference agent on GLM-5.3-flash. Switch models above — a skill can help one model and not another.
- Screen tier (1 trial per arm) is directional. Verified needs a full-tier run (≥ 8 tasks, ≥ 3 trials per arm) with the CI excluding zero.
- Task coverage: 8 generated tasks for this skill's category; a skill can shine elsewhere.