---
title: Add music and sound effects that clear rights
description: Background music and sound effects from licensed stock or generated for your video, placed, faded and ducked under the voice.
---
You get background music and sound effects (SFX) on your video that you can post without the video being muted or flagged for a song you do not own. The music sits under your voice and dips when you talk, the whooshes and hits land on your cuts, and everything fades in and out cleanly.

Use invideo for this when you want music that clears rights in the same place as the edit: licensed stock music and generated music land on your timeline, and your agent sets the levels so the voice stays clear.

## Quickest path

Set up your agent first with [invideo for AI agents](/agents). Then give it this prompt.

```text
Add background music to my timeline. Find an upbeat, light stock track,
put it under the whole video, and duck it under my voice. Add a whoosh
on each cut and a soft hit on the title. Price the stock and the sound
effects first, and let me pick the track.
```

In a chat app, you listen to the previews in the chat and pick one. In a terminal, the agent lists the results with their preview links, and you open them.

## What you need

You need a video on a timeline, or a plan for one. Then pick where the sound comes from.

- **The mood.** Upbeat, calm, cinematic, lo-fi, dramatic, or a genre.
- **Stock or generated.** Stock music is a real recording you pick from a list. Generated music is new, made to your prompt and length.
- **The sound effects.** Whoosh, pop, hit, click, crowd, rain, or "the sound of what is on screen".
- **Your own music, if you have one.** A file you have the rights to.

## Steps

Your agent edits on a branch and tells you what changed at each step.

### Find or make the music

The agent finds stock music first, and generates music or sounds only when stock has no fit.

<Steps>
<Step title="Find stock music">
The agent searches `stock_music` with `search_library`, with words like "upbeat acoustic" or "calm piano". Each result has a preview for you to hear. The agent can read a track's tempo with `media` `audio.markers` and the `stock` id. Expected result: a short list of tracks with previews.
</Step>
<Step title="Pick a model when stock has no fit">
The agent runs `find_models` with `output` audio and the job in words, like "instrumental background music". A good pick for music with no voice is `elevenlabs_music_v2_5_instrumental`. For a song with vocals it is `elevenlabs_music_v2_5_song`, and for your own lyrics `minimax_music_3` with `lyrics`. For a sound from words it is `elevenlabs_sfx`. Your agent can search for others with `find_models`. The agent reads the inputs of its pick with `get_model`. Expected result: the model's inputs.
</Step>
<Step title="Generate the music">
The agent calls `generate` with `elevenlabs_music_v2_5_instrumental`, a `prompt` and a `duration` in seconds, and `dry_run: true`. It tells you the price. For a price of 1 credit or more it waits for your yes. Then it calls `generate` with `max_credits` set to that price and an `idempotency_key`. It gets a thread URL, and reads the result with `read`, never with a second `generate`. Expected result: a sequence URL for the track.
</Step>
<Step title="Make the sound effects">
For a sound from words, the agent uses `elevenlabs_sfx` with a `prompt`, a `duration` within the range `get_model` gives, and `loop` true for a sound bed like rain. For a sound that matches a clip, it reads `pixverse_sfx` or `mmaudio_v2.mmaudio_v2_video_to_audio` with `get_model` and passes the clip as `video`. These two return a video with new sound. The agent takes the sound out with `media` `audio.extract` on that video's sequence URL. Each sound gets the same calls: `get_model` on the pick, `generate` with `dry_run: true` and the price told to you, then `generate` with `max_credits` and an `idempotency_key`. The agent reads each result with `read`. Expected result: a sequence URL per sound.
</Step>
</Steps>

### Mix and export

The agent places the audio, sets the levels and checks the mix before export.

<Steps>
<Step title="Place the music and the sounds">
The agent adds stock with `add_media` and `stock`, and generated sound with `add_media` and the sequence URL, on the timeline URL. It places each one on an audio track with `insert_media` at the frame where it belongs, and puts the sound effects on a track of their own. Expected result: music under the video and each effect on its cut.
</Step>
<Step title="Set the levels and the fades">
The agent sets the music's level with `set_audio_gain` in dB, and fades it in and out with `set_audio_fades`. Expected result: the music starts and ends soft.
</Step>
<Step title="Duck the music under the voice">
The agent adds the `ducker` audio effect to the music track with `add_audio_effect`. A new timeline ducks under `A1` by default, so the agent sets `set_sidechain_source` only when the voice is on another track. It sets how far the music drops with `set_audio_effect_parameter` and `reduction`. Expected result: the music dips each time you talk and comes back after.
</Step>
<Step title="Check the mix before export">
The agent runs `media` `audio.loudness` on the voice and music sources, `capture` at a few cuts, and `check_timeline`. Expected result: a clear voice over the music, and no issues from `check_timeline`.
</Step>
<Step title="Export the video">
The agent runs `export` with `format` video and `target_lufs` for the platform, and reads the export card. Expected result: a card with status `completed`.
</Step>
</Steps>

The same job from a terminal:

```bash
invideo agent register <project-url> --name <name>
export INVIDEO_AS=<name>
invideo edit show <edit-url> --json
invideo branch new <edit-url> --name music --token <state_token>
invideo library search <project-url> --library stock_music \
  --query "upbeat acoustic"
invideo asset add <branch-url> --stock <music-id>
invideo gen models <project-url> --query "instrumental background music"
invideo gen model <project-url> --model elevenlabs_music_v2_5_instrumental
invideo gen run <page-url> --model elevenlabs_music_v2_5_instrumental \
  --dry-run -i prompt="warm upbeat acoustic guitar" -i duration=60
invideo gen run <page-url> --model elevenlabs_music_v2_5_instrumental \
  --max-credits <price> --idempotency-key music-1 \
  -i prompt="warm upbeat acoustic guitar" -i duration=60
invideo gen model <project-url> --model elevenlabs_sfx
invideo gen run <page-url> --model elevenlabs_sfx --dry-run \
  -i prompt="fast air whoosh" -i duration=3
invideo gen run <page-url> --model elevenlabs_sfx --max-credits <price> \
  --idempotency-key whoosh-1 -i prompt="fast air whoosh" -i duration=3
invideo status <thread-url> --wait
invideo notebook show <thread-url>
invideo asset add <branch-url> --media-url <sequence-url>
invideo edit show <branch-url> --json
invideo edit change <branch-url> --timeline T1 \
  --token <state_token> --operations @ops.json
invideo edit check <branch-url>
invideo edit export <branch-url> --format video --quality 1080 \
  --target-lufs -14 --json
invideo status <card-url> --wait
invideo notebook show <card-url> --out ./out
```

Where each value comes from:

- `<name>` is the name you choose in `invideo agent register`. `INVIDEO_AS` passes it to every later command.
- `<edit-url>` is your video's timeline URL, from `invideo edit new`, or the URL the editor shows. `<project-url>` is its project, from `invideo project new`.
- `<state_token>` comes from `invideo edit show`: on `<edit-url>` for the branch, then on `<branch-url>` for the change. `<branch-url>` is the `.branch_url` that `invideo branch new` returns.
- `<music-id>` is a stock result's id from `invideo library search`.
- `<page-url>` is a notebook page of the project, listed by `invideo notebook show <project-url>`. `<price>` is each dry run's `.estimated_credits`.
- `<thread-url>` is the `url` the paid `gen run` returns. `<sequence-url>` is the sound's sequence URL, listed by `invideo notebook show <thread-url>`.
- `@ops.json` reads a bare JSON list of ops, the `operations` list of the call below.
- `<card-url>` is `.sequences[0]` of the export result. `invideo status` waits but saves nothing. `invideo notebook show` saves the video as `./out/export.mp4`, and the agent renames it.

The key MCP call, shown as the full call, places the music and a whoosh, sets the level, and ducks the music under the voice on `A1`, the default duck source on a new timeline. `<branch-url>` is the branch URL `timeline_history` returns, and `<state_token>` comes from `get_timeline` on it. `m5` and `m6` are the bin ids `add_media` returns for the music and the whoosh. The track ids come from `get_timeline`. At 30 fps, a cut at 4 seconds is frame 120.

```json
{
  "url": "<branch-url>",
  "timeline_id": "T1",
  "expected_state_token": "<state_token>",
  "operations": [
    { "op": "insert_media", "asset": "m5", "track": "A2",
      "at_f": 0, "ripple": false },
    { "op": "insert_media", "asset": "m6", "track": "A3",
      "at_f": 110, "ripple": false },
    { "op": "set_audio_gain", "target": "A2",
      "gain_db": -6 },
    { "op": "add_audio_effect", "target": "A2",
      "target_kind": "track", "effect": "ducker" }
  ]
}
```

In a second call, the agent sets `set_audio_fades` on the new music clip with `fade_in_f` and `fade_out_f`, and the ducker's `reduction` with `set_audio_effect_parameter`.

## Rights, in plain words

Stock music and stock footage in invideo are licensed. Paid stock shows invideo's stock mark on the timeline, and the export renders it clean. Searching and listening cost nothing. Placing a paid stock track charges it. Some stock is not paid. Generated music and sound effects are made new for you. What you may do with each kind is on [Licensing and commercial use](/account/commercial-use).

A song you did not make or license is not covered. A platform can mute or block a video that carries it.

## Cost and time

Edits and exports are free. Generation and transcripts cost credits. Paid stock costs a small credit charge, or one of your workspace's iStock licenses. Your agent runs a dry run first and tells you the price before it spends anything.

- **Free:** searching stock, previews, placing, levels, fades, ducking and the export.
- **Tool ops:** `audio.markers`, `audio.extract`, `audio.loudness`. The dry run shows its price before anything starts.
- **Costs credits:** each paid stock track you place, and each run of a music or sound model.

Music and sound for one video take the agent a few minutes. See [Credits and what they cost](/account/credits) for prices.

## If something goes wrong

Most problems come from music that is too loud under the voice, or a sound that lands off the cut.

| Symptom | Fix |
| --- | --- |
| `get_model` or `generate` refuses the model as not found | Models retire. Run `find_models` with the job in words, use the best match, and tell the person which model you used. |
| Exit code 6, or `status` is `held` | A safety review, not a refusal. Wait, then run `invideo status <url> --wait` again. Do not resend. If it ends `failed`, change the input the review flagged. |
| The voice is hard to hear | Lower the music with `set_audio_gain`, or raise the ducker's `reduction`. |
| The music does not duck | Check the `ducker` is on the music track. If the voice is not on `A1`, point `set_sidechain_source` at the voice track. |
| `invideo status --wait` ends and the folder is empty | `status` does not download. Run `invideo notebook show <card-url> --out <dir>`. |
| A sound effect is late | Move it with `move_clip` to the frame of the cut. |
| The music model refuses the prompt | It names a real artist or band. Describe the style instead: "warm 70s soul with horns". |
| The music ends before the video | Ask for a longer `duration`, or crossfade two copies with `apply_audio_crossfade`. |
| The platform mutes the video | The music is not licensed. Swap it for stock or generated music. |
| CLI exit 5 | A credit limit. Pick fewer generations, or add credits. |
| Avoid: setting levels by ear from the export only | Instead: run `audio.loudness` on each source, so you know which clip to fix. |

## Prompts to try

Each prompt is a real variation of the job.

```text
Make 60 seconds of calm lo-fi with no vocals for my study vlog, with
elevenlabs_music_v2_5_instrumental. Fade it in, duck it under my voice
and fade it out at the end.
```

```text
Add sound to my silent drone clips: wind, birds and a far-off river.
Use mmaudio_v2.mmaudio_v2_video_to_audio on each clip and keep the
levels low.
```

```text
Add a pop on each caption, a whoosh on each cut and a bass hit on the
last line. Put the effects on their own track so I can mute them.
```

## When to use something else

invideo does not clear a song you do not own. For a famous song, license it through the label or a music licensing service, then bring in the file. For a full custom score with a composer's control over every note, use a music app such as Logic Pro or Ableton Live, then add the file.

## Related

- [Licensing and commercial use](/account/commercial-use)
- [Make Reels and Shorts from your footage: hook, captions, transitions, sound effects](/how-to/creators/reels-and-shorts-from-your-footage)
- [Edit a long YouTube video](/how-to/creators/edit-a-long-youtube-video)
- [Use ElevenLabs with invideo](/integrations/elevenlabs)
- [Clean up the dialogue and keep the original](/how-to/film/dialogue-cleanup)
- [Know the cost before you spend](/how-to/cost-before-you-spend)