Contents
What to cover
Sketch your own design first. A complete answer has these parts; the notes say what each should settle.
- Requirementsvideo length distribution; concurrency at peak; preview vs final quality; languages; custom avatar onboarding; enterprise compliance; cost targets
- Estimates
- API
- Data model
- Architectureeditor; script services (LLM drafting/translation, moderation); TTS per scene; lip-sync/motion generation per segment; render/composite workers; storage/CDN; job orchestration (DAG per video, segment-level parallelism, retries, caching unchanged scenes); progress notifications; consent/identity verification for custom avatars; provenance/watermark; QA checks (sync score, artefact detection)
- Deep divesuser edits one sentence — what re-renders?; How do you schedule GPU work fairly between tenants?; How is a harmful script caught?
- Trade-offssegment granularity vs consistency at boundaries; preview fidelity vs cost; GPU pool sizing vs queue time; re-render only changed scenes vs full re-render
- Evaluationasynchronous DAG design with incremental re-rendering; explicit cost per rendered minute; moderation and consent; quality checks before delivery
Reference design
One way to answer it, part by part. Open a part once you have your own version of it.
Requirements
Functional: an editor where users write or generate a script split into scenes, pick an avatar, voice, language, background and layout, preview within seconds, and render a final video within minutes; translate an existing video into other languages; onboard custom avatars of real employees.
Assumptions to confirm
- Video length distribution: median 3 minutes, p90 10 minutes, cap 30 minutes; training and internal-comms videos dominate.
- Peak concurrency: ~20k final renders/day, business-hours peak 3× the average; previews ~10× as frequent as renders.
- Preview vs final: preview starts playing in < 5 s at 360p with real audio and approximate lip-sync; final 1080p in < 10 minutes for a 5-minute video at p95.
- Languages: 100+ TTS languages, script translation by LLM with human-editable output.
- Custom avatars: footage capture (studio or webcam), explicit consent video from the person, identity check, training job measured in hours.
- Enterprise compliance: SSO/SCIM, roles, audit logs, EU data residency option, SOC 2 / ISO 27001, retention controls, no training on customer scripts without opt-in.
- Cost target: compute well under $0.20 per rendered minute so plan prices carry healthy margins.
- Safety: no harmful content, no avatar saying things its owner did not authorise, visible provenance.
Estimates
CalculatorDaily render estimates
- Rendered minutes per day
- 80,000 min/day
- GPU-minutes per day
- 160,000 GPU-min/day
- Storage per day
- 3 TB/day
Rendered minutes per day = Videos per day (thousands) × 1000 × Avg minutes per video = 80,000 min/day
GPU-minutes per day = Rendered minutes per day × GPU-min per minute = 160,000 GPU-min/day
Storage per day = Rendered minutes per day × Storage per minute ÷ 1000000 = 3 TB/day
| Case | Videos per day (thousands) (k) | Avg minutes per video (min) | GPU-min per minute (GPU-min/min) | Storage per minute (MB/min) | Rendered minutes per day | GPU-minutes per day | Storage per day |
|---|---|---|---|---|---|---|---|
| Reference day | 20 | 4 | 2 | 37.5 | 80,000 min/day | 160,000 GPU-min/day | 3 TB/day |
- Rendered minutes: 20k videos × 4 min average = 80k rendered minutes/day.
- Neural rendering: assume one GPU renders 1 minute of 1080p avatar video in 2 minutes. 80k × 2 = 160k GPU-minutes ≈ 2,670 GPU-hours/day ≈ 111 GPUs on average; a 3× business-hours peak needs ~330 without smoothing, ~200 with deadline-aware queueing that pushes bulk API jobs overnight.
- Cost: 2,670 GPU-hours × an assumed ~$2/GPU-hour (L40S-class) ≈ $5.3k/day ÷ 80k min ≈ $0.067/min; TTS, compositing and encoding add ~$0.02 → ~$0.09 per rendered minute.
- Final render latency: a 5-minute video is ~60 segments of 5 s; each takes ~10 s of GPU time, so with 30 GPUs in parallel generation finishes in ~20–40 s, plus compositing and encoding ~30 s → ~1–2 minutes when capacity is available; queue wait is the real variable.
- Previews: ~200k/day, rendered at 360p and only for the scene being edited; roughly a tenth of the GPU cost per second of a final.
- Storage: 1080p at ~5 Mbps ≈ 37.5 MB/min × 80k ≈ 3 TB/day, ~90 TB/month; intermediate segment artefacts kept 30 days for incremental re-renders, finals tiered to cold storage after 90 days.
API
POST /v1/videos {title, scenes: [{script, avatar_id, voice_id, language, background, layout, assets[]}]}
→ {video_id, version}
PATCH /v1/videos/{id}/scenes/{scene_id} {script?, avatar_id?, ...} → {version}
POST /v1/videos/{id}/preview {scene_id} → {hls_url} (segments appear as they render)
POST /v1/videos/{id}/render {version, resolution: "1080p", priority?}
→ {render_id}
GET /v1/renders/{render_id} → {status, progress: {scenes_done, segments_done, eta_s}, download_url}
POST /v1/videos/{id}/translate {target_languages: [...]} → new video versions per language
POST /v1/avatars {footage_upload_ids, consent_video_id} → {avatar_id, status: "verifying"}
Webhooks / WebSocket events: render.progress, render.completed, render.failed, moderation.blocked
Renders reference an immutable video version, so edits during a render never corrupt it.
Data model
- Workspace: plan, quotas, region, retention policy, SSO settings.
- Video: id, workspace, current version; VideoVersion (immutable): ordered scene ids, settings.
- Scene: id, script, avatar_id, voice_id, language, background, layout, assets, script hash, moderation status.
- Segment (sentence-level unit of work): scene_id, index, text, content key = hash(text, voice, avatar, model versions, prosody context), audio URI, phoneme/viseme timings, visual URI, status.
- RenderJob: version, DAG of tasks with states, priority class, tenant, timings, cost.
- Avatar: id, owner, type (stock | custom), consent record, identity verification, model artefacts, allowed-use policy, status.
- ModerationDecision: object (script/scene/upload), categories, scores, decision, reviewer, policy version.
- ProvenanceManifest: render id, C2PA manifest, watermark id.
Postgres for metadata, object storage plus CDN for media, Redis for progress, the orchestrator’s own store for DAG state.
Architecture
Flow · 5 stepsScript-to-avatar render path
- Edit A user writes or generates a script in the editor; the API passes it to the script service.
- Gate The script service drafts or translates and moderates, then hands one DAG per render to the orchestrator.
- Render The orchestrator schedules per-scene TTS and per-segment lip-sync and motion on the GPU pool.
- Deliver Composited, encoded and QA-checked video is watermarked and stored, then served via CDN.
- Notify Task events flow to Redis and out as WebSocket/webhooks.
Data
| Step | Title | What happens |
|---|---|---|
| 1 | Edit | A user writes or generates a script in the editor; the API passes it to the script service. |
| 2 | Gate | The script service drafts or translates and moderates, then hands one DAG per render to the orchestrator. |
| 3 | Render | The orchestrator schedules per-scene TTS and per-segment lip-sync and motion on the GPU pool. |
| 4 | Deliver | Composited, encoded and QA-checked video is watermarked and stored, then served via CDN. |
| 5 | Notify | Task events flow to Redis and out as WebSocket/webhooks. |
Source: This page's text
| Box | Group | Detail |
|---|---|---|
| Editor | Input | web |
| API | Input | v1 |
| Script service | Input | LLM drafting/translation, moderation |
| Orchestrator | Compute | Temporal, one DAG per render |
| TTS / lip-sync / motion | Compute | GPU pool |
| Object storage + CDN | Delivery | finals tiered after 90 days |
| Progress events | Delivery | Redis, WebSocket/webhooks |
Source: This page's text
Editor (web) ─► API ─► Script service: LLM drafting/translation, moderation gate
─► Orchestrator (Temporal): one DAG per render
per scene: TTS ─► forced alignment (phonemes/visemes) ─► split into sentence segments
per segment: cache lookup by content key ─► lip-sync + motion generation (GPU pool)
per scene: compositing (background, avatar matte, slides, captions, transitions)
per video: concatenate at segment-aligned keyframes ─► encode (NVENC)
─► QA checks (sync score, artefact detector, loudness) ─► watermark + C2PA
─► object storage ─► CDN
Scheduler: weighted fair queues per tenant, priority: previews > finals > bulk API
Progress: task events ─► Redis ─► WebSocket/webhooks/email
Custom avatar onboarding: consent video + identity check ─► training pipeline
─► avatar QA (lip-sync, artefacts, likeness) ─► avatar registry
Every step’s output is content-addressed, which gives incremental re-rendering, resumability and cheap retries for free.
Deep dives
Flow · 5 stepsOne-sentence edit re-renders only changed segments
- Edit The user edits one sentence; the API patches the scene and starts the DAG.
- Cache lookup The orchestrator checks the content key; unchanged segments keep their audio.
- Changed segment The edited sentence gets new TTS; lip-sync and motion run for the changed segment plus blend frames.
- Recomposite and re-encode The scene is recomposited and only the affected group of pictures is re-encoded and spliced.
- Deliver The updated video is stored and served through the CDN.
Data
| Step | Title | What happens |
|---|---|---|
| 1 | Edit | The user edits one sentence; the API patches the scene and starts the DAG. |
| 2 | Cache lookup | The orchestrator checks the content key; unchanged segments keep their audio. |
| 3 | Changed segment | The edited sentence gets new TTS; lip-sync and motion run for the changed segment plus blend frames. |
| 4 | Recomposite and re-encode | The scene is recomposited and only the affected group of pictures is re-encoded and spliced. |
| 5 | Deliver | The updated video is stored and served through the CDN. |
Source: This page's text
| Box | Group | Detail |
|---|---|---|
| Editor | Input | user edits one sentence |
| API | Input | PATCH scene |
| Orchestrator | Compute | one DAG per render |
| Content-key cache | Memory | hash(text, voice, avatar, model versions) |
| TTS | Compute | edited sentence |
| Lip-sync + motion | Compute | changed segment + blend frames |
| Scene compositing | Compute | background, avatar matte, captions |
| Re-encode affected GOP | Compute | splice into video |
| Object storage + CDN | Output | final video |
Source: This page's text
A user edits one sentence — what re-renders? Only segments whose content key changed. The edited sentence gets new TTS; its neighbours keep their audio, with a short crossfade (if prosody across the boundary sounds wrong, regenerate one neighbour with context). Lip-sync and motion run for the changed segment plus a few blend frames at each boundary, conditioned on the previous segment’s last frames. That scene is recomposited (cheap), and only the affected group of pictures is re-encoded and spliced. A one-sentence edit costs seconds of GPU time instead of the whole video.
Fair GPU scheduling between tenants. Weighted fair queuing (deficit round robin) across tenants, weights by plan, inside priority classes: interactive previews, then paid finals, then bulk API jobs. Per-tenant concurrency caps stop one customer’s 500-video batch from starving others. Segments are short (~5 s of video), so work naturally yields between them without preemption. Deadline-aware ordering lets bulk jobs run overnight; autoscale on queue wait time per class.
Catching a harmful script. Moderate at save and again at render request: fast classifiers for hate, harassment, sexual content, scams, medical and financial claims, elections and impersonation; an LLM second stage for ambiguous cases; human review before render for high-risk categories. Custom avatars of real people carry an allowed-use policy. After rendering, ASR on the output must match the approved script, catching tricks hidden in phonetic spelling. Decisions are logged; repeat offenders lose access.
Trade-offs
- Segment granularity vs boundary consistency: sentence segments give parallelism and cache hits, but head pose and expression can jump at boundaries; overlap and condition on prior frames, and render whole scenes when a customer flags a seam.
- Preview fidelity vs cost: low-resolution, scene-only previews with the real voice are good enough to judge script and timing; full-quality previews would roughly double GPU spend.
- GPU pool sizing vs queue time: sizing for peak wastes capacity off-hours; a smaller pool plus deadline-aware scheduling, spot capacity for bulk jobs and an honest ETA in the UI is cheaper.
- Re-render changed scenes vs full re-render: incremental re-rendering saves most of the compute on small edits but risks subtle drift; force a full render when model versions change or the customer requests it.
Evaluation
- Asynchronous DAG with incremental re-rendering: measure cache hit rate on re-renders and GPU-seconds per edit.
- Cost: GPU cost per rendered minute tracked daily against the ~$0.09 estimate, split by preview, final and translation.
- Latency: time to first preview frame p95, render time per output minute p95, queue wait per priority class and tenant.
- Quality checks before delivery: lip-sync confidence and audio-visual offset per segment, face-artefact and flicker detectors, loudness and clipping, ASR character error rate of the audio; failures auto re-render once, then go to human QA.
- Model releases: blind side-by-side human preference tests on a fixed script set across languages and avatars before rollout.
- Moderation and consent: precision and recall on a labelled script set, review turnaround, 100% of custom avatars with verified consent, appeal outcomes.
- Online: re-render rate as a dissatisfaction proxy, export and share rates, support tickets about artefacts.
What a strong design shows
- Models the render as an asynchronous, content-addressed DAG so one-sentence edits re-render seconds, not minutes.
- Puts a number on cost per rendered minute and on GPU fleet size, and separates cheap previews from finals.
- Schedules GPUs fairly across tenants with priority classes and caps, using short segments as natural yield points.
- Treats consent for custom avatars, script moderation and provenance as product requirements.
- Runs automated quality checks before delivery rather than relying on users to report artefacts.