> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.bannerify.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate videos

> Learn how to design a short animated video template and render it as an MP4 with the API.

You can design a short video in the editor and render it as an MP4 with your own text, images, and music. This is useful for reels, stories, product teasers, and social ads, where the motion stays the same and the content changes for each render.

> Video templates are in beta. The editor, the API, and the SDK methods can still change.

## How a video template works

A video template is a template with a timeline. Each top-level layer has a start and an end on the timeline, and up to one animation of each kind:

| Kind | What it does | Presets |
| - | - | - |
| Enter | Brings the layer in at its start | Fade in, Slide in, Slide in up, Slide in down, Scale in, Pop, Rotate in, Flip in X, Flip in Y, Text reveal, Typewriter |
| Exit | Takes the layer out at its end | Fade out, Slide out, Slide out up, Slide out down, Scale out, Rotate out, Flip out X, Flip out Y |
| Ambient | Runs for the whole time the layer shows | Ken Burns, Pulse, Breathe, Float, Drift, Wiggle, Shake, Slow rotate |
| Behavior | Runs once, at a time you choose | Press, Count up |

Text reveal, Typewriter, and Count up are for text layers. Ken Burns is for images and video layers.

A video can also have music, and video layers that play a clip.

## Design a video

1. Click **New template**, then **Blank video**. The editor opens a 1080 by 1920 canvas with a 5-second timeline at 30 fps.
2. Add layers as in an image template: text, images, shapes, and frames. To add a clip, use **Objects → Video**, or drop a video file on the canvas.
3. Drag the bars on the timeline to set when each layer starts and ends.
4. Select a layer and open the **Motion** tab of the right panel. Set its timing, then pick an Enter, Exit, Ambient, or Behavior preset. **Start after** makes a layer start when another layer ends.
5. With no layer selected, the **Motion** tab sets the duration (up to 60 seconds), the frame rate (24, 25, 30, or 60 fps), and the music, with its start and volume.
6. Press play to watch the video.

Video and audio files upload to your workspace assets, up to 50 MB each.

## Render a video

Send a `POST` request to `/v1/templates/renderVideo` with the template id and your modifications:

```bash theme={null}
curl --request POST \
  --url https://api.bannerify.co/v1/templates/renderVideo \
  --header 'Content-Type: application/json' \
  --data '{
    "apiKey": "YOUR_API_KEY",
    "templateId": "tpl_xxx",
    "modifications": [
      { "name": "headline", "text": "Summer sale" },
      { "name": "photo", "src": "https://example.com/image.png" },
      { "name": "music", "src": "https://example.com/song.mp3" }
    ]
  }'
```

The answer comes when the MP4 is ready:

```json theme={null}
{ "url": "https://images.bannerify.co/files/0b3c1c1e-5d6f-4c52-9e0a-8f6a4c0f2a11.mp4" }
```

A modification works as in an image template. In addition:

* A modification with the name of a video layer and a `src` changes the clip of that layer.
* The modification named `music` with a `src` changes the music. The music keeps its start and volume.

## Follow the progress

A render takes longer than an image, and a video can wait in line for a renderer. Add `?stream=true` to get server-sent events while it renders:

```bash theme={null}
curl --no-buffer --request POST \
  --url 'https://api.bannerify.co/v1/templates/renderVideo?stream=true' \
  --header 'Content-Type: application/json' \
  --data '{ "apiKey": "YOUR_API_KEY", "templateId": "tpl_xxx" }'
```

| Event | Fields | When |
| - | - | - |
| `queued` | `ahead` | The video waits for a renderer. `ahead` is the number of videos before it. |
| `progress` | `frame`, `totalFrames`, `progress` | The frames render. `progress` goes from 0 to 1. |
| `done` | `url` | The MP4 is saved. This is the last event. |
| `error` | `error` | The render failed. This is the last event. `error` has `code`, `message`, and `requestId`. |

The SDKs read these events for you. See the [JavaScript](/docs/sdk/js/apis/render-video), [PHP](/docs/sdk/php/apis/render-video), [Go](/docs/sdk/go/apis/render-video), and [Python](/docs/sdk/python/apis/render-video) guides.

## Usage

Each second of video counts as one generation, rounded up. A 5-second video counts 5 generations, and a 7.5-second video counts 8. A render that fails counts nothing.

## Limits

| Limit | Value |
| - | - |
| Output | MP4 (H.264 video, AAC audio) |
| Duration | Up to 60 seconds |
| Frame rate | 24, 25, 30, or 60 fps |
| Uploaded video or audio file | Up to 50 MB |

The sound of a video layer is not in the MP4. Use the music for sound.

## Learn more

* [Render video API reference](/docs/api-reference/endpoint/render-video)
* [Modifications](/docs/essentials/modifications)
* [Template editor](/docs/essentials/template-editor)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.