# Vidu

> Use the latest Vidu Q2 models which much more better quality and control on your videos.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/vidu/q2/video-extension/pro`
- **Model ID**: `fal-ai/vidu/q2/video-extension/pro`
- **Category**: video-to-video
- **Kind**: inference


## Pricing

Each 360 p video will cost 0.15 $, each 520p video will cost 0.22 $. For 720 p each video second will cost 0.075 $. For 1080 p each video will cost 0.28 $ along with 0.075 $ per video second.

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`video_url`** (`string`, _required_):
  URL of the video to extend
  - Examples: "https://storage.googleapis.com/falserverless/model_tests/video_models/output-3.mp4"

- **`prompt`** (`string`, _optional_):
  text prompt to guide the video extension

- **`seed`** (`integer`, _optional_):
  Random seed for reproducibility. If None, a random seed is chosen.

- **`duration`** (`DurationEnum`, _optional_):
  Duration of the extension in seconds Default value: `"4"`
  - Default: `4`
  - Options: `2`, `3`, `4`, `5`, `6`, `7`

- **`resolution`** (`ResolutionEnum`, _optional_):
  Output video resolution Default value: `"720p"`
  - Default: `"720p"`
  - Options: `"720p"`, `"1080p"`



**Required Parameters Example**:

```json
{
  "video_url": "https://storage.googleapis.com/falserverless/model_tests/video_models/output-3.mp4"
}
```

**Full Example**:

```json
{
  "video_url": "https://storage.googleapis.com/falserverless/model_tests/video_models/output-3.mp4",
  "duration": 4,
  "resolution": "720p"
}
```


### Output Schema

The API returns the following output format:

- **`video`** (`File`, _required_):
  The extended video using the Q2 model
  - Examples: {"url":"https://v3b.fal.media/files/b/zebra/wSaP_lTetcD47ErjwsVGE_output.mp4"}



**Example Response**:

```json
{
  "video": {
    "url": "https://v3b.fal.media/files/b/zebra/wSaP_lTetcD47ErjwsVGE_output.mp4"
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/vidu/q2/video-extension/pro \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "video_url": "https://storage.googleapis.com/falserverless/model_tests/video_models/output-3.mp4"
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/vidu/q2/video-extension/pro",
    arguments={
        "video_url": "https://storage.googleapis.com/falserverless/model_tests/video_models/output-3.mp4"
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/vidu/q2/video-extension/pro", {
  input: {
    video_url: "https://storage.googleapis.com/falserverless/model_tests/video_models/output-3.mp4"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/vidu/q2/video-extension/pro)
- [API Documentation](https://fal.ai/models/fal-ai/vidu/q2/video-extension/pro/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/vidu/q2/video-extension/pro)

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
