AutomationProjects

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

12 min read

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

React 19Bun (bundler + server)OpenAI GPT-4oHiggsfieldElevenLabsRemotionShot PlanKeyword Sync
Empathize · Define

The problem

Why is a single UGC sales video so slow and expensive, when content needs a lot of testing?

A film crew with cameras, lights and monitors in a studio
The old way — every sales clip needs someone to shoot, someone to light, someone to edit · Photo: Jakob Owens / Unsplash

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?

— The starting brief, before building UGC Studio

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


Ideate

The solution

Let AI be the "director" for the whole line — plan → generate → voice → edit, automated on one page

Source product photo: a black matcha jar on a white backgroundA frame from the generated video: an AI presenter holds the matcha jar in a kitchen, with the keyword "creamy umami from Kyoto" popping up on screen
Left: the uploaded product photo (test product) · Right: a frame from the video the pipeline generated on its own — AI presenter + popping keyword

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


Prototype

How it works — 4 steps

From uploading a product photo to a UGC video ready to post

4 frames from a real output video: opening the lid, scooping the powder, pouring hot water, stirring. Each shot has a keyword in a different color
A real result — the shot plan splits into several shots, each with its own keyword popping up in time with the voiceover
1

Upload & set up

Upload a product photo + choose a presenter + type a brief/script + set size/length

2

AI plans & generates

OpenAI writes the shot plan → Higgsfield generates angle shots, then adds motion to turn them into clips

3

Voice & sync

ElevenLabs records a Thai voiceover + timestamps → keywords are mapped to the moment they are spoken

4

Edit & render

Remotion assembles clips + audio + keywords → .mp4 (submit the job, then poll until done)


Prototype

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

UGC Studio after a run finishes: the vertical video shows in the Output column with a button to open it in Remotion
The real UI after a run — the .mp4 from the pipeline + a button to open Remotion Studio to fine-tune the timing (running on localhost with sample data)
Frontend — React 19 (Bun bundler, no Vite) · 3 columns in the style of NotebookLM
Source Script Editor Output Settings HMR
↕
Bun server (server.ts) — Bun.serve() + async job / poll
/api/generate /api/status /api/script hides .env keys
↕
AI Pipeline (orchestrator + pipeline) — plan → generate → voice → edit
OpenAI GPT-4o Higgsfield CLI ElevenLabs Remotion
↕
Local job files (jobs/ per render) + Remotion render → mp4
shot plan JSON voice.mp3 clip*.mp4 out/*.mp4
Why this stack?

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


Prototype

What I built — 8 core capabilities

The full loop, from planning shots to an .mp4 where keywords pop up on the exact word

The Script column: a brief field for AI drafting, the Thai voiceover script, and a per-second audio timeline
The real Script column — AI drafts from the brief, counts script length against time, and splits the audio timeline into ~3-second segments

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


Prototype

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

UGC Studio in 3 columns: Source with product photo and avatar, Script with voiceover and timeline, Output with settings and the generate button
The real screen in 3 columns — Source · Script · Output (test product photo · the avatar is an AI presenter)
UGC Studio React + Bun · localhost
1 Source
Product photo
Presenter / Avatar
✓ Selected Reference video
2 Script
Script (AI draft · mark keywords)
Let me review this serum. It leaves your skin clear and glowing, absorbs fast and isn't sticky, fades dark spots. Special discount today, order now
3 Output
Size
9:161:116:9
Length · Template
~20 sno-person
Generate Final Product
UGC .mp4 · keyword sync

Test & Iterate

Hacks for the hard parts

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

3 frames from a smartwatch clip: the keywords heart-rate tracking, confidently waterproof, and long battery life pop up in time with the voice
Keyword sync from ElevenLabs timestamps — the text pops up with the sentence being spoken (frames from a test clip)

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

Fix: separate "submit" from "wait for the result" — /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 upload

Higgsfield 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

Fix: the Bun server 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 finishes

Keywords 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

Fix: TTS every line as one chunk, then walk a character pointer over the alignment to find each line's start/end → show the keyword instead of the text; use the real audio length from ffprobe + a tail so a drawn-out last word isn't cut off

External services fail now and then (429 / timeout / unreachable)

Higgsfield is an external service with occasional blips — one failure used to break the entire render

Fix: 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 understand

The 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

Fix: 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 support

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

Fix: v1 deliberately "avoids" it — cut between product shots / hand-holding-product shots (when the product is on screen you can't see a mouth, so lip-sync doesn't matter), rely mainly on voiceover + keywords, and leave "analyzing a real reference" for v2. Lesson: cut the riskiest part first and prove the whole chain actually works

Define

Design decisions I made on purpose

What I deliberately "didn't build" in the first round matters as much as what I did

4 frames of hand-and-product shots, no faces, with keywords
Avoiding lip-sync in v1 — cutting to hand/product shots with no visible mouth, and letting the voiceover + keywords tell the story

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


Level Up · Reflect

Knowledge domains that got stronger

5 areas where my skills actually moved up from this project

A video editing timeline on screen
What used to be manual work in an editing timeline moved into code (Remotion) · Photo: Peter Stumpf / Unsplash
1. AI Orchestration — chaining a multi-model pipeline into one line:

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

2. Bun full-stack runtime — server + bundler in one:

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

3. Media pipeline & timestamp sync — video/audio aren't black boxes:

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

4. Async job architecture — long jobs HTTP can't hold:

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

5. Model selection & prompt engineering in real work:

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

5
Steps in the AI pipeline — plan→image→clip→audio→edit
3
Columns on one page (Source · Script · Output)
3
Output templates (avatar / full / no-person)
0
API keys leaked to the browser

Tan · Natpakan Sirirat

Product Designer & AI Builder — designing user experiences and building AI tools that actually work.

0%