# Video

- **URL**: /documentation/key-concepts/video

A template can be a video. Every page becomes a scene, each element animates in and out on its own timing, and pages are joined by transitions. Add video clips, a voiceover, music and captions, then download it as `mp4`, `webm` or `gif` — from the studio, the API, an MCP client or the embedded editor.

The studio's playback and the server's renderer share one timing module, so what plays in the editor is what the file contains. There is no separate video mode: any design with more than one page, or with animation on its single page, can be exported as video.

## Animating a design

Select an element and open the **Animate** tab. Press **Preview Animation** to play just that element, or ▶ above the page to play the whole design from the open page. Playback uses its own canvas, so it never moves an element or changes what is saved.

### Enter and exit

Every element has an enter animation (starting at **Show At**) and an exit animation (starting at **Hide At**). Before Show At the element is hidden. With an exit animation and no Hide At, the element leaves so that it is gone exactly when its page ends.

- **Kinds** — fade, slide left / right / up / down, scale, scale up, scale down, rotate, flip horizontal, flip vertical, zoom and blur.
- **Duration and easing** — linear, ease in, ease out, ease in-out, elastic and back (overshoots, then settles).
- **Reverse** — plays the animation in the opposite direction.

![The studio's Animate tab for a selected photo, showing Show At and Hide At, the enter animation kinds, reverse, duration and easing](https://buildonce.app/images/docs/video-animate-tab.png)

*The Animate tab — pick an enter animation, set when the element appears, and press Preview Animation.*

### Text animation

Text layers can also reveal themselves as a `typewriter`, or by `letters`, `words` or `lines`, with a reveal duration of 0.2–20 s.

### Ambient motion

A gentle movement that runs the whole time an element is on screen, on top of its enter and exit: Ken Burns, pulse, float, drift, wiggle, shake, slow rotate, breathe, bounce and blink. Set a speed (0.25–4×) and strength (0–3×). Ken Burns can also zoom out or pan left, right, up or down. Motion is deterministic — frame N is identical on every machine and every render.

### Diagram effects

For diagrams and explainers: **Flow** sends dots or marching dashes along a connector (looping or once), **Highlight** lights an element with a glowing border at a chosen time, and **Pop** gives it a quick scale bump with a sparkle.

## Pages, timing and transitions

Open the ⏱ button beside the page to set its timing:

- **Duration** — 0.5–60 s on screen. Left blank, the page is *auto*: long enough for its animations plus a 1 s hold, and never shorter than 3 s.
- **Transition to next** — a cut (none), fade, slide left, slide right, wipe or zoom, up to 3 s. It overlaps the end of this page and the start of the next, and is capped at half of either page.

> The whole video — all pages added up — can be at most **60 seconds**. A longer design is refused with `422 VIDEO_TOO_LONG`; shorten page durations or render fewer pages.

## Video clips

The **Video & audio** tab uploads MP4 and WebM clips up to 50 MB, and lists the ones already in your library. Click a clip to place it on the page as a playable layer. With the layer selected you can set:

- Trim start and trim end
- Playback speed
- Volume, mute and loop

A clip's own sound is mixed into the exported video together with any voiceover and music tracks — mute the layer to leave it out.

![The studio's Video & audio panel, with Video and Audio tabs, an Upload / Stock switch and a drop zone for a video clip](https://buildonce.app/images/docs/video-audio-panel.png)

*The Video & audio panel — upload a clip or pick stock video; the Audio tab holds voiceover and music.*

A clip may show &ldquo;Processing…&rdquo; for a moment after upload while its poster and preview are prepared; it clears on its own. A clip can also be a template variable of type `video`, so each render swaps in a different one — see [Template anatomy](https://buildonce.app/documentation/key-concepts/template-anatomy).

## AI-generated clips

Instead of uploading a clip, you can have one generated from a photo. In **Video & audio → Video**, open the **AI** section:

1. Pick a starting photo. It is optional — with no photo the clip is made from the prompt alone.
2. Choose a preset or write your own prompt. **Improve my prompt** rewrites it for you (1 AI credit).
3. Choose a tier (Standard or Premium) and a length (5 or 10 seconds). The AI-credit cost is shown before you generate.
4. Press **Generate**. A clip can take a few minutes. Once it exists the button becomes **Redo this shot**.

Prices are 23 (Standard) or 55 (Premium) AI credits per 5 seconds, double for 10. An identical request (same photo, prompt, preset, tier and length) is free and returns the same clip, a failed or blocked generation is refunded, and the feature needs a plan that includes AI video.

### Regenerating on every render

Switch on **Use the product photo each time** and name an image variable (for example `productPhoto`). The clip is then bound to that photo: a render that passes a new photo regenerates the clip with the same preset, tier and length. This is how one template produces a different video per product.

- **Only changed clips are regenerated.** If the photo, prompt, tier and length match the clip already in the design, it is reused at no cost.
- **Rendering waits for the clips.** A render that needs fresh clips is answered with `202` straight away — for an image or PDF too — and the file is made once the clips are ready.
- **Two separate pools.** The clips use AI credits; the render itself uses render credits. If you cannot afford the clips, the call is refused up front with `402 INSUFFICIENT_AI_CREDITS` and nothing is queued.
- **A clip that fails is not fatal.** If a generation fails, is blocked or takes too long (about 10 minutes), the render uses the source photo in its place — with a slow zoom — and the clip's AI credits are refunded.

A finished render reports what happened to each AI clip in its `slots` list: one entry per clip with the variable name, a status of `generated`, `reused` or `fallback`, and the AI credits charged and refunded. A template with no AI clips has no `slots` field.

## Voiceover, music and captions

Audio belongs to the design, not to a page: a voiceover or music clip plays across the whole video. A design holds up to **4 audio tracks**, each a `voice` or `music` role, with trim, volume, fade in / fade out and loop.

### Voiceover

1. In **Page settings**, write a script for each page — or press **Write script** and let AI draft the line from a short description. The text stays editable.
2. In the Audio tab, pick a voice (with a sample to preview) and a quality, *Flash* or *Final*, then press **Generate voiceover**. This builds one voice track for the whole design and replaces any earlier one.
3. Press **Fit page lengths to the voice** to stretch each scripted page to match its sentence.

Generating a voiceover costs 2 AI credits per started 10 seconds of voice — see [Credits](https://buildonce.app/documentation/key-concepts/credits).

### Music

Upload your own audio, or search the music library by title and import a track. Music ducks under the voice by default — it fades down while someone is speaking and back up afterwards.

### Captions

Once a voice track exists, turn on word-by-word captions — no extra generation step and no extra cost, since they are timed from the voice itself.

- **Style** — `karaoke` (the spoken word is highlighted), `pop` (it scales up as spoken) or `boxed` (a rounded box sits behind it).
- **Position** — auto, top, center or bottom. Auto keeps captions clear of the TikTok / Reels / Shorts buttons on a 9:16 design.
- **Font and colors** — caption font, text color and highlight color.

## Exporting a video

### From the studio

1. Open **Download** and choose **MP4**, **WebM** or **GIF** under *Video*.
2. Pick frames per second, size (0.5×, 1× or 2×) and, for MP4 / WebM, quality (small, standard or high). The dialog shows the length, output size and credit cost before anything is charged.
3. Confirm. Pending edits are saved first, because the server renders the saved draft, not the canvas.

![The studio's Download menu, listing PNG, JPG, PDF and JSON, and under Video the MP4, WebM and GIF options](https://buildonce.app/images/docs/video-download-menu.png)

*The Download menu — the Video section renders on the server, from the saved design.*

Closing the dialog mid-render is safe: the render keeps going, and the finished file is listed under **Renders**. The export is disabled, with the reason shown, for a single still page, a design over 60 s, or when you have too few credits.

### From code

Send `format: "mp4"` (or `webm`, `gif`) with optional `video.fps`, `video.scale` and `video.quality` to [POST /v1/templates/:id/render](https://buildonce.app/documentation/api-reference/render). A video is always asynchronous: you get `202` and poll [GET /v1/renders/:renderId](https://buildonce.app/documentation/api-reference/renders#get) until it finishes. MCP clients use the same options through `render_template`, and the [embedded studio](https://buildonce.app/documentation/embed) offers the same Download menu to your users.

## Formats, limits and pricing

- **MP4** — plays everywhere; the smallest file. **WebM** — for the web. Both include sound. Frame rate is 1–60 fps through the API and MCP (default 30); the studio offers 24, 30 and 60.
- **GIF** — no sound, at most 15 fps (default 15; the studio offers 15 or 10) and 720 px on the longest side.
- **Size** — 0.5×, 1× or 2× the design's size; 2× stops at 2160 px on the longest side.
- **Length** — 60 s at most.
- **Price** — 1 credit per started second, at every size and quality.

Errors specific to video:

- `400 INVALID_VIDEO_OPTIONS` — fps, scale or quality out of range.
- `422 VIDEO_TOO_LONG` — the design runs over 60 s.
- `503 VIDEO_ENCODER_UNAVAILABLE` — nothing was charged; retry the request.
