Skip to content
urdidourdidoDocs

Narrate a video

The narration is bought from ElevenLabs with your own key, one take per line of the script. urdido plans first and pays only when you say so, then hears every take back against its line.

  • The narration extra: pip install "urdido[narration]".
  • Your ElevenLabs key in ELEVENLABS_API_KEY.
Terminal window
urdido prepare video.toml --language en

The plan lists what would be bought and what it costs, and makes no paid call. Nothing is paid without --authorize-take and --execute; --max-cost caps the combined estimate.

Before anything is bought, the opening check refuses an intro that opens on a preamble (“today we will…”) or whose first proof comes later than 20 seconds at the narrator’s declared pace.

Authorize each take by name, and execute:

Terminal window
urdido prepare video.toml --language en --authorize-take intro --authorize-take outro --execute

Each take lands under narration/<language>/, with a .prov.json beside it that records how it was made.

Each bought take’s transcript is aligned with its line.

  • A word the script’s pronounce map names that is missing or misheard refuses the take, with the second it should have been said.

  • The script’s lexicon names the heard forms of a name that pass and those that refuse the take:

    { "Dolmen": { "heard": ["Dólmen"], "refused": ["Domem"] } }
  • Numbers, Roman numerals and spelled letters are read alike on both sides, so they raise no false alarm.

Re-buy a refused take with a reason:

Terminal window
urdido prepare video.toml --language en --retake intro --retake-reason "said the name wrong"

If a take has no word times, urdido words video.toml --language en writes them.

The script’s prosody (for example { "min_range": 3.0, "max_rate": 7.0 }) lists a flat, rushed or falling-question sentence for review, with the bound it missed. When you have heard a take and liked it, record that:

Terminal window
urdido prepare video.toml --language en --approve intro

From five approved sentences on, that voice is held to the ranges you approved instead of the typed bounds.

Two endings are caught on every take, whether or not prosody is declared:

  • A last word cut short. A transcriber often writes a word back whole from context (“noventa” when the voice said “no”). urdido measures the last word from its start to where the voice stops, per syllable of the word as written. Under 0.08 s a syllable the take is listed as cut and is not ready. A number the script writes in digits is not measured, since digits do not say how many syllables were spoken. "min_pace" in prosody changes the bound.
  • A statement that ends level in a voice that closes falling. When the approved statements of a voice close at least 3 semitones down as a rule, a statement that closes less than 40% as far is listed for review. A voice that closes level is never held to a fall, and a question may rise.
Terminal window
urdido build video.toml --language en --plan
urdido voice video.toml --language en

urdido voice reads the cut’s last plan and writes review/voice.en.html beside the cut, with review/voice.en.json holding the same data for an agent. For every sentence of every placed take, the page shows:

  • the text and what was heard, with each refused, missing or added word marked;
  • its waveform and pitch curve, and its range, rate, closing fall and last word’s pace;
  • the take kept, why, and how many takes it beat, where a best-of ledger is beside it;
  • its second on the cut and the pause before it.

If the cut is built, the page also shows the frame on screen at each word a shot pins a footage moment to.

A voice reads the same line differently each time. With "best_of": 3 in the script, prepare --execute scores each take it buys: words the hearing refuses, a last word cut short, words heard differently, then prosody findings, in that order of weight. While a take is not clean it is bought again, up to three takes and never past --max-cost, and the take with the fewest faults is put in place. The others stay beside it as <line>.retake-<time>.mp3.

<line>.takes.json beside the take lists each take’s seed and scores, which one was kept and why. A line whose text is unchanged is not bought again. Best of several costs little on a voice on this machine, where a take costs time, not credits.

A voice served on your own computer, such as VoiceStudio, costs GPU time instead of credits. Declare it in polyweave.toml with no prices:

[service.voicestudio]
base = "http://127.0.0.1:3900"
adapter = "voicestudio"

In the script, voice is the saved VoiceStudio profile id and model the engine (voxcpm2, omnivoice). Name the service when you plan and buy:

Terminal window
urdido prepare video.toml --language en --service voicestudio --authorize-take intro --execute

The plan shows the seconds the takes should take instead of a price, and --max-cost is not needed. Each take is transcribed on the same machine (polyweave’s local transcriber, which needs faster-whisper), so no transcription is bought either.

Each take’s record keeps the service, the engine and the engine’s licence. The description’s credit line names the service and engine that read the takes (Narration generated with voicestudio (voxcpm2).) unless the storyboard declares its own generated line. Some engines’ weights forbid a channel that earns: OmniVoice’s are CC-BY-NC. Declare the channel as commercial and a take read by such an engine stops the plan, naming the take and its licence:

[narration]
commercial = true

VoxCPM2 reads a line differently on each run unless it is given a seed, and it takes a direction as an instruction beside the text, not inside it. Declare both in the script, or per speaker:

{
"seed": 7,
"direct": "instruct",
"question": "rising at the end, a real question",
"directions": { "outro": "slow and warm, a farewell" }
}
  • seed: a whole number from 0. An unchanged line is read the same way on every run.
  • direct = "instruct": each line’s directions entry goes to the voice as an instruction, and its text is sent without the bracketed direction. The default, "bracket", puts the direction in brackets before the text, as ElevenLabs reads it.
  • question: the instruction for a take whose text ends in ? and which has no direction of its own.

Changing the seed or a line’s instruction means the take has to be bought again. A take bought again with the same seed would read the same, so a --retake, or a take that best of several buys again because it was cut short, is read with the next seed. The seed of the take that passed is kept in seeds.json beside the takes, and the take stays current under it until you change the declared seed. A service that takes no seed or instruction refuses them by name before anything is bought.

The script declares speakers ({ "tuki": { "voice": "..." } }) and read_by ({ "chapter-2-result": "tuki" }). Each speaker’s lines are bought in its voice, and changing a line’s speaker makes it a retake. A speaker’s name opens its first caption after another voice (Tuki: ...).

A line’s own delivery ({ "chapter-2": { "style": 0.9 } }) and directions (a bracketed direction the voice reads before the text) make it its own purchase; changing either is a retake.

A line read as one take runs its sentences together. Name the line in the script’s by_sentence and each sentence is bought as its own take, with the line’s voice, delivery and direction:

{ "by_sentence": ["chapter-2"], "breath": 0.35 }

Authorize the line as usual (--authorize-take chapter-2). prepare buys chapter-2.s1.mp3, chapter-2.s2.mp3 and so on, hears each one back, and joins them into chapter-2.mp3 with breath seconds of silence between sentences (0.35 by default). Every cut reads the joined take as it reads any other.

Retake one sentence alone by its number, and the line is joined again:

Terminal window
urdido prepare video.toml --language en --retake chapter-2.s3 --retake-reason "rushed" --authorize-take chapter-2 --execute --max-cost 1

--retake chapter-2 buys every sentence of the line again. Changing breath joins the line again without buying anything.