Edit a long YouTube video: cut the dead parts, add b-roll, music and captions
You get your long YouTube recording edited into a video people watch to the end. The dead air, ums and false starts are cut, b-roll covers the long talking stretches, music runs under your voice and dips when you talk, captions are on, chapters are marked, and you get a still for the thumbnail.
Use invideo for this when you want an editor that reads your whole recording: your agent works from a transcript of every word, makes each change on a branch, and you can review and undo any cut on the timeline.
Quickest path
Set up your agent first with invideo for AI agents. Then give it this prompt.
Edit my YouTube video ./episode-12.mp4 on a branch. Cut dead air andums, add stock b-roll over long talking parts, calm music ducked undermy voice, and captions. Mark chapters and give me the chapter list.Price the transcript and stock first, and show me frames before export.In a chat app, you drag the recording into the project's Media panel in invideo. In a terminal, you name the file and the agent uploads it, which works for large files.
What you need
Your recording is the main input. The rest shapes the edit.
- The recording. The full take from your camera or screen recorder, MP4 or MOV, as large as it is.
- Your own b-roll, if you have it. Clips of the product, the place, your screen.
- The music or the mood. Stock, generated, or your own track.
- The caption look. Or no captions.
- What must stay. Jokes, a sponsor read, a call to action.
Steps
Your agent edits on a branch and tells you what changed at each step.
Upload the recording
The agent calls
start_uploadwith thefile_name, sends the bytes with one PUT to theupload_url, then callsadd_mediawith theupload_idand the timeline URL. Expected result: a sequence URL and a media bin id.Lay it out on a branch
The agent makes a 16:9 timeline with
new_timeline, creates a branch withtimeline_history, saves acheckpointon it, and places the recording withplace_mediaandlinked_audiotrue. Expected result: the recording on the timeline, with its sound.Transcribe and cut the dead parts
The agent prices
mediaaudio.transcriptwithdry_runon the recording's sequence URL fromadd_media, starts it withmax_credits, and calls again afterretry_after_sfor the words. It runsaudio.contentfor the silent spans. It shows you a cut list of pauses, ums and false starts. Once you approve, it cuts each span withedit_time_rangeinclose_gapmode, from the last to the first. Expected result: a tighter cut on the branch.Add b-roll over the talk
The agent reads the transcript for long stretches on one topic. It searches
stock_videowithsearch_libraryusing the words you say there, and adds your picks withadd_mediaandstock. It places each one on a track above withplace_mediainplace_on_topmode andlinked_audiofalse, so your voice keeps playing. For a shot stock does not have, it runsfind_modelswith the shot in words and reads its pick withget_model. A good pick isseedance_2_5.r2v, where apromptalone is enough. Your agent can search for others withfind_models. It callsgeneratewithdry_run: trueand 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. Expected result: b-roll over the talking parts, your voice under it, and a sequence URL for each generated shot, read withread.Add music under the voice
The agent adds a stock track from
stock_music. For music made to the episode's length, it runsfind_modelswith "instrumental music bed" and reads its pick withget_model. A good pick iselevenlabs_music_v2_5_instrumental. It callsgeneratewithdry_run: trueand 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, and reads the sequence URL withread. It places the track withinsert_mediaon its own audio track, and sets its level withset_audio_gain. It adds theduckerto the music track withadd_audio_effect. A new timeline ducks underA1by default, so the agent setsset_sidechain_sourceonly when your voice is on another track. Expected result: music that dips when you talk.Add captions and chapters
The agent adds captions with
add_captionsfrom the transcript's word times. It marks each topic change withadd_markerand aname, then writes the chapter list with timecodes for your YouTube description. Expected result: captions on the timeline, and a chapter list you can paste.Check, export, and make a thumbnail still
The agent runs
captureat the start, a few cuts, the b-roll and the end, and runscheck_timeline. Then it runsexportwithformatvideo and atarget_lufsfor YouTube, and a secondexportwithmodeimage andstill_atthe frame you want for the thumbnail. Expected result: a 1080p MP4 and a still image, each on a card with statuscompleted.
The same job from a terminal:
invideo project new --title "Episode 12"invideo agent register <project-url> --name <name>export INVIDEO_AS=<name>invideo edit new <project-url> --name "Episode 12"invideo asset upload <edit-url> ./episode-12.mp4invideo edit show <edit-url> --jsoninvideo branch new <edit-url> --name first-cut --token <state_token>invideo media audio.transcript <sequence-url> --dry-runinvideo media audio.transcript <sequence-url> \ --max-credits <price>invideo media audio.content <branch-url> --asset m1invideo library search <project-url> --library stock_video \ --query "coffee beans roasting"invideo asset add <branch-url> --stock <id>invideo gen models <project-url> --query "b-roll shot from a prompt"invideo gen model <project-url> --model seedance_2_5.r2vinvideo gen run <page-url> --model seedance_2_5.r2v --dry-run \ -i prompt="close up of coffee beans tumbling in a roaster"invideo gen run <page-url> --model seedance_2_5.r2v \ --max-credits <price> --idempotency-key broll-roast \ -i prompt="close up of coffee beans tumbling in a roaster"invideo status <thread-url> --waitinvideo edit show <branch-url> --jsoninvideo edit change <branch-url> --timeline T1 \ --token <state_token> --operations @ops.jsoninvideo edit capture <branch-url> --at 0,60,300,900 --out ./framesinvideo 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 ./outinvideo edit export <branch-url> --format video --mode image \ --still-at 312 --jsoninvideo status <card-url> --waitinvideo notebook show <card-url> --out ./out/stillWhere each value comes from:
<name>is the name you choose ininvideo agent register.INVIDEO_ASpasses it to every later command.<project-url>comes frominvideo project new, and<edit-url>frominvideo edit new.<sequence-url>is theurlthatinvideo asset uploadreturns.m1is the recording's bin id from the same result, and works for reads likeaudio.content. A transcript refuses--asset.<state_token>comes frominvideo edit show <edit-url>for the branch command.<branch-url>is the.branch_urlthatinvideo branch newreturns. Foredit change,<state_token>is read again withinvideo edit show <branch-url>. The main token is stale on the branch.<price>is each dry run's.estimated_credits.<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>.<thread-url>is theurlthe paidgen runreturns.@ops.jsonreads a bare JSON list of ops, theoperationslist of the call below.<card-url>is.sequences[0]of each export result, one for the video and one for the still.invideo statuswaits but saves nothing.invideo notebook showsaves the files, the video as./out/export.mp4, and the agent renames them.
The key MCP call puts one b-roll shot over the talk, marks a chapter and ducks the music under A1, the default source on a new timeline. This is the full call. <branch-url> is the branch URL that timeline_history returns, and <state_token> comes from get_timeline on it. m4 is the b-roll's bin id, from the add_media result. At 30 fps, 4 minutes 10 seconds is frame 7500.
{ "url": "<branch-url>", "timeline_id": "T1", "expected_state_token": "<state_token>", "operations": [ { "op": "place_media", "asset": "m4", "track": "V2", "at_f": 7500, "source_start_seconds": 2.0, "source_end_seconds": 8.0, "mode": "place_on_top", "linked_audio": false }, { "op": "add_marker", "at_f": 7440, "name": "Roasting", "color": "#ffd23f" }, { "op": "add_audio_effect", "target": "A2", "target_kind": "track", "effect": "ducker" } ]}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: the upload, every cut, your own b-roll, captions, markers, ducking, the export and the thumbnail still.
- Tool ops:
audio.content. The dry run shows its price before anything starts. - Costs credits: the transcript with
audio.transcript, once per file, each paid stock clip and track you place, and any shot fromseedance_2_5.r2vor track fromelevenlabs_music_v2_5_instrumental.
A long video takes the agent longer than a Short, from a few minutes for the cuts to under an hour with b-roll picked and checked. The export of a long video takes a while; the agent follows the card and does not export again. See Credits and what they cost for prices.
If something goes wrong
Most problems come from a big file, cuts in the wrong order, or b-roll that covers a moment you wanted on camera.
| 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. |
audio.transcript refused with code: "not_found", or CLI exit 2 | The call named a media bin asset. Pass the recording's sequence URL from add_media or invideo asset upload. |
invideo status --wait ends and the folder is empty | status does not download. Run invideo notebook show <card-url> --out <dir>. |
add_media with a link fails on a big file | Use start_upload, PUT the bytes, then add_media with the upload_id. |
| The export takes a long time | Follow the card with read or invideo status --wait. For a very long video, export in parts with start and end, then join them with media video.stitch. |
| B-roll covers a face you wanted | Move or shorten the b-roll clip with move_clip or trim_clip. |
| The b-roll has its own sound | It was placed with linked_audio true. Mute it with set_audio_muted, or place it again with linked_audio false. |
| Cuts land in the wrong place | They were made first to last. Restore the checkpoint and cut from last to first. |
| Chapters are off after more cuts | Markers sit at frames. The agent reads them with get_timeline after the last cut and writes the list again. |
| CLI exit 7 | Nothing ran. Run the same command again. |
Avoid: running export again to check on a slow one | Instead: read the export card, or invideo status --wait. Pass an idempotency_key so a retry finds the first. |
| Avoid: editing main | Instead: work on a branch, and you accept it in the editor. |
Prompts to try
Each prompt is a real variation of the job.
Make a first cut of my two hour stream VOD for YouTube. Cut every partwhere I am away or silent, keep the chat reactions, and mark a chapterat each game change.Edit my tutorial ./lesson.mp4: cut the mistakes and long pauses, zoomin on my screen when I click, captions on, no music. Give me athumbnail still where I show the result.Add b-roll from my own folder ./broll to every part where I talk aboutthe trip for more than 20 seconds. Use stock only where my clips donot fit.When to use something else
invideo does not upload to YouTube or set the chapters there. Paste the chapter list into the video's description in YouTube Studio. For a designed thumbnail with big text and a cut-out face, see the thumbnail page; the still from export is its starting frame.