# Video Elements

> Control video playback, trimming, audio, and looping using dynamic parameters when generating videos.

- **URL**: https://orshot.com/docs/video-generation/video-elements

---

Video element parameters let you control how video content behaves within your template — replace video sources, trim clips, control audio, and enable looping. These work through the same `modifications` system used for text and images.

## Supported Parameters

| Parameter        | Type      | Description                              |
| :--------------- | :-------- | :--------------------------------------- |
| ``           | `string`  | Replace the video URL                    |
| `.trimStart` | `number`  | Start time in seconds                    |
| `.trimEnd`   | `number`  | End time in seconds                      |
| `.muted`     | `boolean` | `true` to mute, `false` to include audio |
| `.loop`      | `boolean` | `true` to loop the video                 |

Where `` is the parameter name of the video element in your template.

## Replacing Video Sources

Pass a new URL to swap the video content:```json
{
  "modifications": {
    "bgVideo": "https://example.com/new-video.mp4"
  },
  "response": {
    "format": "mp4",
    "type": "url"
  }
}
```### Supported Video Formats

- `.mp4` (H.264 recommended)
- `.webm` (VP9)
- `.mov`

## Trimming Video

Extract a specific portion of a video by setting start and end times in seconds:```json
{
  "modifications": {
    "bgVideo": "https://example.com/long-video.mp4",
    "bgVideo.trimStart": 5,
    "bgVideo.trimEnd": 15
  },
  "response": {
    "format": "mp4"
  }
}
```This extracts a 10-second clip from the 5-second mark to the 15-second mark.

### Trim from the Start```json
{
  "modifications": {
    "bgVideo.trimEnd": 10
  }
}
```Takes the first 10 seconds of the video.

### Trim from the End```json
{
  "modifications": {
    "bgVideo.trimStart": 30
  }
}
```Starts from the 30-second mark and plays to the end.

## Audio Control

Mute or include audio from video elements:

### Mute Audio```json
{
  "modifications": {
    "bgVideo": "https://example.com/video-with-audio.mp4",
    "bgVideo.muted": true
  }
}
```Useful when you want to use the video as a visual background with separate voiceover or subtitles.

### Keep Audio```json
{
  "modifications": {
    "bgVideo": "https://example.com/interview.mp4",
    "bgVideo.muted": false
  }
}
```## Looping

Enable looping for short clips that need to fill a longer duration:```json
{
  "modifications": {
    "bgVideo": "https://example.com/short-loop.mp4",
    "bgVideo.loop": true
  }
}
```The video will repeat until the total render duration is reached.

## Multi-Page Video Elements

For multi-page templates rendered as video, control video elements on each page independently:```json
{
  "modifications": {
    "page1@introVideo": "https://example.com/intro.mp4",
    "page1@introVideo.trimEnd": 5,
    "page1@introVideo.muted": true,

    "page2@demoVideo": "https://example.com/demo.mp4",
    "page2@demoVideo.trimStart": 10,
    "page2@demoVideo.trimEnd": 25,
    "page2@demoVideo.muted": false,

    "page3@outroVideo": "https://example.com/outro.mp4",
    "page3@outroVideo.loop": true
  },
  "response": {
    "format": "mp4"
  }
}
```## Combining Parameters

Use all video parameters together for full control:```json
{
  "templateId": "<YOUR_TEMPLATE_ID>",
  "modifications": {
    "bgVideo": "https://example.com/product-demo.mp4",
    "bgVideo.trimStart": 0,
    "bgVideo.trimEnd": 10,
    "bgVideo.muted": false,
    "bgVideo.loop": false,

    "title": "Product Launch",
    "title.fontSize": "48px",
    "title.color": "#ffffff"
  },
  "response": {
    "format": "mp4",
    "type": "url"
  }
}
```## Example: Promo Video with Trimmed Clips```javascript
const response = await fetch("https://api.orshot.com/v1/studio/render", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <YOUR_API_KEY>",
  },
  body: JSON.stringify({
    templateId: "<PROMO_TEMPLATE>",
    modifications: {
      // Background video — trimmed to best 8 seconds
      bgVideo: "https://example.com/raw-footage.mp4",
      "bgVideo.trimStart": 12,
      "bgVideo.trimEnd": 20,
      "bgVideo.muted": true,

      // Overlay content
      headline: "Summer Sale — 50% Off",
      "headline.fontSize": "64px",
      "headline.color": "#ffffff",
      subtext: "Limited time only",
    },
    response: {
      format: "mp4",
      type: "url",
    },
    videoOptions: {
      subtitleSource: "https://example.com/voiceover.mp3",
      subtitleColor: "#ffffff",
      subtitleBackground: "rgba(0,0,0,0.5)",
    },
  }),
});
```## Render Costs

Video rendering costs scale with the duration of the output video. Trimming a video reduces its duration and therefore its render cost — a shorter clip always uses fewer renders than a longer one.

Check your [workspace usage dashboard](https://orshot.com) for current render consumption and limits.