raea/video

Footage and time-shifted sequences: Video, Sequence, Series, Loop and Freeze.

View as Markdown

<Video> shows a clip in step with the frame: the renderer decodes it natively and draws the frame the composition asks for, so scrubbing and rendering agree. Trim it with trimBefore and trimAfter, set its level with volume or gainDb, and frame a talking take on its face with framing="face". <Sequence> shifts time for what it holds, <Series> plays its children one after another, <Loop> repeats, and <Freeze> holds a frame.

TSX
import { staticFile } from "raea";
import { Series, Video } from "raea/video";

function Cut() {
  return (
    <Series>
      <Series.Sequence durationInFrames={90}>
        <Video src={staticFile("media/interview.mp4")} trimBefore={120} framing="face" />
      </Series.Sequence>
      <Series.Sequence durationInFrames={60}>
        <Video src={staticFile("media/broll.mp4")} muted />
      </Series.Sequence>
    </Series>
  );
}
TS
import { Freeze, Loop, Sequence, Series } from "raea/video"

raea/video exports 5 components, 8 types. Bevy's counterpart: raea's own; Bevy has no video crate. Source: sdk/raea/src/video.ts.

Components

Freeze

Shows its children as they are at frame, whatever the parent's frame.

PropTypeWhat it does
frame (required)numberthe frame its children see, whatever the parent's frame
childrenReactNodewhat's held

Loop

Repeats its children every durationInFrames frames, times times (forever by default).

PropTypeWhat it does
durationInFrames (required)numberthe length of one loop, in frames
timesnumberhow many times it plays (forever by default)
namestringits label in the timeline and the render manifest
layoutSequenceLayout"absolute-fill" (default) or "none", as a Sequence's
styleCSSPropertiesthe wrapping box's style
classNamestringthe wrapping box's classes
childrenReactNodewhat loops

Sequence

Shifts time by from and shows its children only for durationInFrames frames.

PropTypeWhat it does
fromnumberthe parent frame its frame 0 falls on (0)
durationInFramesnumberhow many frames it shows its children (forever by default)
namestringits label in the timeline and the render manifest (data-sequence)
layoutSequenceLayout"absolute-fill" (default) wraps the children in a full-size box; "none" adds no box
widthnumberthe width its children see, px (the parent's by default)
heightnumberthe height its children see, px (the parent's by default)
styleCSSPropertiesthe wrapping box's style
classNamestringthe wrapping box's classes
childrenReactNodewhat plays in it, at its own local time

Series

Plays its Series.Sequence children back to back, each shifted by its own offset.

PropTypeWhat it does
childrenReactNodethe Series.Sequence slots, played back to back

Video

A video clip in step with the frame; data-source-time is the source time (seconds) to show.

PropTypeWhat it does
framing"face"ours: frame the take on the largest face
punchInnumberours: multiplies the framing's scale (1.15 is the usual)
matteVideoMatteours: its cutout: the mattes made of its file, which it wears as its mask, so what is cut out shows what is under it

Also takes the props of MediaProps.

Types

FreezeProps

The props of Freeze, tabled there.

LoopProps

The props of Loop, tabled there.

MediaProps

FieldTypeWhat it is
src (required)stringthe file: staticFile("clip.mp4"), or a generated asset
startFromnumberwhere in the media it starts playing (0), counted in the composition's frames, not the media's own: a 24 fps clip in a 60 fps film starts at its 4 s with startFrom={240}; the same as trimBefore
endAtnumberwhere in the media it stops (exclusive), in the composition's frames like startFrom: it holds the last frame, or loops; the same as trimAfter
trimBeforenumberhow much of the media is cut off its start, in the composition's frames (the newer name for startFrom)
trimAfternumberwhere the media is cut, in the composition's frames (the newer name for endAt)
volumeVolumeProplinear gain, 1 being unity (0.5 is about -6 dB, 1.78 about +5 dB), or a function of the media's own frame
gainDbVolumePropours: the gain in decibels (or a function of the media's own frame returning it); wins over volume
fadeInnumberours: seconds to ramp the sound in from silence at its start (applied by the renderer at the audio's rate)
fadeOutnumberours: seconds to ramp the sound out to silence by its end: the end of its Sequence or Loop pass, or endAt, whichever comes first (one removed some other way fades out after it's gone)
playbackRatenumberhow fast it plays (1): 2 is double speed
speedCurveSpeedPoint[]ours: its speed as a curve over its source, [place, speed] points: the place from 0 (startFrom) to 1 (endAt, which it needs), the speed from 0.1 to 10 and changing in a straight line between two points. Wins over playbackRate; its Sequence is as long as the curve takes (speedLength)
mutedbooleanplay no sound
loopbooleanstart again from startFrom when it reaches endAt
busstringthe bus it plays into: a named channel of the edit's Tone graph (music, sfx, voice, ambience, ui), so it takes that bus's volume, effects and ducking (raea/tone buses)
namestringthe entity's name, for picking, the inspector and world.*
classNamestringTailwind or CSS classes
styleCSSPropertiesinline style

SequenceLayout

TS
type SequenceLayout = "absolute-fill" | "none"

SequenceProps

The props of Sequence, tabled there.

SeriesSequenceProps

FieldTypeWhat it is
offsetnumberframes from the previous slot's end to this one's start (0); negative overlaps
heightnumberthe height its children see, px (the parent's by default)
styleCSSPropertiesthe wrapping box's style
childrenReactNodewhat plays in it, at its own local time
classNamestringthe wrapping box's classes
namestringits label in the timeline and the render manifest (data-sequence)
widthnumberthe width its children see, px (the parent's by default)
durationInFramesnumberhow many frames it shows its children (forever by default)

VideoMatte

A clip's mattes: PNGs whose alpha is what is kept, m00001.png on, in one folder of the media folder.

FieldTypeWhat it is
src (required)stringthe folder, as staticFile gives it: staticFile("matte/take-person")
fps (required)numberthe file's frame rate: m00001.png is its frame 0
everynumberone matte each every frames of the file, held until the next (1, every frame, when left out)
count (required)numberhow many mattes there are: past the last, the last is worn

VideoProps

The props of Video, tabled there.