# H3 Max Recast

> Recast the people in a video using reference photos with H3 Max, while preserving the source motion, camera, cuts, and audio.


## Overview

- **Endpoint**: `https://fal.run/minimax/h3-max/recast`
- **Model ID**: `minimax/h3-max/recast`
- **Category**: video-to-video
- **Kind**: inference
**Description**: H3 Max Recast replaces the main people in a source video with people from reference photos, tracking each person across shots. Provide a video and one photo per new person, with an optional prompt to specify who becomes whom or which details to keep or change. The model aims to preserve the original motion, gestures, camera, shot timing, and soundtrack. Supports up to four reference photos and videos up to 30 seconds, with individual shots no longer than 15 seconds, at 768p or 1080p.

**Tags**: video-to-video, video-editing, character-replacement



## Pricing

Your request will cost **$0.30 per second** of output video at **768p** or **$0.45 per second** at **1080p**. Reference images are included at no additional charge.

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_):
  The source video, 5 to 30 seconds long, with no single shot longer than 15 seconds.
  - Examples: "https://v3b.fal.media/files/b/0aac0919/5NYtHn5-5dxFlbH_U9oQW_video.mp4"

- **`reference_image_urls`** (`list<string>`, _required_):
  One photo per new person. By default they replace the main people in the video from left to right, each in every shot they appear in.
  - Array of string
  - Examples: ["https://v3b.fal.media/files/b/0aac0904/DYyrpDKza8aflsP6mMm0i_76qcS0F8.png"]

- **`prompt`** (`string`, _optional_):
  Optional: who becomes whom, or what else to keep or change.

- **`resolution`** (`ResolutionEnum`, _optional_):
   Default value: `"1080P"`
  - Default: `"1080P"`
  - Options: `"768P"`, `"1080P"`

- **`seed`** (`integer`, _optional_):
  Random seed. Leave empty for a random one.



**Required Parameters Example**:

```json
{
  "video_url": "https://v3b.fal.media/files/b/0aac0919/5NYtHn5-5dxFlbH_U9oQW_video.mp4",
  "reference_image_urls": [
    "https://v3b.fal.media/files/b/0aac0904/DYyrpDKza8aflsP6mMm0i_76qcS0F8.png"
  ]
}
```

**Full Example**:

```json
{
  "video_url": "https://v3b.fal.media/files/b/0aac0919/5NYtHn5-5dxFlbH_U9oQW_video.mp4",
  "reference_image_urls": [
    "https://v3b.fal.media/files/b/0aac0904/DYyrpDKza8aflsP6mMm0i_76qcS0F8.png"
  ],
  "resolution": "1080P"
}
```


### Output Schema

The API returns the following output format:

- **`video`** (`File`, _required_):
  The recast video, with the source sound.

- **`seed`** (`integer`, _required_):
  The seed used.



**Example Response**:

```json
{
  "video": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/minimax/h3-max/recast \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "video_url": "https://v3b.fal.media/files/b/0aac0919/5NYtHn5-5dxFlbH_U9oQW_video.mp4",
     "reference_image_urls": [
       "https://v3b.fal.media/files/b/0aac0904/DYyrpDKza8aflsP6mMm0i_76qcS0F8.png"
     ]
   }'
```

### 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(
    "minimax/h3-max/recast",
    arguments={
        "video_url": "https://v3b.fal.media/files/b/0aac0919/5NYtHn5-5dxFlbH_U9oQW_video.mp4",
        "reference_image_urls": ["https://v3b.fal.media/files/b/0aac0904/DYyrpDKza8aflsP6mMm0i_76qcS0F8.png"]
    },
    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("minimax/h3-max/recast", {
  input: {
    video_url: "https://v3b.fal.media/files/b/0aac0919/5NYtHn5-5dxFlbH_U9oQW_video.mp4",
    reference_image_urls: ["https://v3b.fal.media/files/b/0aac0904/DYyrpDKza8aflsP6mMm0i_76qcS0F8.png"]
  },
  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/minimax/h3-max/recast)
- [API Documentation](https://fal.ai/models/minimax/h3-max/recast/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=minimax/h3-max/recast)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
