Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
ci(linux-harness): record the virtual camera as YUYV, NV12 and MJPEG
Richie McIlroy5569c7ecd8d3
diff --git a/.github/workflows/linux-desktop-reliability.yml b/.github/workflows/linux-desktop-reliability.ymlindex 4e725cfba..e933f9366 100644--- a/.github/workflows/linux-desktop-reliability.yml+++ b/.github/workflows/linux-desktop-reliability.yml@@ -408,9 +408,14 @@ jobs:run: |sudo apt-get install -y -qq "linux-headers-$(uname -r)" v4l2loopback-dkms xvfb xdotool ffmpeg dbus >/dev/nullchmod +x "$RUNNER_TEMP/build/cap-gpui"- sudo install -d -o "$(id -u)" -g "$(id -g)" "$RUNNER_TEMP/out/x11-camera"- bash scripts/linux-desktop-harness/x11-camera.sh "$RUNNER_TEMP/build/cap-gpui" "$RUNNER_TEMP/build/libs" \- "$RUNNER_TEMP/out/x11-camera"+ # Each format Cap's Linux camera path converts: packed YUYV, NV12 and+ # MJPEG (decoded before use).+ for format in yuyv422 nv12 mjpeg; do+ dir="$RUNNER_TEMP/out/x11-camera-$format"+ sudo install -d -o "$(id -u)" -g "$(id -g)" "$dir"+ CAMERA_FORMAT=$format bash scripts/linux-desktop-harness/x11-camera.sh \+ "$RUNNER_TEMP/build/cap-gpui" "$RUNNER_TEMP/build/libs" "$dir"+ done- name: Hyprland area recordingrun: |diff --git a/scripts/linux-desktop-harness/README.md b/scripts/linux-desktop-harness/README.mdindex 42e7d24a1..af183b426 100644--- a/scripts/linux-desktop-harness/README.md+++ b/scripts/linux-desktop-harness/README.md@@ -85,7 +85,8 @@ real login activates.- `x11-camera.sh <cap-gpui> <ffmpeg lib dir> <out-dir>` records the display onXvfb (X11 capture, no portal) with a camera: a v4l2loopback device that- ffmpeg feeds a 1280x720 test pattern. Cap waits for the Stop shortcut to start+ ffmpeg feeds a 1280x720 test pattern, as YUYV, NV12 or MJPEG+ (`CAMERA_FORMAT`; CI runs all three). Cap waits for the Stop shortcut to startand to stop, pressed with real X input (xdotool), well before its 60 sautomatic stop. It checks the camera track is 1280x720 and as long as thedisplay track, about five seconds, and fails if any result is missing. Itdiff --git a/scripts/linux-desktop-harness/x11-camera.sh b/scripts/linux-desktop-harness/x11-camera.shindex 3721b6215..c04f19127 100755--- a/scripts/linux-desktop-harness/x11-camera.sh+++ b/scripts/linux-desktop-harness/x11-camera.sh@@ -1,5 +1,7 @@#!/usr/bin/env bash# Usage: x11-camera.sh <cap-gpui> <ffmpeg lib dir> <out-dir>+# CAMERA_FORMAT picks what the virtual camera sends: yuyv422 (default), nv12+# or mjpeg, the three formats Cap's Linux camera path converts.set -uo pipefailfor tool in Xvfb xdotool ffmpeg ffprobe; docommand -v "$tool" >/dev/null || { echo "install xvfb, xdotool and ffmpeg" >&2; exit 2; }@@ -12,12 +14,20 @@ mkdir -p "$out" && : >"$out/result.txt" || { echo "x11-camera: cannot write to $result() { printf '%s=%s\n' "$1" "$2" >>"$out/result.txt"; }device=/dev/video42+format=${CAMERA_FORMAT:-yuyv422}+case $format in+ yuyv422|nv12) encode=(-pix_fmt "$format") ;;+ mjpeg) encode=(-pix_fmt yuvj422p -c:v mjpeg -q:v 4) ;;+ *) echo "x11-camera: unknown CAMERA_FORMAT $format" >&2; exit 2 ;;+esac+# A fresh device per run, so the format of an earlier run cannot stick.+sudo modprobe -r v4l2loopback 2>/dev/nullsudo modprobe v4l2loopback video_nr=42 card_label="Cap Test Camera" exclusive_caps=1 || exit 2# udev applies its own mode to the new node after modprobe returns; let it# finish first so it cannot reset the chmod below.sudo udevadm settle --timeout=10sudo chmod 666 "$device"-ffmpeg -hide_banner -loglevel error -nostdin -re -f lavfi -i testsrc2=size=1280x720:rate=30 -pix_fmt yuyv422 \+ffmpeg -hide_banner -loglevel error -nostdin -re -f lavfi -i testsrc2=size=1280x720:rate=30 "${encode[@]}" \-f v4l2 "$device" >"$out/feeder.log" 2>&1 &feeder=$!unset WAYLAND_DISPLAY@@ -26,7 +36,7 @@ Xvfb "$DISPLAY" -screen 0 1920x1080x24 >/dev/null 2>&1 &xvfb=$!trap 'kill $feeder $xvfb 2>/dev/null' EXITsleep 2-echo "feeder: $(kill -0 $feeder 2>/dev/null && echo running || echo exited) $(head -c 300 "$out/feeder.log")" >>"$out/actions.log"+echo "feeder ($format): $(kill -0 $feeder 2>/dev/null && echo running || echo exited) $(head -c 300 "$out/feeder.log")" >>"$out/actions.log"profile=$out/profilelog=$out/cap.log