omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

screenrecord --with-webcam: overlay locks to YUYV @5fps instead of MJPG @30fps at 1280x720

Open ottosilva opened this issue 3 months ago • 3 comments

System details

AMD Ryzen AI 7 350 w/ Radeon 860M / AMD Radeon 860M Graphics Omarchy 4.0.0-1 Webcam: USB2.0 FHD UVC WebCam (uvcvideo driver)

What's wrong?

omarchy screenrecord --with-webcam starts the webcam overlay via mpv with:

--demuxer-lavf-o=video_size=1280x720,framerate=30

No input_format is specified, so ffmpeg's v4l2 demuxer is left to choose the pixel format on its own. On this webcam it picks YUYV (raw), which only supports 1280x720 at 5 fps on this device — even though the same resolution is available at 30 fps in MJPG. The result is a visibly choppy webcam overlay in every recording, regardless of the --webcam-size chosen.

Confirmed by querying the device directly while the overlay's mpv process has it open:

$ v4l2-ctl -d /dev/video0 --get-fmt-video
Pixel Format      : 'YUYV' (YUYV 4:2:2)
$ v4l2-ctl -d /dev/video0 --get-parm
Frames per second: 5.000 (5/1)

Device's own format list (v4l2-ctl --list-formats-ext -d /dev/video0) shows MJPG at 1280x720 supports 30fps, while the YUYV variant at the same resolution caps at 5fps:

[0] (MJPG-type, compressed):
  1280x720 @ 30fps
[1] 'YUYV' (YUYV 4:2:2):
  1280x720 @ 5fps   <-- what actually gets selected

What's expected

The overlay should request the compressed/MJPG format explicitly so it gets the 30fps mode the hardware actually supports at that resolution, e.g. adding input_format=mjpeg to the --demuxer-lavf-o string in omarchy-capture-screenrecording's start_webcam_overlay():

--demuxer-lavf-o=video_size=1280x720,framerate=30,input_format=mjpeg

I tested this manually — killing the running overlay mpv process and relaunching it with input_format=mjpeg appended immediately fixes it: the device switches to MJPG and reports a real 30fps, and the overlay is visibly smooth instead of choppy.

Steps to reproduce

  1. omarchy screenrecord --fullscreen --with-webcam (webcam with a UVC device that has a raw/YUYV mode capped at a low fps for 720p/1080p, alongside an MJPG mode that supports 30fps at the same resolution — common on USB UVC webcams)
  2. Watch the webcam overlay bubble — it's visibly laggy/low framerate
  3. Confirm with v4l2-ctl -d /dev/videoN --get-parm while recording — shows 5fps instead of the requested 30fps

Suggested fix

In omarchy-capture-screenrecording, add input_format=mjpeg to the capture_options built in start_webcam_overlay(), or probe v4l2-ctl --list-formats-ext for the pixel format that actually delivers the target fps at the chosen resolution before launching mpv.

ottosilva avatar Aug 17 '26 17:08 ottosilva

Same missing input_format on Omarchy 4.0.1-1. Different camera, slightly different numbers.

MSI GS70 2QE, BisonCam, NB Pro (5986:055c, uvcvideo). v4l2-ctl --list-formats-ext offers MJPG 1280x720 and 1920x1080 at 30 fps, and YUYV 1280x720 at 10 fps.

omarchy screenrecord --fullscreen --with-webcam --webcam-device=/dev/video0 negotiated:

Width/Height      : 640/360
Pixel Format      : 'YUYV' (YUYV 4:2:2)
Frames per second: 30.000 (30/1)

bin/omarchy-capture-screenrecording prefers 640x360 then 1280x720 then 1920x1080 and never sets MJPG. On this cam 640x360 exists, so it never reaches the OP’s 1280x720 YUYV@5fps trap — it still picks raw YUYV instead of MJPG.

  • atavacron, Grok 4.6 (high)

atavacron avatar Aug 28 '26 14:08 atavacron

Fix in #9306. The overlay now probes v4l2-ctl --list-formats-ext and sets input_format=mjpeg when MJPG can do 30 fps at a preferred size.

On this UVC camera, the old video_size=1280x720,framerate=30 path negotiated YUYV @ 10 fps. With input_format=mjpeg it negotiates MJPG @ 30 fps. No media attached.

  • atavacron, Grok 4.6 (high)

atavacron avatar Aug 31 '26 04:08 atavacron

Thanks for the detailed report. The cause is confirmed in the source on quattro (b83d3df). start_webcam_overlay() in bin/omarchy-capture-screenrecording (lines 85–98) chooses the first of 640x360, 1280x720 and 1920x1080 that the camera lists, asks for framerate=30, and never sets input_format. ffmpeg's v4l2 demuxer tries raw YUYV before MJPEG and sets the pixel format before the frame rate, so a camera whose YUYV mode at that size tops out at 5 fps gets YUYV at 5 fps. Nothing on quattro has changed this since 4.0.0. I did not reproduce it, because our test workers have no webcam.

The fix is already open as #8792, which you opened and which closes this issue. With your camera's format list (MJPG 1280x720 @ 30 and YUYV 1280x720 @ 5, but no 640x360), its loop gives video_size=1280x720,framerate=30,input_format=mjpeg. It has one gap: a camera that lists 640x360 only in a slow raw mode still stops at 640x360 without MJPEG, even if it also offers MJPG at 1280x720 @ 30. #9306 covered that case and was closed as a duplicate of #8792. #13373 deals with a separate cause (auto-exposure stretching frames in dim light), so it complements #8792 rather than competing with it.

Reviewed by Claude Opus 5.5, with Codex at medium effort as a second opinion. Codex independently confirmed the cause, traced it through ffmpeg's v4l2 format order, and found the 640x360 gap. #8792 will be reviewed and run on a worker separately. Because the fault depends on the camera, confirming it on a real camera is part of that review. This issue now waits on the maintainer's decision on #8792.

omarchybot avatar Oct 08 '26 08:10 omarchybot