---
name: fal-ai/ffmpeg-api/merge-audio-video
display_name: Ffmpeg Api Merge Audio-Video
category: video-to-video
creator: FFmpeg (Open Source) / FAL.ai (API Provider)
fal_docs: https://fal.ai/models/fal-ai/ffmpeg-api/merge-audio-video
original_source: https://ffmpeg.org/documentation.html
summary: A high-performance cloud API for merging audio tracks into video files using FFmpeg.
---

# Ffmpeg Api Merge Audio-Video

## Overview
- **Slug:** `fal-ai/ffmpeg-api/merge-audio-video`
- **Category:** Video Editing / Media Utilities
- **Creator:** [FFmpeg](https://ffmpeg.org/) (Original Tool) / [FAL.ai](https://fal.ai/) (API Wrapper)
- **Best for:** Seamlessly replacing or adding audio tracks to existing video files in the cloud.
- **FAL docs:** [fal.ai/models/fal-ai/ffmpeg-api/merge-audio-video](https://fal.ai/models/fal-ai/ffmpeg-api/merge-audio-video)
- **Original source:** [FFmpeg Documentation](https://ffmpeg.org/documentation.html)

## What it does
The `merge-audio-video` model is a specialized utility that leverages the power of FFmpeg to combine a video track with a separate audio track. Unlike generative models, this is a deterministic media processing tool that performs tasks like audio replacement or synchronization. It is highly efficient for workflows where video is generated by one model (e.g., Kling or Luma) and audio is generated by another (e.g., ElevenLabs or Suno).

## When to use this model
- **Use when:** You need to attach a high-quality voiceover to a silent AI-generated video, or when you want to replace the background music of a clip without re-rendering.
- **Don't use when:** You need complex multi-track editing, transitions, or visual effects. This is a simple merge/muxing tool.
- **Alternatives:**
    - **[fal-ai/ffmpeg-api/merge-videos](https://fal.ai/models/fal-ai/ffmpeg-api/merge-videos):** Use this to stitch multiple video clips together sequentially.
    - **[fal-ai/ffmpeg-api/compose](https://fal.ai/models/fal-ai/ffmpeg-api/compose):** Use for more complex layering and positioning of multiple media assets.
    - **[fal-ai/ffmpeg-api/loudnorm](https://fal.ai/models/fal-ai/ffmpeg-api/loudnorm):** Use to normalize audio levels before or after merging.

## API — via FAL.ai
**Endpoint:** `https://fal.run/fal-ai/ffmpeg-api/merge-audio-video` (sync) / `https://queue.fal.run/fal-ai/ffmpeg-api/merge-audio-video` (queue)

### Input parameters
| Parameter | Type | Default | Range/Values | Description |
|---|---|---|---|---|
| `video_url` | string | (Required) | URL | The URL of the video file to use as the video track. Supports mp4, mov, webm, m4v, gif. |
| `audio_url` | string | (Required) | URL | The URL of the audio file to use as the audio track. Supports mp3, ogg, wav, m4a, aac. |
| `start_offset` | float | `0.0` | Any | Offset in seconds for when the audio should start relative to the video. |

### Output
The API returns a JSON object containing a `video` field with the following structure:
- **`video`**:
    - `url` (string): The public URL of the merged video file.
    - `content_type` (string): The MIME type (e.g., `video/mp4`).
    - `file_name` (string): The name of the generated file.
    - `file_size` (integer): The size of the file in bytes.

### Example request
```json
{
  "video_url": "https://storage.googleapis.com/falserverless/example_inputs/ffmpeg-v.mp4",
  "audio_url": "https://storage.googleapis.com/falserverless/example_inputs/ffmpeg-a.mp3",
  "start_offset": 0
}
```

### Pricing
- **Cost:** `$0.0002` per second of the output video.
- **Note:** This is an inference-based utility, making it significantly cheaper than GPU-intensive generative models.

## API — via Original Source (BYO-key direct)
FAL.ai is the primary API surface for this cloud-hosted version of FFmpeg. While you can run FFmpeg locally for free, FAL provides the serverless infrastructure, GPU/CPU acceleration, and file hosting necessary for web-based workflows.
- **Direct Alternative:** Running `ffmpeg -i video.mp4 -i audio.mp3 -c copy -map 0:v:0 -map 1:a:0 output.mp4` on your own server.

## Prompting best practices
*This model does not use natural language prompts.* Interaction is strictly via file URLs and parameters.
- **Check Compatibility:** Ensure your video and audio formats are supported (MP4 and MP3/AAC are safest for web compatibility).
- **Match Durations:** If the audio is longer than the video, the behavior may vary depending on the container; usually, the output duration will match the longer stream.
- **Use High-Speed Storage:** Provide direct, publicly accessible URLs (e.g., S3, Google Cloud Storage, or FAL Storage) to minimize download latency.

## Parameter tuning guide
- **`start_offset`**: Use this to sync voiceovers. For example, if your voiceover should start 2 seconds into the video, set this to `2.0`. Negative values are generally not supported or may result in truncated audio.
- **URL Selection:** Always use the `.mp4` or `.mov` versions of videos for best compatibility. Avoid passing URLs that require redirects or authentication.

## Node inputs/outputs
- **Inputs:**
    - `Video URL`: Port for the source video file.
    - `Audio URL`: Port for the source audio file.
    - `Offset`: Numerical input for audio delay.
- **Outputs:**
    - `Video URL`: The merged result.
    - `Metadata`: Access to file size and content type.
- **Chain-friendly with:**
    - **[Luma Dream Machine](https://fal.ai/models/fal-ai/luma-dream-machine):** Generate a high-quality video first.
    - **[ElevenLabs](https://fal.ai/models/fal-ai/elevenlabs/tts):** Generate the audio voiceover to be merged.
    - **[fal-ai/ffmpeg-api/waveform](https://fal.ai/models/fal-ai/ffmpeg-api/waveform):** Visualize the audio track before merging.

## Notes & gotchas
- **Encoding:** This API typically performs a "remux" (copying streams) rather than a full "re-encode" when possible, which is extremely fast but requires compatible codecs.
- **Limits:** While not strictly capped, extremely large files (e.g., >500MB) may hit FAL's standard timeout limits. For large processing tasks, always use the **Queue Mode**.
- **Audio Overwrite:** This model replaces existing audio in the video file. If you want to *mix* multiple audio tracks, use a more advanced FFmpeg command or a composition model.

## Sources
- [FAL.ai Model Page](https://fal.ai/models/fal-ai/ffmpeg-api/merge-audio-video)
- [FAL.ai API Reference](https://fal.ai/models/fal-ai/ffmpeg-api/merge-audio-video/api)
- [FFmpeg Official Documentation](https://ffmpeg.org/documentation.html)
- [FAL.ai Pricing](https://fal.ai/pricing)