The Browser Is the Recorder
The first decision was to let the browser own the screen. No native window enumeration, no ffmpeg grabbing a display, no
second process asking for permissions. getDisplayMedia already knows how to ask for a window or a monitor, and the
browser already has the pixels. Everything else in Roughcast exists to keep those pixels local.
A Recorder That Fits in a Tab
The compatible path is deliberately boring: MediaRecorder on the display stream, VP9 with a VP8 fallback, and a
bitrate high enough that text survives. It is the path that works even when WebCodecs is unavailable, and it is still
the fallback when the master encoder cannot start.
The master path is where the quality lives. A MediaStreamTrackProcessor turns the track into a stream of
VideoFrames. Each frame is drawn to an offscreen canvas and handed to mediabunny’s CanvasSource, which encodes VP9
or AV1 and muxes it through an AppendOnlyStreamTarget. The append-only WebM target matters: the browser never has to
seek back into the file, so the recorder can stream clusters to the local server while the recording is still running.
The encoder is asked for quality, not latency. A near-lossless bitrate is intentionally larger than a normal screen recording. Duplicate frames are skipped by hashing a small downscaled copy; a keyframe is forced every two seconds so a crash never leaves an unrecoverable tail. The result is variable frame rate, which is exactly what a screencast is: long stretches of still screen, then a burst of motion.
The Cursor Is Part of the Pixels
The honest limitation is the same one every browser-only recorder has. The system cursor is composited into the captured surface before the page ever sees it. Roughcast cannot hide it, smooth it, or turn a click into a ripple automatically. The editor offers a manual click ring for the moments that need one.
That limitation shapes the rest of the product. If the cursor is baked in, the recorder should not pretend to be a native screen studio. It should make the raw take trustworthy and give the editor enough control to tell a story around it.
Two Seconds at a Time
The recorder does not keep a growing blob in memory and upload it at the end. It starts a MediaRecorder with a
two-second timeslice, or writes encoder chunks from mediabunny, and uploads each numbered chunk immediately. A closed
tab therefore leaves a usable sequence of chunks behind, not a lost recording. Stopping is just the last chunk followed
by a finalize request.
The server is a small Go process with the Svelte UI embedded. It listens on loopback, stores takes in SQLite through
modernc.org/sqlite, and keeps the media on disk. There is no account, no upload queue, and no cloud fallback. The only
network interface is the one the user is already looking at.
Screen capture is not a file format problem. It is a permission and ownership problem. The browser owns the screen; the local server owns the bytes; the editor owns only the project JSON. Keeping those three roles separate is what makes the recorder understandable.
