Document reference
Every tag, action, anchor and hook of a VisoTalk document, spec 0.8.
The current spec is 0.8. Readers also accept saved 0.6 and 0.7 documents; recorded narration requires 0.7 or later. The types are the source of truth
(spec/ir/0.8/ir.ts), and visotalk schema prints the vocabulary below from the
validator itself (schema tags, schema actions, schema hooks; --json for data). This page is the same list with the reasons.
How a video is written is the walk-through.
A document
A document is a TSX module with two readers. The skeleton (Doc, Scene, Line, Part, Animation and the action tags) is read by the engine as text and
never run, so it is data: strings, numbers, booleans, lists and objects, and no variables or loops in it. The inside of a <Part> is ordinary React,
run by the player and the exporter, and may use anything in the module above export default.
- A string attribute is read as JSX reads it, with no escapes: put a value with a quote or a backslash in braces (
text={"say \"hi\""}). A list always takes braces (target={["a", "b"]}). A target is referred to by its id as a string. - Every id (document, scene, line, part, target) starts with a lowercase letter, then
a-z,0-9,_and-:bar-0, neverbarZero. - In a line's words write
<>&for<>&, and{}for{}. Comments are{/* … */}.
Recorded narration
visotalk recording take.mp4 --out doc.tsx creates a document with voice="recording:take" and the original audio/video asset, in the language that was spoken (English or Chinese; --lang only hints the recognizer), with comments at its top giving the silence before, between and after the speech. The file keeps its measured duration, pauses, video size and frame rate. Lines keep original speech, absolute span={{start,end}} and relative words; caption changes use text= and leave those measurements unchanged. Pacing does not retime a recording. --trim fillers,pauses[=0.8], only when the person asks, cuts hesitations and shortens silences between words into a new file beside the original (recorded as the asset's trim), before anything is drawn. A scene starts where its first line was said and ends where the next starts; a scene without lines starts where the speech before it ended, so music before, between and after the words belongs to a scene. A video recording is drawn under every scene and in any part that draws <Video asset="take">, always at the moment being heard; a layer leaves the one under the scenes out. Presenter-space rectangles on Doc (or on a Scene, for that scene) use keepClear={[{x,y,w,h}]} in canvas pixels, with from and to (seconds of the film) for a presenter seen in some shots only; QA reports graphic intersections while a region is on screen.
Uploaded licensed audio is placed with Sound. render doc.tsx --audio narration|mix|effects exports MP3; --layer mov|webm makes a transparent layer with effects and no narration; --over composites over the original video as MP4. Music generation is deferred.
Tags
Attributes in [ ] are optional.
| Tag | Attributes | What it is |
|---|---|---|
Doc | id title lang [description poster sources generator created updated spec theme tokens voice speed lexicon canvas pacing exports keepClear] | The root. Its children are Canvas, Asset, Part (global: it outlives the scenes) and Scene |
Scene | id [title duration keepClear] | Lines, parts, one Animation and any Sounds. A scene without lines needs duration (seconds), except with recorded narration, where the recording gives each scene its length. keepClear says where the presenter is in this scene, instead of the document's ([] when they are covered or moved) |
Line | id [text hold i18n] | The words spoken are its children, and they are the caption. text is the caption when it differs (digits for numbers spoken as words); hold is silence after the line. <Mark id="x">phrase</Mark> names a phrase an action can start on |
Part | id [x y w h z] | A box (default the whole canvas) holding React: elements, or a function that returns them (hooks run inside it). Invisible until an Appear. In a Scene it ends with the scene; in Doc it stays |
Animation | The actions of the scene, in any order | |
Sound | asset + where it starts [id dur volume loop fadeIn fadeOut duck] | Music or an effect of an <Asset kind="audio">, in a Scene. volume and duck are dB, fadeIn, fadeOut and dur seconds. loop without dur lasts to the end of the film; fadeOut needs dur or loop; the narration is never changed |
Asset | id kind src license [source analysis proxy] | A file the document uses (kind is image, video, audio, font or data), read in a part with useAsset(id). Every asset carries its licence and source; the credits are generated from them |
On Doc, canvas="16x9" (or "9x16") sets the canvas, theme and tokens the colours and fonts (visotalk schema themes prints each theme's tokens and the faces a film can use: build embeds the installed faces the font stacks or a part's code name), pacing the silences (lead, hold, tail, 0.4, 0.4 and 0.8 seconds),
and texts={{id: '…'}} the words a person edited. voice, speed and lexicon are in the CLI page.
exports takes variants (a list of canvas presets), fps (30 by default) and captions: burned on the picture, sidecar as captions.srt, both, none, or
words, the spoken words in the lower half of a tall frame.
Where an action starts
Exactly one of the following; offset={seconds} adds to any of them.
| Form | Starts |
|---|---|
line="l1" word="phrase" | At the start of that phrase in the line's speech; edge="end" for the end of it. The phrase is any text the line says, case and punctuation aside. nth={2} picks the second occurrence. In Chinese, Japanese and Thai a phrase is any run of characters |
line="l1" mark="name" | At the phrase a <Mark id="name"> wraps in that line; edge="end" for its end |
line="l1" | At the start of the line; edge="end" for its end |
after="id" | When the action with that id ends (edge="start": when it begins). A chain must begin on a word, a scene time or a scene edge |
at={1.5} | Seconds into the scene |
at="start" or at="end" | The scene's edges |
Actions
| Action | Attributes | What it does |
|---|---|---|
Appear | target + where it starts [dur stagger easing id] | Shows a target (default 0.45 s). Every part is invisible until an Appear, and so is any other target whose first action is an appear |
Disappear | target + where it starts [dur stagger easing id] | Hides it (default 0.3 s) |
Tween | target + where it starts + to={{...}} [dur stagger easing repeat yoyo id] | Moves props to new values over dur (default 0.6 s), from the value they have then. Props are numbers, colours and lengths. repeat plays it again (-1: for the whole film) and yoyo plays every other time backwards. x, y (px), scale and rotate (deg) move the target itself |
Set | target + where it starts + to={{...}} [id] | Changes props at once: numbers, strings, true and false |
target is one id or a list; with stagger={0.1} the targets of a list start 0.1 s apart. A Tween or Set puts changed props in to={{...}}, so a prop may share a name with an action attribute (for example, to={{line: 2}} while line="l1" anchors the action).
easing is linear, easeIn, easeOut or easeInOut (cubic curves), those with Sine, Quad, Quart, Quint or Back after them (easeOutQuart,
easeOutBack(2.2) overshoots by 2.2), or cubic-bezier(x1, y1, x2, y2).
An action's target is a part, or an element a part registers with <Obj id> or useTarget. Ids are unique within a scene. A scene's actions reach only its own parts' targets;
a global part's targets are reached by every scene's actions.
Hooks
These work only inside a part's React, and come from @visotalk/runtime.
| Hook | What it gives |
|---|---|
useTarget(id) | Props to spread on the element that is the target id (data-vt and a style: opacity, visibility, transform). Merge your own style over it, never replace it |
<Obj id as? style?> | A div (or as="g", "span") that is a target: useTarget in a tag |
useProp(name, base) | A prop of the part it runs in that Tween and Set change: its value now, base before the first. useProp(id, name, base) is the same for the target id |
useText(id, base) | Words a person may edit: the text written in <Doc texts> for this id, or base until there is one |
useTime() | Seconds since the scene on screen started: draw by it, never by a timer |
useDocTime() | Seconds since the start of the video |
useFrame() | The frame the clock is on |
useCanvas() | {width, height, preset}: the canvas it is drawn on |
useTheme() | The theme tokens {colors, fonts, radius, space}, also as CSS variables (var(--vt-data), var(--vt-sans)) |
useAsset(id) | The URL of an <Asset> |
useScenes() | The scenes as {id, from, end} in seconds, for a picture that spans them (a chapter rail) |
useSounds() | The <Sound>s as {asset, start, end?} in seconds, for a picture that answers a sound (a flash on a hit) |
random(key) | A deterministic random generator: the same key gives the same numbers |
<Video asset in? start? rate? fit?> | A clip of an <Asset kind="video">, played from in seconds of the source at rate, starting start seconds into the scene. Its sound is not used |
A frame is a function of the clock, so validate refuses Math.random, Date, timers, fetch and CSS animations or transitions in a part
(code.nondeterministic, with what to use instead).
What validate reports
Every issue is one line at doc.tsx:line:col with a code, most with a fix; --json gives them as data.
| Code | Means |
|---|---|
id.format, id.duplicate | An id that breaks the rule above, or one used twice |
part.appear | A part nothing appears |
anchor.word | The phrase is not in the line |
anchor.ambiguous | The phrase occurs twice; the issue lists every place, so write a longer one or use nth |
anchor.action, anchor.cycle, anchor.after-negative | An after that names no action, a cycle of actions that follow one another, or an offset that puts an action before the one it follows |
action.id | An action id that is not unique in the document |
code.nondeterministic | A part uses something a frame may not depend on |
target.unregistered | An animation names a target no part registers; it stops render |
qa adds what only a rendered frame shows: text over text (text-overlap), text cut by a shape (text-crossed), ink past the canvas or under the captions, an object on screen for under two
seconds (visible.brief), a part that appears with nothing drawn while what it holds waits for appears of its own (part.appears-empty), a target registered twice (target.duplicate), and anchors resting on an estimated or weak alignment (align.estimated, align.weak).