TLDR: Trained a dataset with 2 cameras just fine, went to record and Lerobot cv2 backend was screwed up, used temporary fix to force Video4Linux2.
Environment:
- OS: Ubuntu 24.04
- Python: 3.10
- Lerobot: 0.4.2
- FFMPEG: 7.1.1
So recently I was messing with my SO101 arms, had recorded a dataset and left the lab to train my set overnight. When I came back to my machine the morning after, I received a camera issue dealing with the playback through lerobot-record via the ACT policy. I kept getting the following error:
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(/dev/video0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
RuntimeError: OpenCVCamera(/dev/video0) failed to set capture_width=640 (actual_width=640, width_success=False).
ioctl(VIDIOC_QBUF): Bad file descriptor
Given that the widths were the same I tracked down the lerobot GitHub to see what causes a failure and it leads back to the cv2.VideoCapture class. I’m trying to not use the source version, but the most stable release on PyPi (I had issues with 0.4.3), so I tried a variety of changes to test this difference:
Various Debug Attempts
- Attempted to record another dataset with the teleoperator: couldn’t access the cameras (same error)
- Made sure the cameras still functioned: Used
gnome-cheeseandguvcview: comfirmed both cameras worked fine on both ports in 640x480 - Ensured the ports had proper permissions: they did
- Ran
lerobot-find-cameras opencv: Received a response withDetected Camerasfor both, on the correct port, with the correct width/height and FFMPEG backend. Though I did get another error:ioctl(VIDIOC_QBUF): Bad file descriptor [video4linux2,v4l2 @ 0x5f4ad1cd77c0] and ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device - Ran a simple OpenCV script that called
VideoCaptureby itself with the two various ports: worked - Closed & Reopened the Terminal and of course turned the computer on and off.
- Entirely removed and reinstalled the
condavirtual environment: continued getting the issue - Tried it on another machine: same issue. Then retried all of the above steps
Current Resolution:
Unfortunately nothing I had tried, worked, I was forced to alter the source variant of lerobot on the 0.4.2 branch. My temporary solution is force this line to utilize Video4Linux2
Old: self.videocapture = cv2.VideoCapture(self.index_or_path, self.backend)
New: self.videocapture = cv2.VideoCapture(self.index_or_path, cv2.CAP_V4L2)
The actually camera utility and rerecording worked. Unfortunately I had other issues, but that’s for me to debug. I have 0 Idea why lerobot cannot find the correct backend it was pretty frustrating to take up all that time. I don’t think I’m going to open an official issue unless there’s something that truly wasn’t on me. Hopefully this helps somebody else that may stray upon this, I’ve attached my logs and packages if anybody else wants to take a more detailed look. It was so weird because the record function litterly worked the night prior and nobody else touched the workstation, so maybe my PC did some sort of weird apt autoupdate that made incorrect versions.
Extra Logs
lerobot-find-cameras output (yes, IK the size & FPS is different in this one)
ioctl(VIDIOC_QBUF): Bad file descriptor
[video4linux2,v4l2 @ 0x5f4ad1cd77c0] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
ioctl(VIDIOC_QBUF): Bad file descriptor
[video4linux2,v4l2 @ 0x5f4ad1ce1400] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
— Detected Cameras —
Camera #0:
Name: OpenCV Camera @ /dev/video0
Type: OpenCV
Id: /dev/video0
Backend api: FFMPEG
Default stream profile:
Format: 0.0
Fourcc:
Width: 1920
Height: 1080
Fps: 5.0
Camera #1:
Name: OpenCV Camera @ /dev/video2
Type: OpenCV
Id: /dev/video2
Backend api: FFMPEG
Default stream profile:
Format: 0.0
Fourcc:
Width: 1920
Height: 1080
Fps: 5.0
Web Camera Info
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'MJPG' (Motion-JPEG, compressed)
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 800x600
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 640x360
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.033s (30.000 fps)
[1]: 'YUYV' (YUYV 4:2:2)
Size: Discrete 1280x720
Interval: Discrete 0.100s (10.000 fps)
Size: Discrete 800x600
Interval: Discrete 0.050s (20.000 fps)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 640x360
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1920x1080
Interval: Discrete 0.200s (5.000 fps)
Packages
# Name Version Build Channel
_libgcc_mutex 0.1 main
_openmp_mutex 5.1 1_gnu
accelerate 1.12.0 pypi_0 pypi
aiohappyeyeballs 2.6.1 pypi_0 pypi
aiohttp 3.13.3 pypi_0 pypi
aiosignal 1.4.0 pypi_0 pypi
alsa-lib 1.2.15.3 hb03c661_0 conda-forge
annotated-types 0.7.0 pypi_0 pypi
aom 3.9.1 hac33072_0 conda-forge
async-timeout 5.0.1 pypi_0 pypi
attr 2.5.2 h39aace5_0 conda-forge
attrs 25.4.0 pypi_0 pypi
av 15.1.0 pypi_0 pypi
bzip2 1.0.8 h5eee18b_6
ca-certificates 2026.1.4 hbd8a1cb_0 conda-forge
cairo 1.18.4 h44eff21_0
certifi 2026.1.4 pypi_0 pypi
charset-normalizer 3.4.4 pypi_0 pypi
click 8.3.1 pypi_0 pypi
cloudpickle 3.1.2 pypi_0 pypi
cmake 4.1.3 pypi_0 pypi
datasets 4.1.1 pypi_0 pypi
dav1d 1.2.1 hd590300_0 conda-forge
dbus 1.16.2 h24cb091_1 conda-forge
deepdiff 8.6.1 pypi_0 pypi
diffusers 0.35.2 pypi_0 pypi
dill 0.4.0 pypi_0 pypi
draccus 0.10.0 pypi_0 pypi
einops 0.8.1 pypi_0 pypi
evdev 1.9.2 pypi_0 pypi
expat 2.7.3 h7354ed3_4
farama-notifications 0.0.4 pypi_0 pypi
feetech-servo-sdk 1.0.0 pypi_0 pypi
ffmpeg 7.1.1 gpl_h817a628_111 conda-forge
filelock 3.20.3 pypi_0 pypi
font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge
font-ttf-inconsolata 3.000 h77eed37_0 conda-forge
font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge
font-ttf-ubuntu 0.83 h77eed37_3 conda-forge
fontconfig 2.15.0 h7e30c49_1 conda-forge
fonts-conda-ecosystem 1 0 conda-forge
fonts-conda-forge 1 hc364b38_1 conda-forge
freetype 2.14.1 ha770c72_0 conda-forge
fribidi 1.0.16 hb03c661_0 conda-forge
frozenlist 1.8.0 pypi_0 pypi
fsspec 2025.9.0 pypi_0 pypi
gdk-pixbuf 2.44.5 h2b0a6b4_0 conda-forge
gitdb 4.0.12 pypi_0 pypi
gitpython 3.1.46 pypi_0 pypi
gmp 6.3.0 hac33072_2 conda-forge
graphite2 1.3.14 hecca717_2 conda-forge
gymnasium 1.2.3 pypi_0 pypi
harfbuzz 12.3.2 h6083320_0 conda-forge
hf-transfer 0.1.9 pypi_0 pypi
hf-xet 1.2.0 pypi_0 pypi
huggingface-hub 0.35.3 pypi_0 pypi
icu 78.2 h33c6efd_0 conda-forge
idna 3.11 pypi_0 pypi
imageio 2.37.2 pypi_0 pypi
imageio-ffmpeg 0.6.0 pypi_0 pypi
importlib-metadata 8.7.1 pypi_0 pypi
inquirerpy 0.3.4 pypi_0 pypi
intel-gmmlib 22.9.0 hb700be7_0 conda-forge
intel-media-driver 25.3.4 hecca717_0 conda-forge
jinja2 3.1.6 pypi_0 pypi
jsonlines 4.0.0 pypi_0 pypi
lame 3.100 h166bdaf_1003 conda-forge
ld_impl_linux-64 2.44 h153f514_2
lerc 4.0.0 h0aef613_1 conda-forge
lerobot 0.4.2 pypi_0 pypi
level-zero 1.27.0 hb700be7_0 conda-forge
libabseil 20250512.1 cxx17_hba17884_0 conda-forge
libass 0.17.4 h96ad9f0_0 conda-forge
libcap 2.77 h3ff7636_0 conda-forge
libdeflate 1.25 h17f619e_0 conda-forge
libdrm 2.4.125 hb03c661_1 conda-forge
libegl 1.7.0 ha4b6fd6_2 conda-forge
libexpat 2.7.3 h7354ed3_4
libffi 3.4.4 h6a678d5_1
libflac 1.5.0 he200343_1 conda-forge
libfreetype 2.14.1 ha770c72_0 conda-forge
libfreetype6 2.14.1 h73754d4_0 conda-forge
libgcc 15.2.0 h69a1729_7
libgcc-ng 15.2.0 h166f726_7
libgl 1.7.0 ha4b6fd6_2 conda-forge
libglib 2.86.3 h8b17d9a_0
libglvnd 1.7.0 ha4b6fd6_2 conda-forge
libglx 1.7.0 ha4b6fd6_2 conda-forge
libgomp 15.2.0 h4751f2c_7
libhwloc 2.12.2 default_hafda6a7_1000 conda-forge
libiconv 1.18 h3b78370_2 conda-forge
libjpeg-turbo 3.1.2 hb03c661_0 conda-forge
liblzma 5.8.2 hb03c661_0 conda-forge
liblzma-devel 5.8.2 hb03c661_0 conda-forge
libnsl 2.0.0 h5eee18b_0
libogg 1.3.5 hd0c01bc_1 conda-forge
libopenvino 2025.2.0 hb617929_1 conda-forge
libopenvino-auto-batch-plugin 2025.2.0 hed573e4_1 conda-forge
libopenvino-auto-plugin 2025.2.0 hed573e4_1 conda-forge
libopenvino-hetero-plugin 2025.2.0 hd41364c_1 conda-forge
libopenvino-intel-cpu-plugin 2025.2.0 hb617929_1 conda-forge
libopenvino-intel-gpu-plugin 2025.2.0 hb617929_1 conda-forge
libopenvino-intel-npu-plugin 2025.2.0 hb617929_1 conda-forge
libopenvino-ir-frontend 2025.2.0 hd41364c_1 conda-forge
libopenvino-onnx-frontend 2025.2.0 h1862bb8_1 conda-forge
libopenvino-paddle-frontend 2025.2.0 h1862bb8_1 conda-forge
libopenvino-pytorch-frontend 2025.2.0 hecca717_1 conda-forge
libopenvino-tensorflow-frontend 2025.2.0 h0767aad_1 conda-forge
libopenvino-tensorflow-lite-frontend 2025.2.0 hecca717_1 conda-forge
libopus 1.6.1 h280c20c_0 conda-forge
libpciaccess 0.18 hb9d3cd8_0 conda-forge
libpng 1.6.54 h421ea60_0 conda-forge
libprotobuf 6.31.1 h49aed37_4 conda-forge
librsvg 2.60.0 h61e6d4b_0 conda-forge
libsndfile 1.2.2 hc7d488a_2 conda-forge
libsqlite 3.51.2 hf4e2dac_0 conda-forge
libstdcxx 15.2.0 h39759b7_7
libstdcxx-ng 15.2.0 hc03a8fd_7
libsystemd0 258.3 h6569c3e_0 conda-forge
libtiff 4.7.1 h9d88235_1 conda-forge
libudev1 258.3 h6569c3e_0 conda-forge
libunwind 1.8.3 h65a8314_0 conda-forge
liburing 2.13 hb700be7_0 conda-forge
libusb 1.0.29 h73b1eb8_0 conda-forge
libuuid 2.41.3 h5347b49_0 conda-forge
libva 2.23.0 he1eb515_0 conda-forge
libvorbis 1.3.7 h54a6638_2 conda-forge
libvpl 2.15.0 h54a6638_1 conda-forge
libvpx 1.14.1 hac33072_0 conda-forge
libvulkan-loader 1.4.341.0 h5279c79_0 conda-forge
libwebp-base 1.6.0 hd42ef1d_0 conda-forge
libxcb 1.17.0 h9b100fa_0
libxkbcommon 1.13.1 hca5e8e5_0 conda-forge
libxml2 2.15.1 he237659_1 conda-forge
libxml2-16 2.15.1 hca6bf5a_1 conda-forge
libzlib 1.3.1 hb25bd0a_0
markupsafe 3.0.3 pypi_0 pypi
mergedeep 1.3.4 pypi_0 pypi
mpg123 1.32.9 hc50e24c_0 conda-forge
mpmath 1.3.0 pypi_0 pypi
multidict 6.7.0 pypi_0 pypi
multiprocess 0.70.16 pypi_0 pypi
mypy-extensions 1.1.0 pypi_0 pypi
ncurses 6.5 h7934f7d_0
networkx 3.4.2 pypi_0 pypi
numpy 2.2.6 pypi_0 pypi
nvidia-cublas-cu12 12.6.4.1 pypi_0 pypi
nvidia-cuda-cupti-cu12 12.6.80 pypi_0 pypi
nvidia-cuda-nvrtc-cu12 12.6.77 pypi_0 pypi
nvidia-cuda-runtime-cu12 12.6.77 pypi_0 pypi
nvidia-cudnn-cu12 9.5.1.17 pypi_0 pypi
nvidia-cufft-cu12 11.3.0.4 pypi_0 pypi
nvidia-cufile-cu12 1.11.1.6 pypi_0 pypi
nvidia-curand-cu12 10.3.7.77 pypi_0 pypi
nvidia-cusolver-cu12 11.7.1.2 pypi_0 pypi
nvidia-cusparse-cu12 12.5.4.2 pypi_0 pypi
nvidia-cusparselt-cu12 0.6.3 pypi_0 pypi
nvidia-nccl-cu12 2.26.2 pypi_0 pypi
nvidia-nvjitlink-cu12 12.6.85 pypi_0 pypi
nvidia-nvtx-cu12 12.6.77 pypi_0 pypi
ocl-icd 2.3.3 hb9d3cd8_0 conda-forge
opencl-headers 2025.06.13 h5888daf_0 conda-forge
opencv-python 4.13.0.90 pypi_0 pypi
opencv-python-headless 4.12.0.88 pypi_0 pypi
openh264 2.6.0 hc22cd8d_0 conda-forge
openssl 3.6.1 h35e630c_1 conda-forge
orderly-set 5.5.0 pypi_0 pypi
packaging 25.0 pypi_0 pypi
pandas 2.3.3 pypi_0 pypi
pango 1.56.4 hadf4263_0 conda-forge
pcre2 10.46 h1321c63_0 conda-forge
pfzy 0.3.4 pypi_0 pypi
physical-ai-interpretability 0.1.4 pypi_0 pypi
pillow 12.1.0 pypi_0 pypi
pip 25.3 pyhc872135_0
pixman 0.46.4 h54a6638_1 conda-forge
platformdirs 4.5.1 pypi_0 pypi
prompt-toolkit 3.0.52 pypi_0 pypi
propcache 0.4.1 pypi_0 pypi
protobuf 6.33.4 pypi_0 pypi
psutil 7.2.1 pypi_0 pypi
pthread-stubs 0.3 h0ce48e5_1
pugixml 1.15 h3f63f65_0 conda-forge
pulseaudio-client 17.0 h9a6aba3_3 conda-forge
pyarrow 23.0.0 pypi_0 pypi
pydantic 2.12.5 pypi_0 pypi
pydantic-core 2.41.5 pypi_0 pypi
pynput 1.8.1 pypi_0 pypi
pyserial 3.5 pypi_0 pypi
python 3.10.12 hd12c33a_0_cpython conda-forge
python-dateutil 2.9.0.post0 pypi_0 pypi
python-xlib 0.33 pypi_0 pypi
pytz 2025.2 pypi_0 pypi
pyyaml 6.0.3 pypi_0 pypi
pyyaml-include 1.4.1 pypi_0 pypi
readline 8.3 hc2a1206_0
regex 2026.1.15 pypi_0 pypi
requests 2.32.5 pypi_0 pypi
rerun-sdk 0.26.2 pypi_0 pypi
robocandywrapper 0.2.4 pypi_0 pypi
safetensors 0.7.0 pypi_0 pypi
scipy 1.15.3 pypi_0 pypi
sdl2 2.32.56 h54a6638_0 conda-forge
sdl3 3.2.30 h3b84278_0 conda-forge
sentry-sdk 2.50.0 pypi_0 pypi
setuptools 80.9.0 py310h06a4308_0
six 1.17.0 pypi_0 pypi
smmap 5.0.2 pypi_0 pypi
snappy 1.2.2 h03e3b7b_1 conda-forge
sqlite 3.51.1 he0a8d7e_0
svt-av1 3.1.2 hecca717_0 conda-forge
sympy 1.14.0 pypi_0 pypi
tbb 2022.3.0 hb700be7_2 conda-forge
termcolor 3.3.0 pypi_0 pypi
tk 8.6.15 h54e0aa7_0
toml 0.10.2 pypi_0 pypi
torch 2.7.1 pypi_0 pypi
torchcodec 0.5 pypi_0 pypi
torchvision 0.22.1 pypi_0 pypi
tqdm 4.67.1 pypi_0 pypi
triton 3.3.1 pypi_0 pypi
typing-extensions 4.15.0 pypi_0 pypi
typing-inspect 0.9.0 pypi_0 pypi
typing-inspection 0.4.2 pypi_0 pypi
tzdata 2025.3 pypi_0 pypi
urllib3 2.6.3 pypi_0 pypi
wandb 0.21.4 pypi_0 pypi
wayland 1.24.0 hdac8c69_0
wayland-protocols 1.47 hd8ed1ab_0 conda-forge
wcwidth 0.3.1 pypi_0 pypi
wheel 0.45.1 py310h06a4308_0
x264 1!164.3095 h166bdaf_2 conda-forge
x265 3.5 h924138e_3 conda-forge
xkeyboard-config 2.46 hb03c661_0 conda-forge
xorg-libx11 1.8.12 h9b100fa_1
xorg-libxau 1.0.12 h9b100fa_0
xorg-libxcursor 1.2.3 hb9d3cd8_0 conda-forge
xorg-libxdmcp 1.1.5 h9b100fa_0
xorg-libxext 1.3.6 hb9d3cd8_0 conda-forge
xorg-libxfixes 6.0.2 hb03c661_0 conda-forge
xorg-libxrandr 1.5.5 hb03c661_0 conda-forge
xorg-libxrender 0.9.12 hb9d3cd8_0 conda-forge
xorg-libxscrnsaver 1.2.4 hb9d3cd8_0 conda-forge
xorg-xorgproto 2024.1 h5eee18b_1
xxhash 3.6.0 pypi_0 pypi
xz 5.8.2 ha02ee65_0 conda-forge
xz-gpl-tools 5.8.2 ha02ee65_0 conda-forge
xz-tools 5.8.2 hb03c661_0 conda-forge
yarl 1.22.0 pypi_0 pypi
zipp 3.23.0 pypi_0 pypi
zlib 1.3.1 hb25bd0a_0
zstd 1.5.7 hb78ec9c_6 conda-forge
lerobot-record output
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(/dev/video0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
Traceback (most recent call last):
File "/home/enee-467-4/Documents/lerobot_ws/record_dataset.py", line 66, in <module>
follower.connect()
File "/home/enee-467-4/miniforge3/envs/lerobot/lib/python3.10/site-packages/lerobot/robots/so101_follower/so101_follower.py", line 101, in connect
cam.connect()
File "/home/enee-467-4/miniforge3/envs/lerobot/lib/python3.10/site-packages/lerobot/cameras/opencv/camera_opencv.py", line 172, in connect
self._configure_capture_settings()
File "/home/enee-467-4/miniforge3/envs/lerobot/lib/python3.10/site-packages/lerobot/cameras/opencv/camera_opencv.py", line 221, in _configure_capture_settings
self._validate_width_and_height()
File "/home/enee-467-4/miniforge3/envs/lerobot/lib/python3.10/site-packages/lerobot/cameras/opencv/camera_opencv.py", line 278, in _validate_width_and_height
raise RuntimeError(
RuntimeError: OpenCVCamera(/dev/video0) failed to set capture_width=640 (actual_width=640, width_success=False).
ioctl(VIDIOC_QBUF): Bad file descriptor