Lessons from Building a Screen Recorder on Electron

Electron draws the interface and native code does the capture. What One Rec runs where, what works well, and where each platform still falls short.

Damien Schneider · 3 min read

One Rec ready to record: an area drawn around a window with its size and Record button, the camera bubble in its corner and the record dial below

Electron gets a bad reputation. "It's just a Chrome tab," people say. One Rec is an Electron app, and after building a recorder, an editor and a live studio on it, our view is that the framework is fine as long as you are honest about what it should and should not do.

Electron Draws, Native Code Captures

The interface is web technology: the launcher, the editor, the timeline, the settings. Capturing a screen is not something a web page does well, so that part is native.

On macOS, capture goes through a native addon built on ScreenCaptureKit. It records the display or window, hides the system cursor from the picture, and reports cursor positions, clicks and the text caret separately so the editor can redraw them.

On Windows and Linux, One Rec ships its own ffmpeg and uses it to grab the screen. This path is simpler and weaker. Encoding during capture runs on the CPU, and on Linux recording works on X11 only, not Wayland. We would rather say so than pretend the three platforms are equal.

Thirty Frames per Second, on Purpose

One Rec records at 30 frames per second on every platform. Interfaces move far less than games do, and a steady 30 gives the editor a predictable timeline to work with. Paid plans can export at 60 frames per second, but the source is still a 30 fps capture.

Keep Heavy Data out of the Renderer

The mistake that makes Electron apps slow is pushing large data through the same channel as button clicks. Frames go from the capture code to disk. The interface receives small messages: started, paused, elapsed time, low disk space.

The same rule applies to the cursor. The editor receives a list of positions and clicks, not pictures of a cursor. That is why changing the cursor style after recording costs nothing.

Guard the Recording

A recorder has one job it cannot fail at: do not lose the take. Three small features came out of that.

  • Disk space. One Rec warns when free space drops below 2 GB and stops the recording cleanly at 256 MB, instead of writing a broken file.
  • Updates. The updater never downloads or installs while you are recording, streaming or exporting. An update installs when you quit.
  • Projects. A project is one .onerec file. It autosaves and keeps the last ten versions.

Machine Learning Without a Server

Captions run on your computer. One Rec uses Whisper through an ONNX runtime inside the app. The model you choose downloads once, between about 140 MB and 1.1 GB depending on the size, and after that transcription works offline.

The Takeaway

Use Electron for what it is good at: one interface on three operating systems. Put capture and encoding in native code, keep large data away from the interface process, and be clear about where each platform stands. Windows and Linux builds are x64 and not code-signed yet, and macOS is the most complete of the three.