Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4l2 camera driver shows (non-functional) mjpg pixelformats #12358

Closed
madebr opened this issue Feb 22, 2025 · 1 comment · Fixed by #12359
Closed

v4l2 camera driver shows (non-functional) mjpg pixelformats #12358

madebr opened this issue Feb 22, 2025 · 1 comment · Fixed by #12359

Comments

@madebr
Copy link
Contributor

madebr commented Feb 22, 2025

Running testcamera with all-default arguments, only green is shown.

By default, the v4l2 camera driver is used.
Its stdout claims it provides surfaces with MJPG and YUV2 formats.

But the window is 100% green. When adding a breakpont at stbi__jpeg_load, and viewing src in a memory viewer, it does not contain the JPEG magic header (ff d8 ff). The data (src) looks very uniform (uncompressed?) to me.

Comparing the v4l2 and pipewire camera driver, the SDL_PIXELFORMAT_MJPG formats do not appear when using the pipewire driver.

The webcam is a simple laptop webcam. lsusb shows:

Bus 002 Device 003: ID 1bcf:2c18 Sunplus Innovation Technology Inc. HD WebCam
Green window

testcamera SDL3 window with green contents

v4l2 output
Using SDL camera driver: v4l2
Saw 1 camera devices.
  - Camera #0:  HD WebCam: HD WebCam
Available formats:
    1280x720 30.00 FPS SDL_PIXELFORMAT_MJPG
    1280x720 7.50 FPS SDL_PIXELFORMAT_YUY2
    640x480 30.00 FPS SDL_PIXELFORMAT_MJPG
    640x480 30.00 FPS SDL_PIXELFORMAT_YUY2
    352x288 30.00 FPS SDL_PIXELFORMAT_MJPG
    352x288 30.00 FPS SDL_PIXELFORMAT_YUY2
    320x240 30.00 FPS SDL_PIXELFORMAT_MJPG
    320x240 30.00 FPS SDL_PIXELFORMAT_YUY2
    176x144 30.00 FPS SDL_PIXELFORMAT_MJPG
    176x144 30.00 FPS SDL_PIXELFORMAT_YUY2
    160x120 30.00 FPS SDL_PIXELFORMAT_MJPG
    160x120 30.00 FPS SDL_PIXELFORMAT_YUY2
Camera approved!
Camera Spec: 1280x720 30.00 FPS SDL_PIXELFORMAT_MJPG
pipewire output
Using SDL camera driver: pipewire
Saw 1 camera devices.
  - Camera #0:  HD WebCam (V4L2)
Available formats:
    1280x720 7.50 FPS SDL_PIXELFORMAT_YUY2
    640x480 30.00 FPS SDL_PIXELFORMAT_YUY2
    352x288 30.00 FPS SDL_PIXELFORMAT_YUY2
    320x240 30.00 FPS SDL_PIXELFORMAT_YUY2
    176x144 30.00 FPS SDL_PIXELFORMAT_YUY2
    160x120 30.00 FPS SDL_PIXELFORMAT_YUY2
Camera approved!
Camera Spec: 1280x720 7.50 FPS SDL_PIXELFORMAT_YUY2
@slouken
Copy link
Collaborator

slouken commented Feb 22, 2025

Can you debug the capture itself?

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 a pull request may close this issue.

2 participants