Skip to content

Conversation

rodja
Copy link
Member

@rodja rodja commented Apr 13, 2025

This PR reworks the usb camera internals to allow seamless usage of multiple v4l2 devices. There had to be made quite a lot of changes to make this possible:

  • improving layout and usability of the camera control example (which was used for testing)
  • make sure we only add real capturing devices (linux often creates two devices (video0 and video1 for a single usb camera, where only video0 can be used to capture data)
  • set mjpeg format for usb cameras before trying to connect -- otherwise the bandwidth might not be sufficient for multiple cameras to get connected
  • use linuxpy.video.device instead of opencv -- because opencv auto-detection for devices does not work in all cases and often comes without gstreamer support in containers; also linuxpy provides an async API while cv2 does not
  • simplified UsbDevice and renaming it to V4l2Device to make clear that it uses the v4l2 APIs from linuxpy.video.device

ToDos

  • Is the frame rate fast enough?
  • Implement/rethink setting of width/height/fps/exposure/auto-exposure for V4l2Device.
  • Test with four cameras.
  • Test/implement/verify YUV fallback with a single camera.

NOTE: if cameras only show black images they might have gotten into an undefined state. Try unplug/replug them or restart the host system.

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.

2 participants