Skip to main content

Crate vs_record

Crate vs_record 

Source
Expand description

Session video recording for vibesurfer.

Turns a sequence of RGB frames (captured from a page) into a real video. Two encoders, both cross-platform:

  • H264Recorder: real-time H.264 via openh264 (built from vendored source), muxed to MP4 with muxide (pure Rust). Fast enough to keep up with capture and produces a file that plays everywhere with no remux. This is the default.
  • Recorder: pure-Rust AV1 via rav1e in an IVF container. No build tools, but far too slow for real time at screen resolution. Kept as a portable fallback.

Both are fed decoded RGB frames (see Recorder::push_png for the capture path, which decodes vibesurfer’s PNG captures). All frames in one recording must share dimensions; the first fixes them.

Structs§

H264Recorder
Real-time H.264 recorder: encodes RGB frames with openh264 and muxes them into an MP4 with muxide. Unlike Recorder (rav1e/AV1, far too slow for real time), this keeps up with capture and writes a file that plays natively everywhere without a remux. The MP4 is finalized on finish; the muxer is built lazily on the first frame because it needs the SPS/PPS that the encoder emits with it.
Recorder
Encodes RGB frames to AV1 and writes an IVF file.

Enums§

RecordError

Functions§

composite_cursor
Composite the cursor (and any click ripple) onto an RGB frame at (x,y) frame pixels. The pointer scale tracks the frame width so it looks the same size across recording resolutions.
png_dimensions
Decode just the dimensions of a PNG, so a caller can size a Recorder from the first captured frame.
png_to_scaled_rgb
Decode a PNG and downscale it so its width is at most max_width (aspect preserved), returning (width, height, rgb). Screen captures arrive at the device backing scale (retina 2x), which is needlessly large for a recording: it slows capture and multiplies the encoder’s per-frame memory. Downscaling to a sane width keeps recordings small and light. A frame already within max_width is returned unscaled.