hex/crates
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ryan Vogel 8197ec959f feat(capture): record Linux screen captures at 60 fps
Raise Linux Annotate screen recording from 30 fps to 60 fps across the
PipeWire/VA-API, PipeWire/x264, and X11/x264 paths (step L1):

- Raise `linux::media::FPS` from 30 to 60 and propagate it to both
  sampler loops, `ffmpeg` mux/encode args, and VA-API H.264 sequence
  and VUI timing (`time_scale = 2 * FPS = 120`), replacing the 30 fps
  cap (`time_scale = 60`).
- Offer `SPA_FORMAT_VIDEO_maxFramerate` 60/1 (range 1/1..60/1) and a
  60/1 default on `SPA_FORMAT_VIDEO_framerate` in PipeWire `enum_format`,
  keeping linear modifier negotiation unchanged for now.
- Compute VA-API H.264 `level_idc` from macroblocks and frame rate per
  Table A-1 (e.g. 4.2 at 1080p60, 5.1 at 1440p60, 5.2 at 4K60, replacing
  hardcoded level 5.1), allocate coded surfaces padded to 16 px
  macroblocks while setting SPS `frame_cropping_flag` and crop offsets
  (replacing `fit(..., 16)` truncation that squashed 1920x1080 to
  1920x1072 and float-truncating 3840x2160 to 2560x1438), and scale the
  `small` candidate surface on demand in `small_rgba` at
  `FRAME_SAMPLE_INTERVAL` instead of on every frame in `load`.
- Switch CPU `Writer::x264` from fixed `veryfast` to `superfast` up to
  1440p and `ultrafast` above, raise the pipe buffer to 1 MiB, and
  timestamp piped frames on the wall clock into `fps=60` inside `ffmpeg`
  instead of duplicating multi-MB raw frames across `pipe:0` when a
  screen is still or a 4K software frame runs past 16.7 ms.
- Borrow the X11 MIT-SHM segment directly into `Writer` instead of
  copying each frame into a `Vec<u8>`, and cache the XFixes cursor image
  across frames using `XFixesSelectCursorInput` (`XFixesCursorNotify`),
  pipelining `QueryPointer` with `shm_get_image` instead of fetching the
  cursor bitmap every frame.
- Update `docs/features/capture.md` (`capture.linux`) with the new
  behaviour, checks, and T4 verification limits.

Verified:
- `cargo clippy --locked -p scrawl-capture --target x86_64-unknown-linux-gnu -- -D warnings`
  and `python3 scripts/code-shape.py --check`.
- FFmpeg `trace_headers` bit-level parse of generated VA-API SPS/PPS/IDR
  headers at 1920x1080@60 (level 42, crop_bottom 4), 2560x1440@60
  (level 51), and 3840x2160@60 (level 52), all `time_scale = 120`.
- On `hex-linux-nvidia` (`g4dn.2xlarge`, Tesla T4, Ubuntu 24.04):
  273/275 `scrawl-capture` unit tests pass (the other 2 fail identically
  on clean `dev`); native Xorg 1080p60 recorded 598 frames in 9.97 s at
  60/1 (`1920x1080`, 597 grabs, 16.5% capture CPU); Xorg 1280x720 Area
  recorded 298 frames in 4.97 s at 60/1 (297 grabs); rootful Xwayland 4K
  recorded `2560x1440` at 60/1 (598 frames in 9.97 s from 282 raw 4K
  grabs); PipeWire 1080p60 SHM -> x264 recorded 598 frames in 9.97 s at
  60/1 (594 delivered). VA-API hardware encoding was not exercised live
  because Tesla T4 has no VA-API encoder.
2026-11-03 17:51:51 -05:00
..
capture feat(capture): record Linux screen captures at 60 fps 2026-11-03 17:51:51 -05:00
capture-core feat(capture-core): add additive v1 take metadata and sidecar readers (#514) 2026-10-30 15:10:44 -07:00
router Speed up Annotate routing lookups and remote checks (#1199) 2026-11-03 12:31:51 -08:00