> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.templated.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# "Video Templates: Duration, Animation Timing and Audio"

Templated can render your templates as **MP4 videos**. A video template is a normal template with **animations** on its layers and/or **video layers**. Video rendering is currently in **beta**.

## Create a video template

You create a video template the same way as an image template:

1. Click **Create Template** and pick a size (for example 1080x1920 for Stories, Reels or TikTok).
2. Add your layers: text, images, shapes and videos.
3. Add **animations** to the layers you want to move (see below), and/or add **video layers**.
4. Set the **duration** on the timeline.
5. Save, then render as `mp4`.

The same template can still be rendered as an image (JPG, PNG, WebP) or PDF. Animations only apply to MP4 renders.

## Add animations to a layer

1. Select a layer.
2. Click **Animations** in the toolbar. The Animations panel opens on the left.
3. Choose an animation in each group you need:
   - **In Animations** (entrance): Slide, Fade, Zoom, Rotate.
   - **Loop Animations** (repeating while the layer is visible): Spin, Pulse.
   - **Out Animations** (exit): Slide, Fade, Zoom.
4. Adjust the settings:
   - **Direction**: for Slide (up, down, left, right) and Zoom (in, out).
   - **Duration**: how long the animation takes, in seconds.
   - **Writing style** (text layers): Block, Word or Character, to animate the whole text, word by word or letter by letter.
5. Press **Play** on the timeline to preview.

## Set the video duration

When a template has animations or video layers, a **Timeline** appears at the bottom of the editor.

1. Click **Set duration** next to the time on the timeline.
2. Type the length in seconds (1 to 90).
3. Click **Save**.

Via the API, the `duration` parameter (in milliseconds) sets the length for that render and overrides the template duration. Maximum is 90000 (90 seconds). Default is 5000 (5 seconds).

## Control when each layer appears (delay an animation)

There is no separate "Delay" field. To make a layer (and its entrance animation) start later, change its timing on the timeline:

1. On the timeline, find the bar for the layer.
2. **Drag the start (left edge)** of the bar to the right to make the layer appear later.
3. **Drag the end (right edge)** to the left to make the layer disappear earlier. The exit animation plays at the end.
4. Drag the whole bar to move it in time.

Example: a title enters at 0 s, the subtitle at 1 s, and a button at 2 s. Drag the start of the subtitle bar to 1 s and the button bar to 2 s.

Via the API, use `start` and `end` (in milliseconds) inside the layer's `animation` object.

## Video layers and audio

- Add a video from the **Videos** tab (placeholders and a free gallery), or upload your own in the **Uploads** tab (MP4, WebM, AVI or MOV, up to 100 MB per file).
- Replace a video per render with `video_url` on the video layer.
- Selected video layers have **Video Settings**: Autoplay, Loop, Muted and Show Controls.
- **Audio comes only from video layers.** There is no separate audio or music layer. To add music, use a video file that contains the audio track.
- You can have several video layers, and they can overlap.
- Use **MP4 files encoded with H.264** for the best results. Some other codecs (for example HEVC/H.265 from iPhones) may render as a black frame. Convert them to H.264 MP4 before uploading.

## Render a video

### In the editor
Click **Download**, choose **MP4**, set **Duration** and **Frame Rate (FPS)**, and download. Editor downloads use credits like API renders.

### Via the API

```json
{
  "template": "YOUR_TEMPLATE_ID",
  "format": "mp4",
  "duration": 10000,
  "fps": 30,
  "layers": {
    "title": {
      "text": "Summer Sale",
      "animation": {
        "in": { "type": "slide", "direction": "up", "duration": 500 },
        "loop": { "type": "pulse", "duration": 1000 },
        "out": { "type": "fade", "duration": 500 },
        "start": 1000,
        "end": 9000
      }
    },
    "background-video": { "video_url": "https://example.com/video.mp4" }
  }
}
```

- `format`: `"mp4"`.
- `duration`: milliseconds, maximum 90000.
- `fps`: frames per second, 1 to 60, default 30.
- All times in `animation` are in milliseconds.

Full reference: [Create a render > Video Rendering](https://templated.io/docs/renders/create/).

Video renders take longer than images. For long videos, use `"async": true` with a `webhook_url`.

## Video credits

Video credits depend on size, frame rate and length:

**Credits = (Width x Height x FPS x Duration in seconds) / 50,000,000**, rounded up, minimum 1 credit.

Example: 1920x1080 at 30 FPS for 10 seconds = 12.4, so **13 credits**.

To use fewer credits, lower the FPS (for example 24 or 30 instead of 60), shorten the video, or use a smaller size.

## Limits

- Output format is MP4 only. **GIF output is not available.**
- Maximum duration is 90 seconds.
- Video rendering is in beta. Results may vary with complex templates.
- In the embedded editor, video features must be enabled with the `allow-video=true` URL parameter (beta).

## FAQ

Q: How do I change the length of my video?
A: Click "Set duration" on the timeline at the bottom of the editor, or send `duration` (in milliseconds) in the API.

Q: How do I delay an animation?
A: Drag the start of the layer's bar on the timeline to the right. Via API, set `animation.start` in milliseconds.

Q: Can I add music or a voice-over?
A: Audio is only taken from video layers. Use a video file that contains the audio.

Q: Can I export a GIF?
A: No. Video output is MP4 only.

Q: My uploaded video renders black. Why?
A: The video may use a codec like HEVC (H.265). Convert it to an H.264 MP4 and upload it again.

Q: How many credits does a video use?
A: (Width x Height x FPS x seconds) / 50,000,000, rounded up. A 1080x1920 video at 30 FPS for 15 seconds uses 19 credits.

Q: Why don't I see the timeline?
A: The timeline appears when the template has at least one animation or video layer.