Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

TL7k: a composition's footage held steady. sdk/timeline: a media row carries steady (of, level) when its <Video> plays a steadied copy; its clip's props are its own file and the copy (file, stabilise, steadied), and a set of those on footage is the host's new steady edit (raea-feed 7600f78: the host reads the <Video>'s whole file, keeps the moves in its media folder's steady/ and has raea render a copy with each frame's move as the player wears it; the edit writes src={staticFile(copy)} data-steady-of data-steady, the src as it was when off). A 2 s clip shaken along a known path steadied for real in 3.4 s, its frame-to-frame shake 7.49 px to 2.12 at 320 px; a copy with no moves is its file's every frame. The manual's editor page regenerated (pbr.md's drift left out)

shinyobjectza77d68ef939c
diff --git a/docs/manual/reference/sdk/editor.md b/docs/manual/reference/sdk/editor.md
index fdcde778..8f4c1905 100644
--- a/docs/manual/reference/sdk/editor.md
+++ b/docs/manual/reference/sdk/editor.md
@@ -1032,6 +1032,7 @@ the lane it sits on (nested ones below their parent, overlapping ones apart), an
| `muted` | `boolean` | a <Video> whose own sound was taken out (muted): its sound is an <Audio> of its own |
| `file` | `string` | its media's file, a path in the composition's media folder (where its src is staticFile("…")) |
| `heard` | `{ of: string; denoise?: boolean; voice?: string }` | that file is a copy of `of` with its noise reduced or its voice changed |
+| `steady` | `{ of: string; level: string }` | that file is a copy of `of` held steady at `level` |
### `Showing`
diff --git a/docs/timeline.feature b/docs/timeline.feature
index 448ce3a8..90bd2f4b 100644
--- a/docs/timeline.feature
+++ b/docs/timeline.feature
@@ -59,7 +59,7 @@ Feature: The timeline SDK (0.1.5): CapCut's timeline, on the composition, in the
constant and curve. Adjust: brightness, contrast, saturation, exposure, sharpen, highlights, shadows,
temperature, tint, fade, vignette, grain. Audio: volume, fades, noise reduction, voice changer. Text: font,
style, effects, bubbles, animation, and its words read aloud.
- Here 11-14: Basic (TL3h, TL5) with stabilise (TL7k, a film's footage; a composition's not yet), auto cutout
+ Here 11-14: Basic (TL3h, TL5) with stabilise (TL7k, a film's footage and a composition's <Video>), auto cutout
of a person or the subject (TL7l, a film's footage, on a Mac) and a custom one brushed on the picture (TL7m), Retouch (TL7n: smooth, brighten, slim face and bigger eyes, a film's footage or a file from Media, on a Mac), Mask, chroma key and Blend (TL7f) with the key's colour picked from
the picture (TL7h) and the mask's handles dragged there (TL7i), Animation (TL7d, TL7e), Speed (TL6), Audio's
volume and fades (TL8a) and its noise reduction and voice changer (TL8d, a film's sounds and a composition's
@@ -192,7 +192,11 @@ Feature: The timeline SDK (0.1.5): CapCut's timeline, on the composition, in the
a Gaussian-weighted line, so a pan stays a pan to the clip's ends; on a shaky clip made from a real
frame along a known path, the shake 21 px down to 0.23 and its turn 0.54 deg to 0.03, a 1 Hz sway
12 px kept to 5.4 at Minimal cut and held to 2.9 at Most stable, zoom 1.05 to 1.06, 34 ms a frame
- read and the kept file read again in 28 ms), TL7l (footage cut out, CapCut's Auto cutout: Apple's
+ read and the kept file read again in 28 ms; in a composition, its <Video>'s whole file read, the moves kept in its
+ media folder's steady/ and a steadied copy rendered by raea beside them (a composition playing the file
+ with each frame's move as the player wears it), which the <Video> plays, saying what it was made from
+ (data-steady-of, data-steady), off its src as it was; a 2 s clip shaken along a known path steadied in
+ 3.4 s, its frame-to-frame shake 7.49 px to 2.12 at 320 px, a copy with no moves its file's every frame), TL7l (footage cut out, CapCut's Auto cutout: Apple's
Vision on the host through osascript's JavaScript, its person segmentation (macOS 12) or its
subject mask (macOS 14), each frame of the part the clip shows as a 512 px matte PNG under
media/matte, 120 frames a run, its index written last; the player wears the frame's matte as the
@@ -259,7 +263,8 @@ Feature: The timeline SDK (0.1.5): CapCut's timeline, on the composition, in the
TL10d), finished and posted on Send with the agent told (TL9b). A scene's sequences: move, trim,
split, delete written into the scene's own file, which the stage opens again (TL14c). A sound's
clips: span, place in the file, level (TL14b). An <Audio>'s sound from its copy with its noise
- reduced or its voice changed: its src the copy, and data-voice-of, data-denoise and data-voice (TL8d)
+ reduced or its voice changed: its src the copy, and data-voice-of, data-denoise and data-voice (TL8d).
+ A <Video>'s footage from its steadied copy: its src the copy, and data-steady-of and data-steady (TL7k)
plays TL10a for a film's own frames: cuts, moves, trims, speeds, freezes and reversed footage at once, the
player's buffer on the ruler. TL10f: a timed 3D scene's frames are drawn ahead by the host a few
seconds at a time at draft quality and kept by range, each range under what it is drawn from (the
diff --git a/sdk/timeline/src/read.ts b/sdk/timeline/src/read.ts
index 989a969e..499f9d25 100644
--- a/sdk/timeline/src/read.ts
+++ b/sdk/timeline/src/read.ts
@@ -82,6 +82,8 @@ export interface SeqRow {
file?: string
/** that file is a copy of `of` with its noise reduced or its voice changed (TL8d) */
heard?: { of: string; denoise?: boolean; voice?: string }
+ /** that file is a copy of `of` held steady at `level` (TL7k) */
+ steady?: { of: string; level: string }
}
/** A sequence's still placement: its <Nudge>'s props (sdk/video nudge.tsx). `crop` is left, top, right, bottom. */
export interface SeqLook {
@@ -140,6 +142,8 @@ export type SeqEdit =
| { op: "level"; i: number; volume: number }
/** an <Audio> played from `file`, a copy of `of` with its noise reduced or its voice changed; no `of`, `file` as it is (TL8d) */
| { op: "heard"; i: number; file: string; of?: string; denoise?: boolean; voice?: string }
+ /** a <Video> played from `file`, a copy of `of` held steady at `level`; no `of`, `file` as it is (TL7k) */
+ | { op: "steady"; i: number; file: string; of?: string; level?: string }
/** a <Video>'s own sound taken out (TL4c): the <Video> muted, and an <Audio> of the same file, from the same place
* at the same pace and level, in a new sequence from `at` for `frames` after the composition's last */
| { op: "extract"; i: number; at: number; frames: number }
@@ -214,7 +218,7 @@ export function fromSequences(rows: SeqRow[], fps: number): Timeline {
const mediaTracks = (kind: "video" | "audio"): Track[] => {
const out: Track[] = []
for (const r of media.filter((m) => m.media === kind).sort((a, b) => a.from - b.from)) {
- const c: Clip = { id: seqId(r.i), kind, name: r.label ?? r.name, start: r.from, length: Math.max(1, r.to - r.from), in: r.startFrom ?? 0, ...(r.speed && r.speed !== 1 && { speed: r.speed }), ...(r.volume !== undefined && { volume: r.volume }), ...(r.muted && kind === "video" && { muted: true }), ...(r.locked && { locked: r.locked }), ...(r.file && { props: { file: r.heard?.of ?? r.file, ...(r.heard && { voiced: r.file, denoise: !!r.heard.denoise, voice: r.heard.voice ?? "" }) } }) }
+ const c: Clip = { id: seqId(r.i), kind, name: r.label ?? r.name, start: r.from, length: Math.max(1, r.to - r.from), in: r.startFrom ?? 0, ...(r.speed && r.speed !== 1 && { speed: r.speed }), ...(r.volume !== undefined && { volume: r.volume }), ...(r.muted && kind === "video" && { muted: true }), ...(r.locked && { locked: r.locked }), ...(r.file && { props: { file: r.heard?.of ?? r.steady?.of ?? r.file, ...(r.heard && { voiced: r.file, denoise: !!r.heard.denoise, voice: r.heard.voice ?? "" }), ...(r.steady && { stabilise: r.steady.level, steadied: r.file }) } }) }
const home = out.find((k) => k.clips.every((o) => end(o) <= c.start || o.start >= end(c)))
if (home) home.clips.push(c)
else out.push({ id: `${kind === "audio" ? "sound" : "footage"}-${out.length + 1}`, kind: kind === "audio" ? "sound" : "overlay", name: kind === "audio" ? "Sound" : "Footage", clips: [c] })
@@ -275,10 +279,11 @@ export function seqEdits(t: Timeline, op: Op): SeqEdit[] | { why: string } {
}
if (ids.some(isMedia)) {
if (op.op === "set" && Object.keys(op.set).filter((k) => op.set[k as keyof typeof op.set] !== undefined).join() === "volume") return ids.flatMap((id) => { const i = seqOf(id); return i === undefined ? [] : [{ op: "level", i, volume: Math.round(Math.max(0, op.set.volume!) * 1000) / 1000 } as SeqEdit] })
- // a sound's copy made on the host (TL8d): the <Audio> plays it, and says what it was made from and how
- const p = op.op === "set" && Object.keys(op.set).join() === "props" ? op.set.props : undefined
- if (p && Object.keys(p).every((k) => ["denoise", "voice", "voiced"].includes(k)) && ids.every((id) => find(t, id)?.clip.kind === "audio" && typeof find(t, id)?.clip.props?.file === "string"))
- return ids.map((id) => { const of = find(t, id)!.clip.props!.file as string; return p.voiced ? { op: "heard", i: seqOf(id)!, file: String(p.voiced), of, ...(p.denoise === true && { denoise: true }), ...(p.voice && { voice: String(p.voice) }) } : { op: "heard", i: seqOf(id)!, file: of } })
+ // a copy made on the host, a sound's (TL8d) or footage held steady (TL7k): its element plays it, and says what it was made from and how
+ const p = op.op === "set" && Object.keys(op.set).join() === "props" ? op.set.props : undefined, has = (kind: string, keys: string[]) => p && Object.keys(p).every((k) => keys.includes(k)) && ids.every((id) => find(t, id)?.clip.kind === kind && typeof find(t, id)?.clip.props?.file === "string")
+ const each = (f: (i: number, of: string) => SeqEdit) => ids.map((id) => f(seqOf(id)!, find(t, id)!.clip.props!.file as string))
+ if (p && has("audio", ["denoise", "voice", "voiced"])) return each((i, of) => (p.voiced ? { op: "heard", i, file: String(p.voiced), of, ...(p.denoise === true && { denoise: true }), ...(p.voice && { voice: String(p.voice) }) } : { op: "heard", i, file: of }))
+ if (p && has("video", ["stabilise", "steadied", "stabiliseZoom"])) return each((i, of) => (p.steadied ? { op: "steady", i, file: String(p.steadied), of, level: String(p.stabilise ?? "") } : { op: "steady", i, file: of }))
return { why: "footage and sound play where their sequence does: move, trim or speed the sequence; here only its level and a sound's voice are its own" }
}
const each = (ids: string[], f: (r: { i: number; clip: Clip }) => SeqEdit): SeqEdit[] | { why: string } => {
diff --git a/sdk/timeline/test/read.test.ts b/sdk/timeline/test/read.test.ts
index 78ef2cdb..0a4ef524 100644
--- a/sdk/timeline/test/read.test.ts
+++ b/sdk/timeline/test/read.test.ts
@@ -142,6 +142,20 @@ describe("TL0c: a timeline is read from a composition", () => {
expect(seqEdits(fromSequences([...rows, { ...sound, file: undefined }], 30), made)).toHaveProperty("why")
})
+ test("footage held steady is its <Video> playing a steadied copy, which says what it was made from (TL7k)", () => {
+ const take = { i: 4, name: "Video", label: "take.mp4", from: 90, to: 180, lane: 0, media: "video" as const, startFrom: 30, file: "take.mp4" }
+ const t = fromSequences([...rows, take], 30)
+ const made = { op: "set" as const, id: "seq-4", set: { props: { stabilise: "most", steadied: "steady/take-most-0123456789.mp4", stabiliseZoom: 1.08 } } }
+ expect(seqEdits(t, made)).toEqual([{ op: "steady", i: 4, file: "steady/take-most-0123456789.mp4", of: "take.mp4", level: "most" }])
+ const back = fromSequences([...rows, { ...take, file: "steady/take-most-0123456789.mp4", steady: { of: "take.mp4", level: "most" } }], 30)
+ expect(find(back, "seq-4")!.clip.props).toEqual({ file: "take.mp4", stabilise: "most", steadied: "steady/take-most-0123456789.mp4" })
+ expect(seqEdits(back, { op: "set", id: "seq-4", set: { props: { stabilise: "", steadied: "", stabiliseZoom: 1 } } })).toEqual([{ op: "steady", i: 4, file: "take.mp4" }])
+ // a sound isn't held steady, nor a voice put on footage
+ const sound = fromSequences([...rows, { ...take, name: "Audio", media: "audio" as const }], 30)
+ expect(seqEdits(sound, made)).toHaveProperty("why")
+ expect(seqEdits(t, { op: "set", id: "seq-4", set: { props: { voice: "deep", voiced: "voice/x.wav" } } })).toHaveProperty("why")
+ })
+
test("a file of the project's is a new sequence holding it; on the magnet's main track the clips after it move on and it goes in beside the one before it (TL3j)", () => {
const t = fromSequences(rows, 30)
const add = (kind: string, track: string, start: number, length: number, asset = "/p/media/beach.mp4") => seqEdits(t, { op: "add", kind: track, clip: { id: "m", kind, name: "beach.mp4", start, length, ...(kind !== "image" && { in: 0, source: length }), props: { asset } } })