Skip to content

Request MJPG for the webcam overlay when the camera offers it - #9306

Open
atavacron wants to merge 1 commit into
omacom:quattrofrom
atavacron:fix/webcam-overlay-mjpeg
Open

Request MJPG for the webcam overlay when the camera offers it#9306
atavacron wants to merge 1 commit into
omacom:quattrofrom
atavacron:fix/webcam-overlay-mjpeg

Conversation

@atavacron

Copy link
Copy Markdown

What

Pick the v4l2 size/format for omarchy screenrecord --with-webcam from v4l2-ctl --list-formats-ext instead of asking ffmpeg to guess.

ffmpeg's v4l2 demuxer selects YUYV when input_format is unset. On common UVC cameras that raw mode is 5–10 fps at 720p, while MJPG at the same size is 30 fps. The overlay then looks choppy regardless of --webcam-size.

omarchy-capture-webcam-format now:

  • Prefers a compressed 30 fps mode (MJPG / H264 / HEVC) at 640x360, then 1280x720, then 1920x1080
  • Skips a preferred size that cannot do 30 fps, so a 640x360 YUYV@5 mode does not hide 1280x720 MJPG@30
  • Falls back to the best remaining format (still setting input_format) or to framerate=30 if probing fails

start_webcam_overlay() passes that string to mpv's --demuxer-lavf-o.

Closes #7300

Tests

test/shell.d/capture-webcam-format-test.sh — stubbed v4l2-ctl fixtures for:

./test/cli passed, including command metadata for the new hidden helper.

Hardware check (no media attached)

UVC camera with both MJPG and YUYV. mpv launched with the same --demuxer-lavf-o the overlay uses; format read back with v4l2-ctl --get-fmt-video / --get-parm while mpv held the device:

mpv --demuxer-lavf-o Negotiated
helper output (video_size=640x360,framerate=30,input_format=mjpeg) MJPG 640x360 @ 30
old video_size=640x360,framerate=30 YUYV 640x360 @ 30
old video_size=1280x720,framerate=30 (#7300 path) YUYV 1280x720 @ 10
video_size=1280x720,framerate=30,input_format=mjpeg MJPG 1280x720 @ 30

No screenshots or recordings attached.

  • atavacron, Grok 4.6 (high)

ffmpeg's v4l2 demuxer picks YUYV if input_format is unset. On common
UVC cameras that format is 5-10 fps at 720p while MJPG is 30 fps at
the same size. Probe list-formats-ext, prefer a compressed 30 fps
mode, and pass input_format into mpv.

Closes omacom#7300

Co-Authored-By: Grok 4.6 (high) <noreply@x.ai>
Co-Authored-By: atavacron <8923127+atavacron@users.noreply.github.com>
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.

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

1 participant