UGC Studio — an AI director for UGC videos
An internal tool that turns a product photo and a short brief into a vertical UGC sales video. AI acts as the director, from planning shots, writing the Thai script, generating footage and recording the voiceover to editing with keyword sync into an .mp4 ready to post. Built with React 19 + Bun + Remotion, chaining several AIs in one pipeline

An internal tool that turns a product photo and a short brief into a vertical UGC video ready to post. AI plays the "director": it plans the shots, writes the Thai script, generates footage, records the voiceover, then edits so each keyword pops up right as it is spoken, automated end to end
The problem
Why is a single UGC sales video so slow and expensive, when content needs a lot of testing?

The team wanted many UGC sales videos to test content with, but every clip meant hiring a shoot and an editor, and each one took days. Production could never keep up with how many versions we wanted to try. The question: with only a "product photo" and a "short description", can we get a video ready to post in a few minutes?
Slow and expensive — a shoot and an edit for every clip
Every sales video needs someone to shoot and someone to edit. One clip costs time and budget, and testing several content versions makes it even less worth it
The script has to finish right on time
A vertical clip has to end in about 15–30 seconds. Writing a script that fits exactly, with no overrun and no dead air, takes many rounds of trial and error
Keywords have to pop up as they are spoken
A good UGC video shows key words on screen "on the exact word" the presenter says. Syncing that by hand in an editor, one clip at a time, takes a long time
The AI tools don't talk to each other
Images are generated in one place, voiceover in another, editing in a third. Each output has to be stitched together by hand, which is slow and error-prone
Calling AI straight from the browser leaks the keys
If the web page calls OpenAI / ElevenLabs directly, the API keys show up in the network tab. Even for an internal tool, that is not acceptable
The solution
Let AI be the "director" for the whole line — plan → generate → voice → edit, automated on one page


An AI Director writes the "shot plan"
OpenAI breaks the brief into a JSON shot plan. Each shot defines its type (close-up / angle / presenter), duration, voiceover line and the keyword that pops up, and the schema is validated so nothing drifts
A Thai script that fits the time
It calculates character count per second (spoken Thai is about 8 characters per second) so the AI writes lines that "finish right on time" for the set length, with no overrun and no dead air
Automatic keyword sync from timestamps
ElevenLabs returns a timestamp for "every character". A pointer walks the alignment to find the second each sentence starts and ends, so each keyword pops up exactly on beat
Four AIs chained into one line
OpenAI → Higgsfield → ElevenLabs → Remotion run back to back as one pipeline. Upload a photo, press Generate once, and get an .mp4, with no manual stitching
A Bun server keeps the keys on the backend
Every API call goes through a Bun server that reads keys from .env, so the browser never sees a key. The server also runs the Higgsfield CLI and Remotion, which the browser can't do on its own
How it works — 4 steps
From uploading a product photo to a UGC video ready to post

Upload & set up
Upload a product photo + choose a presenter + type a brief/script + set size/length
AI plans & generates
OpenAI writes the shot plan → Higgsfield generates angle shots, then adds motion to turn them into clips
Voice & sync
ElevenLabs records a Thai voiceover + timestamps → keywords are mapped to the moment they are spoken
Edit & render
Remotion assembles clips + audio + keywords → .mp4 (submit the job, then poll until done)
Tech Stack & Architecture
One page on localhost — React on the Bun bundler (no Vite) + a Bun server that hides the keys and drives the AI pipeline

React + Bun bundler — I wanted components without installing Vite/Next; Bun ships bundling + HMR + CSS built in, and one command runs both frontend and backend · A single Bun.serve() serves both the frontend and the API, so fewer moving parts · async job + poll because generation takes minutes, and holding an HTTP request open gets cut by the idle timeout first · Higgsfield CLI + Remotion render can't run in a browser, so a server has to shell out for them · Keys live in .env on the backend and never reach the browser
What I built — 8 core capabilities
The full loop, from planning shots to an .mp4 where keywords pop up on the exact word

AI Director (Shot Plan)
OpenAI plans shots as JSON (type/duration/line/keyword) + validatePlan() guards against schema drift and keeps the total length equal to the sum of the shots
Thai Script Writer
draftFullScript() calculates characters per second so the AI drafts a Thai script that finishes right on time — clip length auto-syncs to the typed script
Angle Image Gen
Higgsfield nano_banana_2 generates multiple angles from a single product photo — with a prompt per shot type (close-up / flat-lay / hand holding the product)
Image → Video (i2v)
seedance1_5 adds motion to turn angle shots into short clips — the motion prompt keeps movement subtle so the image doesn't morph out of shape
Voice + Char Timestamp
ElevenLabs eleven_v3 records the Thai voiceover + returns a timestamp for every character (with-timestamps) — the key to keyword sync
Keyword Sync Compositor
Remotion cuts between shots along the timeline + pops keywords on screen while that sentence is spoken, with an opening hook and sfx
3 Output Templates
avatar (single-shot lip-sync presenter) / full / no-person + choice of aspect ratio 9:16 · 1:1 · 16:9 and resolution
Async Job + Poll
Submitting a job returns a jobId right away, then the client polls status every 5 seconds until the mp4 is ready — and errors from external services are translated into messages users can understand
The UI — a 3-column studio
One page in the style of NotebookLM — left: upload photos/pick a presenter · middle: control the script + mark keywords · right: settings + Generate

Hacks for the hard parts
6 problems I had to work out myself — chaining several AIs + managing long jobs on unstable external services

Generation takes minutes — one HTTP request can't hold it
Generating a full video takes several minutes. Holding a connection open for the result always gets cut by the idle timeout first
/api/generate returns a jobId right away and keeps status in an in-memory map, the client polls /api/status every 5 seconds; a high idleTimeout is set only for the photo uploadHiggsfield CLI + Remotion render can't run in a browser
Generating footage and rendering need CLI calls / spawned processes — things a web page can't do at all
spawns the CLI + bunx remotion render, and pre-warms Remotion Studio (on a fixed port) so the Edit button can open a tab right after the render finishesKeywords have to pop up "on the exact word" being spoken
Knowing the text isn't enough — you need the second each sentence starts and ends in the real audio
ffprobe + a tail so a drawn-out last word isn't cut offExternal services fail now and then (429 / timeout / unreachable)
Higgsfield is an external service with occasional blips — one failure used to break the entire render
withRetry() with 3-step backoff wraps every external call + shots are generated in parallel with Promise.all (angle images + audio at the same time) + raw errors are translated into plain Thai messages users can understandThe model mispronounces some Thai words
English brand names and drawn-out words come out wrong in TTS — it sounds unnatural and undermines the clip's credibility
fixThaiPron() corrects pronunciation in the script before voicing (timing is calculated from the corrected text, so characters always match the alignment) + choosing eleven_v3, the model with the best Thai supportLip-sync is the hardest and riskiest part
Getting the presenter's mouth to match the audio exactly for the whole clip is a fragile bet that eats a lot of generation budget
Design decisions I made on purpose
What I deliberately "didn't build" in the first round matters as much as what I did

I scoped this tool small on purpose for v1. The goal was to prove the whole chain (photo → video → audio → edit) works from a real product photo first. It doesn't analyze references in depth yet and doesn't do full lip-sync, because a pipeline that connects end to end and outputs a real .mp4 is worth more than betting on the hardest part in round one
AI as director, not just a form
OpenAI writes the shot plan, then dispatches the resources
Avoid lip-sync in v1
Cut to product shots instead — rely on voice + keywords
Keys stay on the backend
Never call AI straight from the browser — always through the server
No Vite / Next
Bun's built-in bundler means fewer dependencies to maintain
Knowledge domains that got stronger
5 areas where my skills actually moved up from this project

Learned to chain LLM + image gen + i2v + voice + render across several models, use AI to write the "plan" (shot plan) and let a code loop dispatch the resources, validate AI output with a schema so it doesn't drift, and run jobs in parallel with Promise.all. Lesson: getting models to "talk to each other" through data you control is the core of an AI product
Used Bun.serve() to serve both the React frontend (bundle + HMR) and a REST API, spawn CLIs/subprocesses from the server, and handle multipart uploads — without relying on Vite/Next. Lesson: Bun makes a full-stack POC much lighter, with fewer moving parts to configure
Understood char-level alignment from TTS → turning it into caption timing, used ffprobe/ffmpeg to get the real audio length, and assembled the timeline with Remotion (a code-based compositor). Lesson: audio and video are "data you can sync" once you know timestamps and the assembly tools
Designed submit-then-poll: return a jobId right away, keep status on the server, the client polls until done, with retry/backoff for unstable external services, and raw errors translated into messages users understand. Lesson: long-running work has to separate "accepting the job" from "delivering the result" from the design stage
Practiced matching models to the job (GPT-4o as director, eleven_v3 for Thai, nano_banana for angle shots, seedance for i2v) and understanding each one's limits (e.g. Thai TTS can't stress individual words via SSML → moved the emphasis to caption highlights instead). Lesson: every model has its strengths and quirks; you have to know how to pick and design workarounds
