> For the complete documentation index, see [llms.txt](https://docs.scaleflex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scaleflex.com/dynamic-media-optimization-dmo/transformations/video-optimization/on-the-fly-video-optimization.md).

# On-the-fly-video optimization

{% hint style="warning" %}
Please contact the support team to activate the video feature for your token.
{% endhint %}

DAM offers on-the-fly video processing with delivery via CDN using the DAM URL for seamless integration. This feature is suited for short clips for websites and web applications such as hero videos or product videos.&#x20;

Input files are limited to 500 MB and compressed videos are limited to 4k resolution and duration of no more than 1 minute. If your videos exceed those limits, your use case probably does not fall into the scope of this feature and you should consider using [Video optimization](/dynamic-media-optimization-dmo/transformations/video-optimization.md) and [Video API](/dynamic-media-optimization-dmo/transformations/video-optimization/video-api.md).

{% hint style="info" %}
The video files processed in the URLs need to have the proper file extension (eg. *.mp4*, *.webm*).
{% endhint %}

## Available parameters <a href="#od_4580a7ea" id="od_4580a7ea"></a>

//<mark style="color:red;">**token**</mark>.filerobot.com/**folder/origin\_video.mp4**?<mark style="color:orange;">**w=600**</mark>&<mark style="color:orange;">**format=auto**</mark>

<table><thead><tr><th width="131.33333333333331">Parameter</th><th width="301">Allowed values</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:orange;"><strong>w</strong></mark></td><td><code>>100</code></td><td>Sets the target video width</td></tr><tr><td><mark style="color:orange;"><strong>h</strong></mark></td><td><code>>100</code></td><td>Sets the target video height</td></tr><tr><td><mark style="color:orange;"><strong>func</strong></mark></td><td><code>crop</code> (default) | <code>fit</code> | <code>cropfit</code> | <code>bound</code> | <code>boundmin</code> | <code>cover</code></td><td>Sets the resize function if both <strong>width</strong> and <strong>height</strong> parameters are provided</td></tr><tr><td><mark style="color:orange;"><strong>bg_color</strong></mark></td><td>hex color code / color name</td><td>Background (padding) color<br>(for use with <strong>func=fit</strong>)</td></tr><tr><td><mark style="color:orange;"><strong>bg_img_fit</strong></mark></td><td><code>1</code></td><td>Use blurred version of the video for background / padding<br>(for use with <strong>func=fit</strong>)</td></tr><tr><td><mark style="color:orange;"><strong>format</strong></mark></td><td><code>auto</code> (default) | <code>mp4</code> | <code>webm</code> | <code>h264.mp4</code> | <code>h265.mp4</code> | <code>vp9.webm</code></td><td>Defines the video format</td></tr><tr><td><mark style="color:orange;"><strong>bitrate</strong></mark></td><td><code>10k..20000k</code> | <code>1m..20m</code> (ex.<code>300k, 2m</code>)</td><td>Sets the compression bitrate (in kilobits or megabits per second)</td></tr></tbody></table>

{% hint style="info" %}
The automatic format delivery chooses the most efficient codec and format based on the viewer platform support - h265 (HEVC) mp4, vp9 webm or h264 (AVC) mp4.
{% endhint %}

## Examples

| Preview                          | Syntax                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](/files/9XYxKQqnlVZ6u5rkKiqw) | <p>Simple resize:<br><a href="https://fdocs.filerobot.com/docs/waterfall-hd.mp4?w=400">/docs/waterfall-hd.mp4?<mark style="color:orange;"><strong>w=400</strong></mark></a></p>                                                                                                                                                                                                                                                             |
| ![](/files/LV0RTsppYK76OH1pF383) | <p>Crop function:<br><a href="https://fdocs.filerobot.com/docs/waterfall-hd.mp4?w=400&#x26;h=300">/docs/waterfall-hd.mp4?<mark style="color:orange;"><strong>w=400</strong></mark>&<mark style="color:orange;"><strong>h=300</strong></mark></a></p>                                                                                                                                                                                        |
| ![](/files/22l0GCcUmtdWQUbNua8z) | <p>Fit function with blurred background:<br><a href="https://fdocs.filerobot.com/docs/waterfall-hd.mp4?w=400&#x26;h=300&#x26;func=fit&#x26;bg_img_fit=1">/docs/waterfall-hd.mp4?<mark style="color:orange;"><strong>w=400</strong></mark>&<mark style="color:orange;"><strong>h=300</strong></mark>&<mark style="color:orange;"><strong>func=fit</strong></mark>&<mark style="color:orange;"><strong>bg\_img\_fit=1</strong></mark></a></p> |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.scaleflex.com/dynamic-media-optimization-dmo/transformations/video-optimization/on-the-fly-video-optimization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
