Skip to content

Fix lerobot-find-cameras hang with Intel IPU6 (MIPI) cameras by forcing V4L2 on Linux#2657

Open
leonardogargani wants to merge 1 commit intohuggingface:mainfrom
leonardogargani:fix/linux-mipi-cameras
Open

Fix lerobot-find-cameras hang with Intel IPU6 (MIPI) cameras by forcing V4L2 on Linux#2657
leonardogargani wants to merge 1 commit intohuggingface:mainfrom
leonardogargani:fix/linux-mipi-cameras

Conversation

@leonardogargani
Copy link

What this does

This PR fixes an indefinite hang in lerobot-find-cameras on Linux with Intel IPU6 cameras caused by OpenCV selecting the FFmpeg backend for /dev/video* paths.
The fix forces the V4L2 backend when probing video devices on Linux while preserving existing behavior elsewhere.

Closes #2594.

How it was tested

The changes were tested on a Linux laptop equipped with an Intel IPU6 (MIPI) webcam.

  • On the main branch, lerobot-find-cameras opencv hangs indefinitely while probing /dev/video*.
  • With this patch applied, lerobot-find-cameras opencv completes successfully and lists the available camera devices.

How to checkout & try?

To verify the fix, run:

lerobot-find-cameras

On Linux, Windows, or macOS, and with any supported camera configuration (e.g., MIPI, USB webcam, RealSense), the command should complete without hanging and list all detected cameras.

Copilot AI review requested due to automatic review settings December 16, 2025 14:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an indefinite hang in lerobot-find-cameras on Linux systems with Intel IPU6 (MIPI) cameras by forcing OpenCV to use the V4L2 backend instead of FFmpeg when probing /dev/video* paths. The fix ensures consistent backend usage across all camera operations.

Key Changes:

  • Modified get_cv2_backend() to explicitly return CAP_V4L2 for Linux systems
  • Updated find_cameras() to use get_cv2_backend() when creating VideoCapture instances for camera detection

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/lerobot/cameras/utils.py Added Linux-specific case to return CAP_V4L2 backend instead of CAP_ANY
src/lerobot/cameras/opencv/camera_opencv.py Updated find_cameras() to use get_cv2_backend() when probing cameras

The implementation looks solid and follows the existing pattern where self.backend = get_cv2_backend() is already used in the __init__ method (line 129) and then passed to cv2.VideoCapture() in the connect() method (line 163). The change ensures that camera discovery uses the same backend as camera initialization, which is the correct approach.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

lerobot-find-cameras hangs indefinitely on Linux with Intel IPU6 (MIPI) cameras

1 participant

Comments