No description
  • TypeScript 77.1%
  • Rust 11.4%
  • Python 4.1%
  • Shell 2.5%
  • JavaScript 1.9%
  • Other 3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
oliver.maklott 2b7f81fe55
Some checks are pending
ci / naming (push) Successful in 2s
ci / scripts (push) Successful in 2s
ci / rust (push) Successful in 58s
ci / relay (push) Successful in 18s
ci / wasm (push) Successful in 1m19s
ci / ts (push) Successful in 1m11s
ci / e2e (2) (push) Successful in 54s
ci / e2e (1) (push) Successful in 3m19s
ci / sam2-parity (push) Has started running
ci / docker (push) Successful in 6m10s
release / release (push) Successful in 29m39s
Merge pull request 'Clicks on a tracked frame refine it on every engine; release 0.15.3' (#43) from click-seed into main
2026-12-02 01:59:42 +00:00
.forgejo CI: one heavy job at a time on the runner host 2026-11-25 20:28:12 +00:00
apps Clicks on a tracked frame refine it on every engine; release 0.15.3 2026-12-02 00:25:50 +00:00
crates/rotostudio-core CorridorKey: key a layer (or a region of it) on the GPU machine 2026-11-24 22:32:19 +00:00
deploy CorridorKey: key a layer (or a region of it) on the GPU machine 2026-11-24 22:32:19 +00:00
docker Limedoc frame editor: open, save and export through LCX v1 2026-11-22 21:15:44 +00:00
docs Clicks on a tracked frame refine it on every engine; release 0.15.3 2026-12-02 00:25:50 +00:00
e2e CorridorKey: key a layer (or a region of it) on the GPU machine 2026-11-24 22:32:19 +00:00
scripts CorridorKey image: venv below the app, build cache mode=min 2026-11-25 21:39:29 +00:00
tools/sam2-export Rename to RotoStudio; project files are .rsproj 2026-11-22 20:43:38 +00:00
.dockerignore Rename to RotoStudio; project files are .rsproj 2026-11-22 20:43:38 +00:00
.gitignore Exclude .env and .env* from git and docker 2026-11-21 14:47:49 +00:00
After-export-with-remote-GPU.png Rename to RotoStudio; project files are .rsproj 2026-11-22 20:43:38 +00:00
After-load-project.png Rename to RotoStudio; project files are .rsproj 2026-11-22 20:43:38 +00:00
Before-load-project.png Rename to RotoStudio; project files are .rsproj 2026-11-22 20:43:38 +00:00
Dockerfile CorridorKey image: venv below the app, build cache mode=min 2026-11-25 21:39:29 +00:00
GPU-dialog.png Rename to RotoStudio; project files are .rsproj 2026-11-22 20:43:38 +00:00
Initial-screen.png Rename to RotoStudio; project files are .rsproj 2026-11-22 20:43:38 +00:00
package-lock.json Clicks on a tracked frame refine it on every engine; release 0.15.3 2026-12-02 00:25:50 +00:00
package.json Clicks on a tracked frame refine it on every engine; release 0.15.3 2026-12-02 00:25:50 +00:00
playwright.config.ts Limedoc frame editor: open, save and export through LCX v1 2026-11-22 21:15:44 +00:00
README.md Clicks on a tracked frame refine it on every engine; release 0.15.3 2026-12-02 00:25:50 +00:00

RotoStudio

RotoStudio is a browser-only rotoscoping tool. SAM 2.1 tracks objects on WebGPU, and Rust/WASM builds the mattes at full 4K resolution, with a Fast Guided Filter for edge detail. It is a static single-page app with no backend, targeting Chromium-based browsers on desktop GPUs and Apple Silicon. Without WebGPU it runs SAM 2 on the CPU: same results, several seconds per frame.

Status: Phase 2 (production workflow) complete. Open a video, pick the Points or Box tool and click or draw a box on an object, track forwards or backwards, correct with more clicks (points can be moved and removed; Ctrl+Z undoes; the Guide explains the tools), and export a refined PNG sequence (8/16-bit matte or RGBA cutout), an OpenEXR sequence (one alpha channel per layer) or a greyscale matte video. Several objects go on separate layers, tracked one at a time or together; each layer's edge can be choked or feathered, corrected with keyframed shapes (pen, freehand or magnetic outlines that snap to edges; a shape can also be handed to SAM 2 as a mask prompt, so tracking carries the correction) and touched up with a brush (optionally only inside, along or outside a shape), previewed exactly as exported; Detail lets the edge follow the image. The cutout's colours can be cleaned: edge clean-up removes background colour from soft edges, and screen despill neutralises green, blue or picked screen spill (Cutout view, RGBA PNG and EXR). Scene cuts are found automatically and tracking never carries an object across one; a region of interest crops the frame for small objects. SAM 2.1 runs as tiny (Fast, default) or base_plus (Quality), switchable in the header. The SAM 2 models are cached in the browser after the first start, and work is autosaved there too (the Storage panel frees both); projects save as .rsproj files. The viewport zooms to the pixel, and ? lists the shortcuts. Prepared projects can be tracked and exported on a GPU server by the headless renderer (rotocmd render, see below). Phase 0's GPU timings are still open (see docs/PHASE0.md and docs/ARCHITECTURE.md).

Layout

Path Contents
apps/web/ Vite + React + TypeScript app (@rotostudio/web)
apps/headless/ Headless renderer for GPU servers (@rotostudio/headless, Node + ffmpeg)
crates/rotostudio-core/ Rust → WASM guided filter and encoders (wasm-pack)
tools/sam2-export/ SAM 2 ONNX export and parity fixtures (Python in Docker)
e2e/ Playwright tests

Development

Requires Node 22+ and npm (workspaces; pnpm is not used). Building the WASM package also needs Rust with the wasm32-unknown-unknown target and wasm-pack.

npm install

# Optional: build the WASM package. Without it the app still runs, and refinement reports
# "rotostudio-core is not built". Restart Vite after building.
(cd crates/rotostudio-core && wasm-pack build --release --target web --out-dir pkg --out-name rotostudio_core)

npm run dev            # http://localhost:5173 (app) and /bench.html (benchmarks)
npm run build          # production build into apps/web/dist
npm run typecheck      # tsc, strict
npm test               # Vitest unit tests
npm run test:parity    # SAM 2 parity vs. PyTorch fixtures (needs tools/sam2-export/out)
npm run test:headless  # headless renderer with ffmpeg in Docker (needs the WASM package);
                       #   -- --project parity: against the PyTorch fixtures
npm run e2e            # Playwright (builds, then serves with vite preview on :4173)
npm run check:naming   # product naming check, as run in CI

The dev and preview servers send Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp, so the page is cross-origin isolated. Static hosting must send the same headers.

The benchmark page (/bench.html) times the 4K guided filter and, once registered, the SAM 2 ONNX graphs on WebGPU. Add ?autorun=1 to run everything on load, or ?iterations=N to change the iteration count.

Production (Docker)

Production is one static container: Caddy serves the app, the SAM 2 models and /api/health on port 8080, with no backend. Releases publish the multi-arch image git.belowtoxic.cloud/belowtoxic.eu/rotostudio (:<version>, :latest, :edge) and a deploy bundle (deploy/). Servers are installed and updated with rotocmd; see deploy/README.md.

tools/sam2-export/run.sh export   # both models (tiny, base_plus), once (Docker, CPU)
scripts/docker-build.sh           # image rotostudio:local for this machine's arch
scripts/docker-smoke.sh           # runs it through deploy/docker-compose.yml and checks headers

Browsers need HTTPS or localhost for WebGPU and cross-origin isolation, so remote access goes through a TLS reverse proxy. See docs/ARCHITECTURE.md for the image and Releases for the release pipeline.

Headless rendering (GPU server)

A project prepared in the browser can be tracked and exported on a server with an NVIDIA GPU. The renderer runs the app's own tracker, refine and encoders. It tracks every shot that has prompts on all layers, exports at full resolution, and writes the tracked project, which the browser opens with the same video:

rotocmd render shot.rsproj --video shot.mp4 --out renders/ [-- --export exr,rgba --from 1 --to 250]

rotocmd pulls the image git.belowtoxic.cloud/belowtoxic.eu/rotostudio-headless (linux/amd64, CUDA 13; driver R580 or newer, NVIDIA Container Toolkit) by its verified digest and starts it with the GPU. See deploy/headless/README.md for the options. To build and check the image locally:

scripts/docker-build.sh --target headless --platform linux/amd64 --load -t rotostudio-headless:local
IMAGE=rotostudio-headless:local scripts/docker-smoke-headless.sh

Docs

CI runs on Forgejo Actions (.forgejo/workflows/ci.yml); releases are published by .forgejo/workflows/release.yml.