Skip to content
OrvynOSPublic

About

Reel: films made as HTML pages, rendered to MP4, in Rust.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Orvyn

Reel

Films made as HTML pages, rendered to MP4.

Website · App · Docs · X · Telegram

CI License: MIT BNB Chain

Make videos with code. A film is a web page whose scenes are functions of time; Reel renders it frame by frame in headless Chromium and encodes it with ffmpeg, with its audio mixed in and its captions exported as SRT and VTT. MIT licensed.

<script type="module">
  import { film, clip, series, tween, ease, spring, fade, slide } from "/_reel/reel.js";

  const f = film({ width: 1920, height: 1080, fps: 30, background: "#0d0f14" });

  f.add(...series([
    clip({
      for: 2.5, exit: fade(0.5),
      setup: (root) => { const h = document.createElement("h1"); h.textContent = "Hello"; root.append(h); return h; },
      draw: (h, { t }) => {
        h.style.opacity = tween(t, [0, 0.6], [0, 1]);
        h.style.transform = `scale(${spring({ t, from: 0.8, to: 1 })})`;
      },
    }),
    clip({ for: 3, enter: slide("left"), setup: (root) => { root.textContent = "Rendered frame by frame"; } }),
  ], { overlap: 0.5 }));

  f.audio("music.mp3", { volume: 0.7, fadeOut: 1 });
  f.captions([{ at: 0.2, for: 2, text: "Hello" }]);
  f.mount();
</script>
reel preview film.html          # a player in your browser: play, scrub, step frames
reel render film.html -o film.mp4
reel still film.html --at 1.5 -o frame.png

Why it works

  • Scenes are functions of time. A clip's draw sets everything from t; nothing depends on the frame before, so any frame renders on its own and every render is identical.
  • Virtual time. Before the page's scripts run, requestAnimationFrame, performance.now and Date.now are replaced. GSAP timelines, CSS animations and three.js loops render exactly too, with or without Reel's own clips.
  • Exact video layers. video("clip.mp4", { at, for, trim }) shows the file's exact frame at each moment (the renderer decodes it with ffmpeg) and mixes its sound in.

The runtime

film({ width, height, fps, duration?, background? }) the stage; .add(...clips), .audio(src, opts), .captions(cues), .wait(promise), .mount()
clip({ at, for, layer?, enter?, exit?, setup?, draw? }) draw(state, { t, progress, time, frame, fps, width, height })
series(clips, { overlap? }) one after another (overlap for crossfades)
fade, slide, wipe, zoom, blur enter/exit transitions
tween, progress, keys, spring, springDuration, stagger time math (springs are solved exactly)
ease.*, bezier(x1, y1, x2, y2) 28 easing curves and CSS-style Bézier
mix, loop, pingpong, random(seed), noise(t) colour blending, repeats, seeded randomness
el, split, typewriter, image, video DOM helpers and media layers

The runtime's source is in runtime/ (TypeScript, bundled to runtime/dist/reel.js, which the crate embeds and serves at /_reel/reel.js).

Requirements

Chromium (CHROME_PATH, or a usual install of Chrome, Chromium or Edge) and ffmpeg (FFMPEG_PATH, or on PATH). On Linux the browser is driven over a pipe, so it can run with no network at all.

Develop

pnpm --filter @orvyn/reel build     # rebuild runtime/dist/reel.js after changing runtime/src
pnpm --filter @orvyn/reel check     # runtime math
cargo test            # renders examples/launch for real (needs Chromium and FFMPEG_PATH)

License

MIT. Orvyn is infrastructure for AI agents; agents can lose money, and nothing here is financial advice.

About

Reel: films made as HTML pages, rendered to MP4, in Rust.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages