mirror of
https://github.com/huggingface/lerobot.git
synced 2026-08-01 05:59:44 +00:00
feat(cameras): prefer MJPG when fourcc unspecified in ZMQ (#4277)
* feat(cameras): prefer MJPG when fourcc unspecified; allow fourcc in ZMQ image server With no fourcc set, OpenCV's V4L2 auto-negotiation selects uncompressed YUYV when the camera offers it: ~16x the USB bandwidth of MJPG for identical frames, which silently caps the frame rate on shared USB 2.0 buses (e.g. a Raspberry Pi with multiple cameras). OpenCVCamera now prefers MJPG when config.fourcc is None: it requests MJPG and keeps it only if the camera reports support (read-back), falling back to the camera's own negotiation otherwise. An explicit config.fourcc always takes precedence, so opting out is fourcc="YUYV". The preference mirrors the existing pre/post size-and-fps ordering to preserve the Windows DSHOW FOURCC-override handling. Also adds a fourcc passthrough to the ZMQ image server, which previously could not request a pixel format at all. Behavior change: cameras that relied on implicit uncompressed capture now receive camera-side JPEG unless fourcc is set explicitly. * chore(cameras): address feedback --------- Co-authored-by: Xingdong Zuo <18168681+zuoxingdong@users.noreply.github.com>
This commit is contained in:
@@ -102,6 +102,7 @@ class ImageServer:
|
|||||||
fps=self.fps,
|
fps=self.fps,
|
||||||
width=shape[1],
|
width=shape[1],
|
||||||
height=shape[0],
|
height=shape[0],
|
||||||
|
fourcc=cfg.get("fourcc", "MJPG"),
|
||||||
color_mode=ColorMode.RGB,
|
color_mode=ColorMode.RGB,
|
||||||
)
|
)
|
||||||
camera = OpenCVCamera(cam_config)
|
camera = OpenCVCamera(cam_config)
|
||||||
|
|||||||
Reference in New Issue
Block a user