Skip to content

feat: cross-browser export robustness + chromium paint-time capture#12

Merged
shreyaskarnik merged 2 commits into
mainfrom
feat/cdp-direct-screencast
May 2, 2026
Merged

feat: cross-browser export robustness + chromium paint-time capture#12
shreyaskarnik merged 2 commits into
mainfrom
feat/cdp-direct-screencast

Conversation

@shreyaskarnik
Copy link
Copy Markdown
Owner

Summary

Five user-visible fixes that make Argo's capture and export robust across chromium, firefox, and webkit. Stacks on the original feat/cdp-direct-screencast WIP that was paused while v0.34.2's paint-trigger shipped.

  • CDP-direct screencast (chromium)src/cdp-screencast.ts opens a raw CDP session and uses metadata.timestamp (paint time) for frame timing instead of arrival wallclock. Sidesteps the throughput-induced visual lag that v0.34.1's quality cap only mitigated. Encodes the concat output at CFR via -vf fps=N -fps_mode cfr so downstream filter graphs (shader-splice in particular) don't inflate the timeline.
  • setsar=1 on shader-splice concat inputs — webkit's screencast emits SAR 108:109 while PNG transition sequences are 0:1; concat refused to mix them. Every scene segment + transition segment now normalizes SAR to 1:1.
  • Auto-downgrade captureMode: 'jpeg-stitch' → 'webm' on non-chromium — firefox's onFrame only sustains ~3fps, hanging the page-side test until timeout. Loud warning, runs through.
  • Auto-clamp deviceScaleFactor to 1 on non-chromium — webkit/firefox don't honor --force-device-scale-factor. Without clamping, the page renders at 1x while the screencast captures at the 2x viewport, leaving the right + bottom of every frame as gray padding (a "frame within a frame" once the export's frame effect wraps it).
  • CI matrix workflow — tiny silent ci-smoke demo + verify script asserts dimensions / duration / non-gray bottom-right pixel. Runs on chromium / firefox / webkit per push and PR.

Also includes a one-line fix to demos/blocks-showcase.demo.ts (missing narration.startRecording() call that was breaking the demo on every browser).

Test plan

  • npm test — 636 tests pass locally
  • showcase pipeline on chromium with CDP-direct: raw 195.0s, final 195.0s, audio 195.0s — exact alignment
  • showcase pipeline on firefox: auto-downgrade warning fires, output is clean 1920×1080 (no frame-in-frame)
  • blocks-showcase pipeline on chromium with ARGO_CDP_DIRECT=0: legacy path still works
  • ci-smoke pipeline locally: 1920×1080, 10.1s, all-green frame at midpoint
  • CI matrix passes on GitHub runners (chromium / firefox / webkit)
  • Manual visual review of the showcase mp4 on chromium for any regression vs v0.34.2

Stacked on the CDP-direct screencast WIP. Five user-visible fixes:

* cdp-screencast: encode at CFR (`-vf fps=N -fps_mode cfr`) so the
  paint-time-anchored concat output works inside downstream filter
  graphs. Without this, shader-splice's trim filter on a VFR source
  inflated the final mp4 by ~9.4s on a 165s recording.

* shader-splice: append `setsar=1` to every concat input. Webkit's
  screencast emits SAR 108:109 while PNG transition sequences are 0:1,
  and concat refused to mix them.

* record: auto-downgrade `captureMode: 'jpeg-stitch'` to `'webm'` on
  non-chromium with a loud warning. Firefox's `onFrame` only sustains
  ~3fps, so jpeg-stitch on FF/webkit hangs the test until timeout.

* record: auto-clamp `deviceScaleFactor` to 1 on non-chromium with a
  warning. Webkit/firefox don't honor `--force-device-scale-factor`,
  so the page renders at 1x while the screencast captures at the 2x
  viewport — the unrendered region appears as gray padding (a "frame
  within a frame" once the export's frame effect wraps it).

* CI matrix: a tiny silent demo (`ci-smoke`) plus a verify script that
  asserts dimensions, duration, and that the bottom-right pixel is not
  near-gray. Runs on chromium / firefox / webkit per push and PR.

Includes a missing `narration.startRecording()` call in
demos/blocks-showcase.demo.ts that was breaking that demo on every
browser.
@shreyaskarnik shreyaskarnik merged commit 19883d6 into main May 2, 2026
4 checks passed
@shreyaskarnik shreyaskarnik deleted the feat/cdp-direct-screencast branch May 2, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant