GitHub - paulirish/chrome-capture: 60-120fps / 2160p tab video/audio capture from Chrome

Open original

This is a small open-source tool from Paul Irish that records a Chrome tab straight to AV1 mp4 using Chrome's new Page.startScreenRecording API, skipping the JPEG-and-ffmpeg pipeline that Playwright and Puppeteer have relied on. It works with Playwright, Puppeteer, or raw CDP, and the author says the implementation is small enough to copy.

  • Chrome encodes frames in-flight over shared memory, so stopping a recording takes about 17ms instead of 3.8s, and a full benchmark run finishes roughly 10 seconds faster than the old recordVideo path.
  • Frame rate and resolution determine bitrate: 1080p60 gets about 9 Mbps and 2160p120 about 72 Mbps, so raising resolution or fps effectively raises quality.
  • Frame rates were verified by decoding a binary frame counter back out of the video, with 120fps achieved on a 120Hz ProMotion Mac in headful mode.

chrome-capture is a small library and CLI, by Paul Irish, for recording a Chrome tab at 60 to 120 fps, up to 2160p, straight to an AV1 mp4 with optional tab audio, and without ffmpeg. The usual route in Playwright (`recordVideo`) and Puppeteer (`page.screencast()`) runs on `Page.startScreencast`, an API from around 2013 that JPEG-encodes every frame, base64s it over CDP, waits for an ack, and pipes the images into ffmpeg. The new `Page.startScreenRecording` sends frames from the compositor to an out-of-process encoder over shared memory, and Chrome writes AV1 as it goes. The practical payoff is that stopping a recording takes about 17ms instead of 3.8s, and recording can start and stop at any point, so you can log in and warm up a page before capturing only the interaction you care about. The benchmark is the clearest evidence. On an M4 Max, replaying the same 6.4s UI script at 1280x800, the old pipeline produced 25fps output in 21 seconds total, with 10.5 MB of WebSocket traffic and a 480 KB file. chrome-capture produced 60fps in 11 seconds, with 450 KB of traffic and a 330 KB file, and a slightly better PSNR (34 dB against 32 dB). Audio is optional on the new path and absent on the old one. Bitrate has no user-facing knob yet. Chrome uses libaom AV1 in realtime one-pass VBR and scales the target with pixel rate, from 2 Mbps at 720p30 up to 72 Mbps at 2160p120. That means raising resolution or frame rate is effectively how you raise quality. The fps claims are backed by a test that draws a binary frame counter on every requestAnimationFrame and decodes it back out of the file, since video files can misreport their own frame rate. Results: 2160p at 60fps headless on a Mac, and 119.9fps at 1080p and 2160p on a 120Hz ProMotion display in headful mode. On headless Linux with no GPU, 1080p holds 60fps on standard vsync, and uncapping vsync gets you to roughly 75 to 83fps. The author flags one trap: on a GPU-accelerated Mac, disabling the frame rate limit and vsync floods the Metal queue and drops 2160p@60 to 0.3fps, so the native vsync should stay on. Windows and discrete-GPU Linux numbers are not yet reported. Integration is deliberately thin. `startRecording()` accepts a Playwright page, a Puppeteer page, or a raw CDP session and works with `await using` so the file is finalized at block exit. There is also a Playwright fixture that records every test and attaches the mp4 to the report. Puppeteer 25.10+ ships an experimental `page.record()` built on the same primitive, and `page.screencast()` is being deprecated. Playwright still uses the old API, though it has a `showActions()` overlay that draws cursor and click indicators into the DOM, which the new recorder captures natively. The whole implementation lives in `src/index.ts`, and the author suggests you can lift it directly if you'd rather not take the dependency.

Ask about this article