Video-as-Code
rereel treats a video like an application repository. The source of truth is small, diffable text. Media bytes are dependencies pinned by hash. The MP4 is a build artifact you can delete and rebuild.
| Software project | rereel reel |
|---|---|
| Source code | props.json, mix_plan.json, timing.json, captions.srt |
| Build config | rereel.json |
package-lock.json |
rereel.lock.json |
node_modules/ |
media/, restored by hydrate |
dist/ and the incremental build cache |
build/ (chunks/, stems/, template/, output.mp4) |
| Registry | A storage provider: local-cache, S3, R2, GCS, http, command |
The reel directory
Section titled “The reel directory”A reel directory (<reel_dir> in every command) contains:
| File | Role | In Git |
|---|---|---|
rereel.json |
Spec: kind, template, video (width, height, aspect, fps, chunkFrames), slicePreset, audioMode, optional parts |
yes |
rereel.lock.json |
items: relative path → { source, provider, uri, sha256, bytes, kind, durationSec?, width?, height?, fps?, vfr? } |
yes |
props.json |
Remotion input props. Media strings point to media/... |
yes |
mix_plan.json |
Audio timeline compiled by FFmpeg | yes |
timing.json, captions.srt, chapters.json |
Optional, copied in by freeze --timing/--captions/--chapters |
yes |
media/ |
Hydrated media named <stem>_<sha8>.<ext> |
no |
build/ |
Chunk cache, staged template, audio stems, output | no |
The full schemas are in File formats.
Reel kinds
Section titled “Reel kinds”rereel.json kind is one of:
remotion_single(default): one Remotion composition, rendered in chunks and mixed as the final master with loudness normalization.remotion_chapter: the same render, but the audio is compiled at chapter scope. That means no final loudness pass, plus a BGM tail ofcrossfade_secfor crossfading into the next chapter.composite_merge: no template of its own.parts[]lists child reels (kind: "chapter",reelDir) and locked media files (kind: "media",mediaPath, e.g. an opening or end card). Each child is built incrementally, the parts are concatenated, and the final audio is mixed frommix_plan.json(which can merge child stems viachapters[]).
Audio modes
Section titled “Audio modes”audioMode controls where sound comes from:
mix_plan(default): chunks are rendered--muted, and FFmpeg compilesmix_plan.jsoninto one continuous track. Ifmix_plan.jsonis missing, rereel tries to derive one from common props fields. See Audio compilation.remotion: chunks keep the audio Remotion renders, and the concat step keeps that audio stream.none: the output is silent video.
Why this shape works for agents
Section titled “Why this shape works for agents”- Small diffs. An AI agent changing a caption produces a one-line JSON diff, not a new binary.
- Deterministic builds. Each chunk’s cache key is a SHA-256 over canonical JSON. The same inputs give the same key on any machine.
- Safe undo. Media is content-addressed and never overwritten, so
git revertrestores the exact previous video. - Machine-readable everything. Every command prints one JSON line, so an agent can branch on
valid,chunksRenderedorcodedirectly.
Lifecycle
Section titled “Lifecycle”work/props.json ──freeze──▶ rereel.json + rereel.lock.json + props.json (commit) │ fresh clone / CI │ hydrate (or build, which hydrates) ▼ media/ ──build──▶ build/chunks/*.mp4 ──concat──▶ build/output.mp4 ▲ edit props.json / patch │ only chunks whose slice hash changed re-renderNext: Lockfile and hydration.