I needed a generated video to remain editable after a customer changed a headline, swapped an image, or asked for a different CTA. The dependable approach is to preserve one validated VideoJSON document, expose only the fields people should touch, then render from that same document. That keeps a template flexible without letting timing, branding, or media assumptions silently drift.
The tempting shortcut is to render the first MP4, let someone request changes in a separate editor, and hope the next version resembles the first. That loses the source of truth immediately. Instead, I treat the template as a small contract: generated data is an input, VideoJSON is the saved working document, an editor is the controlled change surface, and a renderer is the final delivery step.
The boundary that stopped template drift
A video template should not make every property editable merely because the timeline can support it. In a product, I divide fields into three buckets before opening an editor:
| Field type | Example | Who can change it? | Why |
|---|---|---|---|
| Locked structure | scene order, duration budget, required legal frame | developer or template owner | protects the promise the template was designed to make |
| Safe content | product name, price, image URL, CTA, locale | generator and approved user controls | expected variation |
| Guarded creative control | crop, music level, transition choice | user with validation | can improve a result but can also break readability |
That table is deliberately boring. It is also the part that prevents an innocent copy edit from becoming a 19-second product video with a missing CTA. If a field has a visual or compliance consequence, name its owner and validation rule before it gets into the UI.
VideoFlow is useful here because its core compiles an authored flow into portable VideoJSON, and the same document can drive a live preview, browser export, or server render. That is the important architectural detail—not that JSON is fashionable, but that preview, edit, and output are no longer three loosely related representations.
Generate data, then validate a video document
I do not send an LLM or a catalog row straight to an MP4 renderer. It should first produce a narrow input object, then a template function maps that object into the known video shape. The template owner remains responsible for defaults and timing.
import VideoFlow from "@videoflow/core";
type ProductInput = {
title: string;
imageUrl: string;
cta: string;
};
export async function makeDraft(input: ProductInput) {
const $ = new VideoFlow({ name: input.title, width: 1080, height: 1080, fps: 30 });
$.addImage({ fit: "cover" }, { source: input.imageUrl });
$.addText({ text: input.title, fontSize: 7, fontWeight: 800 });
$.wait("2.5s");
$.addText({ text: input.cta, fontSize: 4, fontWeight: 700 });
return $.compile(); // save this VideoJSON before any render
}
In production I would validate title, imageUrl, duration, allowed font sizes, and asset domains around that function. The point is that the generated values fill known slots; they do not invent scene order, arbitrary effects, or a renderer configuration. This is the same principle behind the review gate in my earlier VideoJSON pipeline guide: make a structured draft inspectable before an expensive or irreversible step.
Let customers edit the document, not the output
When a person needs more than a form can offer, give them a constrained editing surface on the saved document. VideoFlow’s React Video Editor takes VideoJSON, offers a multi-track timeline and live preview, and returns changes through callbacks. Persistence remains my job.
import { VideoEditor } from "@videoflow/react-video-editor";
import "@videoflow/react-video-editor/style.css";
export function CustomerVideo({ video, save }: { video: unknown; save: (next: unknown) => Promise<void> }) {
return (
<VideoEditor
video={video}
theme="night"
onChange={(next) => save(next)}
onSave={async (next) => save(next)}
onUpload={async (file) => ({ url: await uploadAsset(file), type: file.type })}
/>
);
}
The component is not a permission system. I still enforce the contract server-side when saving: reject a changed frame rate, missing required layer, disallowed media URL, or a timeline beyond the duration budget. A UI restriction is a usability aid; validation is the actual safety boundary.
My four checks before an export enters a queue
Here is the small receipt I would save beside every render request:
- Source identity: template version, input ID, and a hash or revision of the VideoJSON.
- Structural validity: required scenes and layers exist; duration, resolution, and FPS meet the template rule.
- Asset readiness: every media URL is reachable and allowed by policy.
- Delivery choice: browser export for a user-operated, privacy-sensitive small job; server rendering for queues, batches, and APIs.
VideoFlow’s browser renderer can create an MP4 Blob client-side and supports progress plus cancellation; its server renderer is intended for headless Node jobs and queue-style work. I would choose based on where the job belongs, not based on where the template was authored. The document can stay the same.
That separation also makes failures explainable. If preview looks right but server output is wrong, compare the saved VideoJSON revision and renderer configuration. If a customer change breaks a scene, inspect the rejected validation rule rather than trying to reverse-engineer an MP4.
A practical rollout sequence
Start with one template, one input schema, and one user role. Store the compiled VideoJSON after generation, render a DOM preview, and let a tester change only copy and media. Then add the guarded controls one at a time.
For an example of why I keep a clear source-to-output handoff, see the publishing contract I added to an automation pipeline. The domain is different, but the discipline is the same: a saved contract gives reviewers something concrete to approve and debuggers something concrete to compare.
TL;DR
Keep VideoJSON as the editable source of truth. Generate data into a controlled template, validate every saved revision, expose only intentional edit controls, and render the exact approved revision in the environment that fits the job.
That is enough to make generated video feel flexible to customers without turning every request into a fresh manual timeline. What fields would you lock first in a customer-editable video template?



Top comments (0)