---
title: "FFmpeg Merge Audio and Video"
description: "Merge Audio and Video puts an audio track onto a finished clip. It replaces the clip's audio; it does not mix."
url: https://docs.roasos.com/models/assembly/merge-audio-video
---

# FFmpeg Merge Audio and Video

<Callout>
  Family 

  `assembly`

   · model 

  `merge-audio-video`

   · catalog 

  `model-catalog@2026-10-06.v5`

   · pricing 

  `customer-pricing@2026-11-05.v15`

  .
</Callout>

## Endpoint

```http
POST https://api.roasos.com/v1/assembly/merge-audio-video
```

Send your API key as a bearer token. The key needs the scope `api:write`. Every paid request also needs an `Idempotency-Key` header.

The envelope fields `quote_only`, `quote_id`, `webhook_url` and `wait_timeout_seconds` behave the same on each model endpoint. Refer to [Jobs](/concepts/jobs) and [Quotes and credits](/concepts/quotes-and-credits).

## Good at

Drop a generated voice-over or a music bed onto a finished cut. `start_offset_seconds` delays the audio relative to the video, and it is in SECONDS on this operation — Compose counts milliseconds and Images to Video counts frames, and nothing converts between them for you.

Use Compose instead when you need the source audio kept, or two audio sources together: this operation replaces the track.

The price is one credit, flat.

## Pricing

The unit is one **operation**. Pricing key: `merge-audio-video`.

| Request         | Credits |
| --------------- | ------- |
| `per_operation` | 1       |

The credits come from the roasOS pricing table. No other field changes the price. To get the exact price of your request, send it with `quote_only: true` first.

## Modes

* `merge-audio-video`

Provider endpoints: `fal-ai/ffmpeg-api/merge-audio-video`.

## Request fields

| Field                  | Type    | Required | Default | Rule                          |
| ---------------------- | ------- | -------- | ------- | ----------------------------- |
| `audio_url`            | string  | yes      | —       | https URL; ≤ 4,096 characters |
| `quote_id`             | string  | no       | —       | UUID                          |
| `quote_only`           | boolean | no       | `false` | —                             |
| `start_offset_seconds` | number  | no       | `0`     | 0–600                         |
| `video_url`            | string  | yes      | —       | https URL; ≤ 4,096 characters |
| `wait_timeout_seconds` | integer | no       | `0`     | 0–60                          |
| `webhook_url`          | string  | no       | —       | https URL; ≤ 4,096 characters |

The schema is strict. A field that is not in this table gets `400 unsupported_option`. The field names are the roasOS role names. One role has one name in every family.

## Media

This endpoint accepts these media roles:

* `video_url` — the source video
* `audio_url` — the driving audio track

| Role        | Items | Maximum size | Content types                                                       | Duration |
| ----------- | ----- | ------------ | ------------------------------------------------------------------- | -------- |
| `audio_url` | ≤ 1   | 15 MB        | `audio/mp3`, `audio/mpeg`, `audio/wav`, `audio/wave`, `audio/x-wav` | —        |
| `video_url` | ≤ 1   | 100 MB       | `video/mp4`                                                         | 0–180 s  |

Every other role is refused: `avatar_id`, `elements`, `product_id`, `product_images`, `references`, `reference_images`, `image_url`, `end_image_url`, `scene_id`, `scene_image`, `video_urls`, `audio_urls`, `voice_id`. A refused role gets `400 unsupported_option`.

<Callout>
  Each media URL must be an immutable object on 

  `https://cdn.roasos.com`

   that your workspace owns. Any other URL gets 

  `400 reference_media_not_workspace_owned`

  . Refer to 

  [Reference media and uploads](/concepts/reference-media)

   to learn how to put a file there.
</Callout>

## Prompt

None. This operation takes no prompt.

## Not exposed

roasOS pins no provider field for this model.

## Result

The result kind is `video`. Always present: `url`.

```json
{
  "data": {
    "id": "gen_…",
    "kind": "video",
    "model": "merge-audio-video",
    "status": "completed",
    "result": {
      "url": "https://cdn.roasos.com/workspaces/ws_01/result"
    }
  }
}
```

The files are immutable objects on `https://cdn.roasos.com`. A result URL is a valid media input for your next request.

## Example

The three steps are always the same: quote, run, poll.

<CodeBlockTabs defaultValue="cURL">
  <CodeBlockTabsList>
    <CodeBlockTabsTrigger value="cURL">
      cURL
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="JavaScript">
      JavaScript
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="Python">
      Python
    </CodeBlockTabsTrigger>
  </CodeBlockTabsList>

  <CodeBlockTab value="cURL">
    ```bash
    # 1. Quote. Nothing is spent.
    curl -X POST https://api.roasos.com/v1/assembly/merge-audio-video \
      -H "Authorization: Bearer roasos_sk_live_..." \
      -H "Idempotency-Key: 0f1c9e2a-merge-audio-video-0001" \
      -H "Content-Type: application/json" \
      -d '{"quote_only":true,"audio_url":"https://cdn.roasos.com/workspaces/ws_01/uploads/audio_url.mp3","video_url":"https://cdn.roasos.com/workspaces/ws_01/uploads/video_url.mp4"}'
    # 200 { "data": { "kind": "quote", "quote_id": "q_7Hk...", "credits": 1, "expires_at": "...",
    #        "confirmation": { "model": "merge-audio-video", "example": "per_operation" } } }

    # 2. Run. Same body, same Idempotency-Key, quote_id in place of quote_only.
    curl -X POST https://api.roasos.com/v1/assembly/merge-audio-video \
      -H "Authorization: Bearer roasos_sk_live_..." \
      -H "Idempotency-Key: 0f1c9e2a-merge-audio-video-0001" \
      -H "Content-Type: application/json" \
      -d '{"quote_id":"q_7Hk...","audio_url":"https://cdn.roasos.com/workspaces/ws_01/uploads/audio_url.mp3","video_url":"https://cdn.roasos.com/workspaces/ws_01/uploads/video_url.mp4"}'
    # 201 { "data": { "id": "gen_...", "status": "queued", "credits_reserved": 1 } }

    # 3. Poll, then read the result.
    curl https://api.roasos.com/v1/jobs/gen_.../status -H "Authorization: Bearer roasos_sk_live_..."
    curl https://api.roasos.com/v1/jobs/gen_.../result -H "Authorization: Bearer roasos_sk_live_..."
    ```
  </CodeBlockTab>

  <CodeBlockTab value="JavaScript">
    ```javascript
    const key = process.env.ROASOS_API_KEY;
    const url = "https://api.roasos.com/v1/assembly/merge-audio-video";
    const idempotencyKey = "0f1c9e2a-merge-audio-video-0001";
    const input = {
      "audio_url": "https://cdn.roasos.com/workspaces/ws_01/uploads/audio_url.mp3",
      "video_url": "https://cdn.roasos.com/workspaces/ws_01/uploads/video_url.mp4"
    };

    const post = (payload) =>
      fetch(url, {
        method: "POST",
        headers: {
          Authorization: `Bearer ${key}`,
          "Idempotency-Key": idempotencyKey,
          "Content-Type": "application/json",
        },
        body: JSON.stringify(payload),
      }).then((response) => response.json());

    // 1. Quote. Nothing is spent.
    const quote = await post({ quote_only: true, ...input });
    console.log(quote.data.credits);

    // 2. Run.
    const job = await post({ quote_id: quote.data.quote_id, ...input });

    // 3. Poll, then read the result.
    let status = "queued";
    while (status !== "completed" && status !== "failed" && status !== "canceled") {
      await new Promise((done) => setTimeout(done, 3000));
      const poll = await fetch(`${url.split("/v1")[0]}/v1/jobs/${job.data.id}/status`, {
        headers: { Authorization: `Bearer ${key}` },
      }).then((response) => response.json());
      status = poll.data.status;
    }

    const result = await fetch(`${url.split("/v1")[0]}/v1/jobs/${job.data.id}/result`, {
      headers: { Authorization: `Bearer ${key}` },
    }).then((response) => response.json());
    console.log(result.data.result);
    ```
  </CodeBlockTab>

  <CodeBlockTab value="Python">
    ```python
    import os, time, requests

    key = os.environ["ROASOS_API_KEY"]
    url = "https://api.roasos.com/v1/assembly/merge-audio-video"
    headers = {
        "Authorization": f"Bearer {key}",
        "Idempotency-Key": "0f1c9e2a-merge-audio-video-0001",
    }
    payload = {
        "audio_url": "https://cdn.roasos.com/workspaces/ws_01/uploads/audio_url.mp3",
        "video_url": "https://cdn.roasos.com/workspaces/ws_01/uploads/video_url.mp4"
    }

    # 1. Quote. Nothing is spent.
    quote = requests.post(url, headers=headers, json={"quote_only": True, **payload}).json()
    print(quote["data"]["credits"])

    # 2. Run.
    job = requests.post(url, headers=headers, json={"quote_id": quote["data"]["quote_id"], **payload}).json()
    job_id = job["data"]["id"]

    # 3. Poll, then read the result.
    jobs = "https://api.roasos.com/v1/jobs"
    status = "queued"
    while status not in ("completed", "failed", "canceled"):
        time.sleep(3)
        status = requests.get(f"{jobs}/{job_id}/status", headers=headers).json()["data"]["status"]

    result = requests.get(f"{jobs}/{job_id}/result", headers=headers).json()
    print(result["data"]["result"])
    ```
  </CodeBlockTab>
</CodeBlockTabs>

## Today

The endpoint is `POST /v1/assembly/merge-audio-video`.

It is live.

## See also

* [`llms.txt` for this model](https://docs.roasos.com/models/assembly/merge-audio-video/llms.txt) — the same facts as one plain-text file for an agent.
* `GET https://api.roasos.com/v1/catalog/merge-audio-video` — the machine-readable form: enums, defaults, limits and prices. Refer to the [API reference](/api-reference/overview).
* [Jobs](/concepts/jobs) — how to poll a job and read its result.
* Provider endpoints: `fal-ai/ffmpeg-api/merge-audio-video`.
