Ask the assistant
0/400
Your question is processed by an AI service and kept to improve answers. Do not enter personal data.

    Video and sound in a film: *Footage and *Sound

    A video clip and a sound track inside a film ( *Scene ). Both live on the film's clock, not on their own: the frame of a clip and the moment that is heard are functions of the scene's t and nothing else. WHEN a clip or a sound plays in the film is decided by the *Layer in:/out: around them (and *Delay by: ); WHICH piece of the file to take is decided by their own trim: .

    *Scene duration:12s fps:30 time:@t size:[1080,1920]
      *Layer in:0 out:12s
        *Footage src:"footage/walk.mp4" fit:cover
      *Layer in:2s out:10s
        *Sound src:"music/intro.mp3" gain:-6 trim:[0s,8s]

    Video and Audio inside a scene are an error, not an alternative: they have their own clocks, unrelated to the film's clock, and the playback_clock_in_scene diagnostic says so. A clip in a film is *Footage , a sound is *Sound .

    *Footage

    A clip on the film's clock: the frame AT THIS second, not a player.

    Type: leaf

    *Scene duration:12s fps:30 time:@t
      *Layer in:0 out:12s
        *Footage src:"footage/walk.mp4" fit:cover

    The difference from the Video element is the difference between a film and a playback surface, not a matter of taste. Video owns its clock: it plays, seeks approximately and keeps running. Inside a scene the clock belongs to the film, so a player under a scene looks almost right in the preview and falls apart on export, where frames are drawn faster than real time and out of order. *Footage requests one exact frame and waits for it.

    Parameters

    Parameter Type Default Description
    src string — Path to the clip from the project root ( footage/walk.mp4 ); an absolute path or a URL works too
    trim [from, to] — A piece of the CLIP: seconds or durations. trim:[3s,15s] starts the layer at the 3rd second of the file
    speed number 1 Seconds of clip per second of scene; 2 — twice as fast
    fit string — How the frame fills the box: cover , contain , fill
    focusX number 0…1 0.5 Which point across the width of the frame cover keeps: 0 — the left edge, 1 — the right one. Accepts {x} — a pan is keys on a *Track
    focusY number 0…1 0.5 Which point across the height cover keeps: 0 — top, 1 — bottom
    poster color — Color drawn until the frame arrives, and where it cannot arrive
    supported output @name — Variable that receives whether a decoder is present
    alpha string — packed — video without a background: the picture in the left half, its alpha as brightness in the right half; the clip is drawn at half the file's width with that alpha
    z number — Drawing order in the nearest *Stack , *Scene , *Artboard or a group of several children: higher is closer and drawn later; no key — 0; equal keys keep document order. Read every frame. Inside *Layer / *Track /effects it is the key of the whole branch
    mute boolean false Do not take this clip's sound at all
    gain number (dB) 0 Volume of the clip's own track in DECIBELS; 0 — as recorded
    fadeIn seconds — How many seconds the clip's sound takes to rise from silence where it starts
    fadeOut seconds — How many seconds the clip's sound takes to fade into silence where it ends
    duck number (dB) 0 By how many DECIBELS the clip's sound dips while a sound with role:"voice" plays. The dip starts 0.15 s before each line and recovers 0.4 s after it
    role string — "voice" marks the clip's sound as speech — what duck: makes room for

    The clip has sound

    A video file with a sound track inside a film is heard by default. Its sound goes through the same mix as *Sound , by the same rules — the layer window, trim: and gain: — so a clip and a music layer cannot end up on different clocks. trim: cuts the same piece for the picture and for the sound.

    *Scene duration:10s fps:30 time:@t size:[1080,1920]
      *Layer in:1s out:9s
        *Footage src:"footage/cafe.mov" trim:[6s,18s] gain:-9

    mute:true is for a clip used as a texture (a background loop, a pattern behind a caption), where sound from the picture would be a surprise.

    With a changed speed: the sound CHANGES TOGETHER WITH THE PICTURE: slow the clip down and the sound slows down with it, pitch included, as on tape. Both read the same stretch of the file and cannot drift apart. Keeping the pitch while stretching time is a different algorithm, and it is not here: prepare such a sound separately and add it with *Sound .

    Without a decoder

    A build without a decoder draws poster and publishes supported:false — the same film opens everywhere instead of failing on machines that cannot decode:

    *Scene duration:8s fps:30 time:@t
      *Footage src:"clip.mp4" poster:0xFF101018 supported:@ok

    Examples

    A horizontal clip in a vertical frame

    fit:cover fills a 9:16 frame from a 16:9 clip, showing about a third of its width. Which third is decided by focusX: ; a pan following the subject is keys on a *Track that focusX: reads:

    *Scene duration:8s fps:30 time:@t size:[1080,1920] viewBox:[1080,1920]
      *Layer in:0s out:8s
        *Track value:@pan curve:easeInOutCubic
          *Keyframe at:0 v:0.3
          *Keyframe at:3 v:0.3
          *Keyframe at:4.5 v:0.75
          *Footage src:"footage/interview.mp4" trim:[12s,20s] fit:cover focusX:$pan mute:true

    Do not build this from *Clip and *Transform scale: — you would have to pick the scale for each clip by hand, and a wrong one shows empty edges.

    A person from a video over a different background

    The background is cut out in advance (in the editor — "Cut out background…" on the file): next to the source appears footage/hero.cutout.mp4 — the picture in the left half, the alpha in the right one. It is placed with alpha:packed :

    *Scene duration:6s fps:30 time:@t size:[1080,1920] viewBox:[1080,1920]
      *Sprite src:"data/images/street.png" x:0 y:0 w:1080 h:1920
      *Layer in:0
        *Footage src:"footage/hero.cutout.mp4" alpha:packed fit:contain

    Without alpha:packed the scene draws both halves side by side.

    *Sound

    A sound layer of a scene: it draws nothing; the export mixes it into the film, and the editor's live preview plays the same mix — you hear the rhythm and the entries while you build.

    Do not confuse it with Sound without the asterisk — that one plays a sound on a page when something happens (a timer ran out, a button was pressed). *Sound is a FILM track, a layer inside *Scene .

    Type: leaf

    *Scene duration:12s fps:30 time:@t size:[1080,1920]
      *Layer in:2s out:10s
        *Sound src:"music/intro.mp3" gain:-6 trim:[0s,8s]

    Sound is placed with the same words as motion: *Layer in:/out: says when it is heard, *Delay by: shifts it, and a layer inside a layer counts from the outer one — exactly like everything visible. There is no separate sound track and no side file: one scene, one file, one diff.

    *Sound takes no box (markup with sound lays out the same as without it, and music will not move a caption), draws nothing (it needs no position, size or color) and is not a player.

    Parameters

    Parameter Type Default Description
    src string — Path to the sound file from the project root ( sound/speech/hi.wav ); an absolute path works too
    trim [start, end] — Which stretch of the FILE to take
    gain number (dB) 0 Volume in DECIBELS; 0 — as recorded, negative — quieter
    fadeIn seconds — How many seconds the sound takes to rise from silence where it starts
    fadeOut seconds — How many seconds it takes to fade into silence where it ends — at the layer's out: , at the end of trim: or at the end of the file
    duck number (dB) 0 By how many DECIBELS this sound dips while a sound with role:"voice" plays: duck:-10 — music under speech. The dip starts 0.15 s before each line and recovers 0.4 s after it
    role string — "voice" marks speech — what duck: makes room for

    trim cuts the FILE, *Layer places it in the SCENE

    Two different times, and mixing them up is a common mistake:

    *Scene duration:12s fps:30 time:@t
      *Layer in:2s out:10s            // heard from the 2nd to the 10th second of the film
        *Sound src:"sound/song.mp3" trim:[30s,38s]   // and what is heard is 0:30…0:38 of the song

    A stretch past the end of the file is silence, not a failure: a layer may outlive the sound under it.

    gain is decibels, and it is a number

    gain:-6 , not gain:-6db and not gain:0.5 . There is no db literal in the format (it knows s and ms ) — the unit is carried by the parameter's NAME. gain:0 — the file as recorded; positive values are louder and can clip material that is already at the ceiling.

    Sounds playing at the same time add up: two layers at −6 dB together give 0 dB. If both have to be heard, leave headroom.

    Examples

    Music from parts

    Each part is its own *Sound ; only the part that did not work out is redone:

    *Scene duration:90s fps:30 time:@t
      *Layer in:0s out:90s
        *Sound src:"sound/music/drums-a1b2c3.wav" gain:-14
        *Sound src:"sound/music/bass-d4e5f6.wav" gain:-11
        *Sound src:"sound/music/keys-0a1b2c.wav" gain:-13 fadeIn:2s

    A score: a sound for every event

    *Sound inside *Repeat plays on EVERY iteration — at the moment of its layer, with its own file and volume:

    JsonData src:"data/score.jsonl" data:@score count:@n
      *Scene duration:32s fps:30 time:@t
        *Repeat count:$n
          @Macros index:0
            *Layer in:{1 + (score[index]['bar'] - 1) * 2 + (score[index]['beat'] - 1) * 0.5}
              *Sound src:{"sound/kit/" + score[index]['s'] + ".wav"} gain:{score[index]['g']} duck:-12

    Best practices

    • Music under speech is one steady gain: , not scissors. Keep the bed at one level, low enough for the voice ( gain:-10 … -14 ), for the whole film. Cutting it into loud and quiet pieces clicks at every joint, and a dip under every line ( duck: ) is heard as "pumping" — use it only on request. Still mark every line with role:"voice" . fadeIn: / fadeOut: round off the starts and ends.
    • Paths from the project root , relative, the same for *Footage and *Sound : src:"footage/walk.mp4" , src:"sound/music/…wav" . An absolute path survives only one computer.

    See also

    • Sound — a page sound on an event (without the asterisk)
    • AI video — *AiShot and *AiReplace , including replacements in live *Footage video