Add music and sound effects that clear rights
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. Then give it this prompt.
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 whooshon each cut and a soft hit on the title. Price the stock and the soundeffects 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.
Find stock music
The agent searches
stock_musicwithsearch_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 withmediaaudio.markersand thestockid. Expected result: a short list of tracks with previews.Pick a model when stock has no fit
The agent runs
find_modelswithoutputaudio and the job in words, like "instrumental background music". A good pick for music with no voice iselevenlabs_music_v2_5_instrumental. For a song with vocals it iselevenlabs_music_v2_5_song, and for your own lyricsminimax_music_3withlyrics. For a sound from words it iselevenlabs_sfx. Your agent can search for others withfind_models. The agent reads the inputs of its pick withget_model. Expected result: the model's inputs.Generate the music
The agent calls
generatewithelevenlabs_music_v2_5_instrumental, apromptand adurationin seconds, anddry_run: true. It tells you the price. For a price of 1 credit or more it waits for your yes. Then it callsgeneratewithmax_creditsset to that price and anidempotency_key. It gets a thread URL, and reads the result withread, never with a secondgenerate. Expected result: a sequence URL for the track.Make the sound effects
For a sound from words, the agent uses
elevenlabs_sfxwith aprompt, adurationwithin the rangeget_modelgives, andlooptrue for a sound bed like rain. For a sound that matches a clip, it readspixverse_sfxormmaudio_v2.mmaudio_v2_video_to_audiowithget_modeland passes the clip asvideo. These two return a video with new sound. The agent takes the sound out withmediaaudio.extracton that video's sequence URL. Each sound gets the same calls:get_modelon the pick,generatewithdry_run: trueand the price told to you, thengeneratewithmax_creditsand anidempotency_key. The agent reads each result withread. Expected result: a sequence URL per sound.
Mix and export
The agent places the audio, sets the levels and checks the mix before export.
Place the music and the sounds
The agent adds stock with
add_mediaandstock, and generated sound withadd_mediaand the sequence URL, on the timeline URL. It places each one on an audio track withinsert_mediaat 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.Set the levels and the fades
The agent sets the music's level with
set_audio_gainin dB, and fades it in and out withset_audio_fades. Expected result: the music starts and ends soft.Duck the music under the voice
The agent adds the
duckeraudio effect to the music track withadd_audio_effect. A new timeline ducks underA1by default, so the agent setsset_sidechain_sourceonly when the voice is on another track. It sets how far the music drops withset_audio_effect_parameterandreduction. Expected result: the music dips each time you talk and comes back after.Check the mix before export
The agent runs
mediaaudio.loudnesson the voice and music sources,captureat a few cuts, andcheck_timeline. Expected result: a clear voice over the music, and no issues fromcheck_timeline.Export the video
The agent runs
exportwithformatvideo andtarget_lufsfor the platform, and reads the export card. Expected result: a card with statuscompleted.
The same job from a terminal:
invideo agent register <project-url> --name <name>export INVIDEO_AS=<name>invideo edit show <edit-url> --jsoninvideo 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_instrumentalinvideo gen run <page-url> --model elevenlabs_music_v2_5_instrumental \ --dry-run -i prompt="warm upbeat acoustic guitar" -i duration=60invideo 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=60invideo gen model <project-url> --model elevenlabs_sfxinvideo gen run <page-url> --model elevenlabs_sfx --dry-run \ -i prompt="fast air whoosh" -i duration=3invideo gen run <page-url> --model elevenlabs_sfx --max-credits <price> \ --idempotency-key whoosh-1 -i prompt="fast air whoosh" -i duration=3invideo status <thread-url> --waitinvideo notebook show <thread-url>invideo asset add <branch-url> --media-url <sequence-url>invideo edit show <branch-url> --jsoninvideo edit change <branch-url> --timeline T1 \ --token <state_token> --operations @ops.jsoninvideo edit check <branch-url>invideo edit export <branch-url> --format video --quality 1080 \ --target-lufs -14 --jsoninvideo status <card-url> --waitinvideo notebook show <card-url> --out ./outWhere each value comes from:
<name>is the name you choose ininvideo agent register.INVIDEO_ASpasses it to every later command.<edit-url>is your video's timeline URL, frominvideo edit new, or the URL the editor shows.<project-url>is its project, frominvideo project new.<state_token>comes frominvideo edit show: on<edit-url>for the branch, then on<branch-url>for the change.<branch-url>is the.branch_urlthatinvideo branch newreturns.<music-id>is a stock result's id frominvideo library search.<page-url>is a notebook page of the project, listed byinvideo notebook show <project-url>.<price>is each dry run's.estimated_credits.<thread-url>is theurlthe paidgen runreturns.<sequence-url>is the sound's sequence URL, listed byinvideo notebook show <thread-url>.@ops.jsonreads a bare JSON list of ops, theoperationslist of the call below.<card-url>is.sequences[0]of the export result.invideo statuswaits but saves nothing.invideo notebook showsaves 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.
{ "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.
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 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.
Make 60 seconds of calm lo-fi with no vocals for my study vlog, withelevenlabs_music_v2_5_instrumental. Fade it in, duck it under my voiceand fade it out at the end.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 thelevels low.Add a pop on each caption, a whoosh on each cut and a bass hit on thelast 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.