[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-111107":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":26,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":30,"discoverSource":31},111107,"chrome-capture","paulirish\u002Fchrome-capture","paulirish","60-120fps \u002F 2160p tab video\u002Faudio capture from Chrome","https:\u002F\u002Fpaulirish.github.io\u002Fchrome-capture\u002F",null,"TypeScript",557,13,2,0,3,80,363,30,83.44,"Apache License 2.0",false,"main",true,[],"2026-11-17 23:55:19","2026-11-23 19:41:25","# chrome-capture\n\nRecord a Chrome tab at 60-120fps (up to 2160p) straight to a AV1 `.mp4`. Tab audio too. No ffmpeg.\n\n```bash\nnpx chrome-capture https:\u002F\u002Fpaulirish.github.io\u002Fchrome-capture\u002F demo.mp4 4s\n```\n\n## Chrome 153+ has a native MP4 tab recorder! 😻\n\nFor the past ~decade, [`Page.startScreencast`](https:\u002F\u002Fchromedevtools.github.io\u002Fdevtools-protocol\u002Ftot\u002FPage\u002F#method-startScreencast) was the only way to get video frames out of CDP. That API is from ~2013, built so DevTools could show a live preview of a USB-tethered Android. (So good!) Both Playwright (`recordVideo`) and Puppeteer (`page.screencast()`) built their video capture on top of it: Chrome JPEG-encodes each frame, base64s it into JSON over CDP, waits for an ack, and the library pipes those JPEGs into `ffmpeg`. It's served us well.\n\nIn Sept 2026… the new [`Page.startScreenRecording`](https:\u002F\u002Fchromium-review.googlesource.com\u002Fc\u002Fchromium\u002Fsrc\u002F+\u002F7736461) landed (thx alex rudenko!). Frames go **straight from the compositor** to an out-of-process encoder over shared memory, and Chrome **writes AV1 into the mp4** as it goes (plus optional tab audio). 💅 Stopping is ~instant because the encoding is already done (no multi-second `ffmpeg` flush at the end). And you can start\u002Fstop recording whenever you want: log in, warm up the page, then record just the interaction.\n\n**In short: It's hot. It's good. really good.**\n\n\u003C!-- senna-800kg-1920x1080-120fps.mp4 -->\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fe17ffe7e-e868-40d5-adc9-df85eeb3dae8\n\n_(Thx [github.com\u002FSam1983Aing\u002Fsenna-800kg](https:\u002F\u002Fgithub.com\u002FSam1983Aing\u002Fsenna-800kg) for this Gemini Argon generation.)_\n\nPuppeteer v25.10+ wraps this in an experimental `page.record()` (deprecating `page.screencast()`). _(Update: Nov 10th... Playwright now has [an open PR](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fplaywright\u002Fpull\u002F44046) ([#43999](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fplaywright\u002Fissues\u002F43999)) bringing `Page.startScreenRecording` to Chromium! :fingers_crossed:)_\n\nFeel free to install this from npm.. or tbh just point your agent at [`src\u002Findex.ts`](.\u002Fsrc\u002Findex.ts) and steal the implementation. It's tiny.\n\n## CLI\n\n```bash\n# 720p @ 60fps for 4s, with tab audio\nnpx chrome-capture https:\u002F\u002Fpaulirish.github.io\u002Fchrome-capture\u002F demo.mp4 4s\n\n# 1080p @ 120fps (needs a 120Hz display and headful Chrome, e.g. a ProMotion MacBook)\nnpx chrome-capture https:\u002F\u002Fpaulirish.github.io\u002Fchrome-capture\u002F 120fps.mp4 5s --fps=120 --width=1920 --height=1080 --headful\n\n# Record the page with DevTools open next to it\nnpx chrome-capture https:\u002F\u002Fpaulirish.github.io\u002Fchrome-capture\u002F devtools.mp4 5s --with-devtools\n```\n\nThe CLI records audio by default and runs headless (`--headless=new`) for `\u003C= 60fps`, automatically switching to `--headful` on macOS when `--fps > 60` so Chrome can lock onto ProMotion's 120Hz `CVDisplayLink`. `--help` for the rest.\n\n## Playwright, Puppeteer, or raw CDP\n\n`startRecording()` takes a Playwright `Page`, a Puppeteer `Page`, or a CDP session. It defaults to 60fps and works with `await using`, so the mp4 is written when the block exits:\n\n```ts\nimport {startRecording} from 'chrome-capture';\n\n\u002F\u002F `page` can be a Playwright Page, a Puppeteer Page, or a CDP session!!\n{\n  await using rec = await startRecording(page, {\n    outputPath: 'flow.mp4',   \u002F\u002F optional: omit to get a Buffer from rec.stop()\n    frameRate: 60,            \u002F\u002F default: 60 (up to 120 on a 120Hz display)\n    maxWidth: 1280,           \u002F\u002F default: 1280\n    maxHeight: 720,           \u002F\u002F default: 720\n    captureArea: 'target',    \u002F\u002F 'target' (viewport) or 'browserWindow'\n    audio: false,             \u002F\u002F 48kHz stereo Opus tab audio\n  });\n  await page.goto('https:\u002F\u002Fpaulirish.github.io\u002Fchrome-capture\u002F');\n  await page.click('a');\n}\n```\n\n### `@playwright\u002Ftest` fixture\n\nRecords every test and attaches the mp4 to the report:\n\n```ts\nimport {test as base} from '@playwright\u002Ftest';\nimport {screenRecordingFixture} from 'chrome-capture\u002Fplaywright';\n\nexport const test = base.extend({\n  recordVideo60fps: screenRecordingFixture({auto: true, audio: true}),\n});\n```\n\n(Drop `auto: true` if you'd rather call `recordVideo60fps.start()` yourself, mid-test.)\n\n### Raw CDP\n\n```ts\nimport {CdpScreenRecorder, connectCdpSession} from 'chrome-capture';\n\nconst session = await connectCdpSession(pageWebSocketDebuggerUrl);\nconst recorder = new CdpScreenRecorder(session);\n\nawait recorder.start({maxWidth: 1920, maxHeight: 1080});\n\u002F\u002F ... do stuff\nconst mp4 = await recorder.stop();\nsession.close();\n```\n\n### Visible cursor\n\nWith Playwright, `await page.screencast.showActions()` draws its cursor, element highlights, and click badges right into the DOM (without starting `Page.startScreencast`), so `startRecording(page)` captures them natively. To restyle the cursor SVG and click ring yourself, inject a custom DOM overlay instead: see [`examples\u002Fcustom-cursor\u002F`](.\u002Fexamples\u002Fcustom-cursor\u002F) (`pointermove`\u002F`pointerdown` tracking for Playwright or manual sessions) and [`examples\u002Fraw-cdp-cursor\u002F`](.\u002Fexamples\u002Fraw-cdp-cursor\u002F) (raw CDP Bezier choreography).\n\n## Benchmarks\n\nSame 6.4s UI replay (typing, clicks, drag-and-drop, scroll) at 1280x800, comparing the `Page.startScreencast` + `ffmpeg` pipeline (`recordVideo`) against `Page.startScreenRecording` (`chrome-capture` at its default 60fps) on an M4 Max. Methodology and the full numbers are in [benchmarks\u002FREADME.md](.\u002Fbenchmarks\u002FREADME.md).\n\n| | `recordVideo` (`startScreencast`) | `chrome-capture` (`startScreenRecording`) |\n| :--- | ---: | ---: |\n| Output fps | 25 (up to 60) | 60 (up to 120) |\n| Total wall-clock | 21s | 11s |\n| Stop + finalize | 3,800ms | 17ms |\n| WebSocket traffic | 10.5 MB | 450 KB |\n| Final file size | 480 KB | 330 KB |\n| PSNR vs. lossless screenshot | 32 dB | 34 dB |\n| Audio | none | optional |\n\nBecause Chrome encodes the video in-flight instead of piping JPEGs to `ffmpeg`, stopping takes 17ms instead of 3.8s (or 91ms vs 20.5s at 2160p), and the whole test finishes ~10s quicker. \n\n**What about bitrate and visual quality?** There's no bitrate\u002FCRF knob (yet). Under the hood, Chrome encodes on the fly with `libaom` AV1 in realtime 1-pass VBR and scales target bitrate linearly with pixel rate (`2 Mbps` at 720p30 -> `9 Mbps` at 1080p60 -> `18 Mbps` at 1080p120 -> `72 Mbps` at 2160p120). \n\nThe **high bitrate sweet spot** is 1080p60 (`9 Mbps`) and up (bumping resolution or `frameRate` doubles as a backdoor bitrate multiplier). If you ever need lossless 1px text fidelity and only care about ~10-15fps, an offline `Page.startScreencast({format: 'png'})` -> `ffmpeg` pipeline still has a place.\n\n### How high can it go?\n\nVideo files can lie about fps. So the stress test ([demo](https:\u002F\u002Fpaulirish.github.io\u002Fchrome-capture\u002F)) draws a binary frame counter on every `requestAnimationFrame`, then decodes it back out of the mp4 to count unique frames:\n\n\u003C!-- barcode-1920x1080-120fps.mp4 -->\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F67734ccb-b986-4d66-a7d4-84bf05f7af87\n\n* **Mac (`--headless=new`)**: **2160p @ 60fps** (60 unique fps). Headless Chrome still gets full Metal GPU acceleration, so 1080p, 1440p, and 2160p all lock at 60fps, but headless drives `rAF` from a synthetic 60Hz timer instead of the display's `CVDisplayLink`.\n* **Mac (`--headful` on 120Hz ProMotion)**: **1080p @ 120fps** and **2160p @ 120fps** 😲 (`119.9 fps`, 59.8 Mbps AV1 + stereo Opus on Three.js\u002FWebGL2 scenes in [`examples\u002Fcapture-demos.ts`](.\u002Fexamples\u002Fcapture-demos.ts)).\n* **Headless Linux (no GPU \u002F CI)**: **1080p @ 60fps** (60.4 unique fps) or **1440p @ 60fps** (~58 unique fps) on standard 60Hz vsync, and up to **1080p @ 75-83fps** if you uncap vsync (`--disable-frame-rate-limit --disable-gpu-vsync`).\n* **Other setups (Windows \u002F Linux w\u002F discrete GPU)**: ?\n\nOne macOS gotcha: don't pass `--disable-frame-rate-limit --disable-gpu-vsync` on a GPU-accelerated Mac. `rAF` spins at 1,600-9,800fps, floods the Metal command queue, and starves the capture readback (dropping 2160p@60 to 0.3fps). Leave native vsync alone; it's what gets you to 120.\n\n---\n\n[![npm version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fchrome-capture.svg)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fchrome-capture)\n","chrome-capture 是一个轻量级 TypeScript 工具，用于从 Chrome 浏览器中直接录制网页标签页的高清音视频（最高 2160p、120fps），输出为 AV1 编码的 MP4 文件，全程无需依赖 ffmpeg。其核心基于 Chrome 153+ 新增的原生 CDP 接口 Page.startScreenRecording，通过共享内存将合成器帧直送独立编码器，实现低延迟启动\u002F停止、实时 AV1 编码与内建标签页音频捕获。适用于自动化测试录屏、网页性能演示、交互流程存档等需高帧率、高分辨率、低开销录制的场景。","2026-11-24 04:40:09","CREATED_QUERY"]