# Video

> Remove background from videos filmed using chromakey, with automatic green spill suppression for clean, professional edges. 


## Overview

- **Endpoint**: `https://fal.run/bria/video/background-removal/green-screen-despill`
- **Model ID**: `bria/video/background-removal/green-screen-despill`
- **Category**: video-to-video
- **Kind**: inference


## Pricing

- **Price**: $0.05 per seconds

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:


- **`output_container_and_codec`** (`OutputContainerAndCodecEnum`, _optional_):
  Output container and codec. Options: mp4_h265, mp4_h264, webm_vp9, mov_h265, mov_proresks, mkv_h265, mkv_h264, mkv_vp9, gif. Default value: `"webm_vp9"`
  - Default: `"webm_vp9"`
  - Options: `"mp4_h265"`, `"mp4_h264"`, `"webm_vp9"`, `"mov_h265"`, `"mov_proresks"`, `"mkv_h265"`, `"mkv_h264"`, `"mkv_vp9"`, `"gif"`

- **`preserve_audio`** (`boolean`, _optional_):
  If true, audio will be preserved in the output video. Default value: `true`
  - Default: `true`

- **`video_url`** (`string`, _required_):
  Input video filmed on a green screen.
  - Examples: "https://bria-datasets.s3.us-east-1.amazonaws.com/rmbg_tests/videos/green_screen_video.webm"

- **`spill_suppression`** (`float`, _optional_):
  Strength of green-spill suppression. Higher values pull the green channel toward the red/blue average on green-dominant pixels, removing the green fringe around the subject. 0 disables it. Default value: `1`
  - Default: `1`
  - Range: `0` to `1`



**Required Parameters Example**:

```json
{
  "video_url": "https://bria-datasets.s3.us-east-1.amazonaws.com/rmbg_tests/videos/green_screen_video.webm"
}
```

**Full Example**:

```json
{
  "output_container_and_codec": "webm_vp9",
  "preserve_audio": true,
  "video_url": "https://bria-datasets.s3.us-east-1.amazonaws.com/rmbg_tests/videos/green_screen_video.webm",
  "spill_suppression": 1
}
```


### Output Schema

The API returns the following output format:

- **`video`** (`Video`, _required_):
  Video with the green-screen background removed, on a transparent background.
  - Examples: {"url":"https://bria-datasets.s3.us-east-1.amazonaws.com/rmbg_tests/videos/green_screen_video_output.webm","content_type":"video/webm","file_name":"green_screen_video_output.webm","file_size":2884142}

- **`request_id`** (`string`, _required_):
  Bria request ID.



**Example Response**:

```json
{
  "video": {
    "url": "https://bria-datasets.s3.us-east-1.amazonaws.com/rmbg_tests/videos/green_screen_video_output.webm",
    "content_type": "video/webm",
    "file_name": "green_screen_video_output.webm",
    "file_size": 2884142
  },
  "request_id": ""
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/bria/video/background-removal/green-screen-despill \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "video_url": "https://bria-datasets.s3.us-east-1.amazonaws.com/rmbg_tests/videos/green_screen_video.webm"
   }'
```

### 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(
    "bria/video/background-removal/green-screen-despill",
    arguments={
        "video_url": "https://bria-datasets.s3.us-east-1.amazonaws.com/rmbg_tests/videos/green_screen_video.webm"
    },
    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("bria/video/background-removal/green-screen-despill", {
  input: {
    video_url: "https://bria-datasets.s3.us-east-1.amazonaws.com/rmbg_tests/videos/green_screen_video.webm"
  },
  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/bria/video/background-removal/green-screen-despill)
- [API Documentation](https://fal.ai/models/bria/video/background-removal/green-screen-despill/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=bria/video/background-removal/green-screen-despill)

### 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`
