CSI Camera Capture Python3 - Jetson Orin Nano - select() timeout

Hey All - I am new to the Jetson Orin (or any Jetson) and have been building a autonomous vehicle.

I am having a hard time using OpenCV to capture video/images in python for recording a training set. I am using an ArduCam B0191 IMX219 and when I launch via the commandline I can see vidoe:

gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! ‘video/x-raw(memory:NVMM), width=1280,height=720, format=(string)NV12’ ! nvvidconv ! nvegltransform ! nveglglessink

I went through this post (Install OpenCV on Jetson Orin Nano - Q-engineering) to get OpenCV installed with CUDA support - but I also notice that it installed OpenCV WITHOUT GStreamer support - which I assume is my issue?

When I run simple Python code below, I get a “[ WARN:0@10.273] global cap_v4l.cpp:1048 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.” error.

I have read that the Jetson Orin Nano doesn’t have hardware compression – but I don’t know how to write code around that fact – any help would be appreciated! I seem to have all the hardware working I just need to be able to capture images in realtime in python to build my training set (and ultimately run my autonomous navigation script). Any advice is helpful or alternative ways to do this without OpenCV.

import sys
import cv2

def read_cam():
# cap = cv2.VideoCapture(“v4l2src device=/dev/video0 ! video/x-raw, width=1280, height=720 ! videoconvert ! video/x-raw,format=BGR ! appsink”)
cap = cv2.VideoCapture(0)
if cap.isOpened():
cv2.namedWindow(“demo”, cv2.WINDOW_AUTOSIZE)
while True:
ret_val, img = cap.read();
cv2.imshow(‘demo’,img)
cv2.waitKey(10)
else:
print(“camera open failed”)

cv2.destroyAllWindows()

if name == ‘main’:
read_cam()

I tried to recompile OpenCV again and it keeps ending up not installing GStreamer:

General configuration for OpenCV 4.11.0 =====================================
Version control: 4.11.0-dirty

Platform:
Timestamp: 2025-01-16T09:56:27Z
Host: Linux 6.8.0-51-generic aarch64
CMake: 3.31.1
CMake generator: Unix Makefiles
CMake build tool: /bin/gmake
Configuration: Release
Algorithm Hint: ALGO_HINT_ACCURATE

CPU/HW features:
Baseline: NEON FP16
requested: DETECT
Dispatched code generation: NEON_DOTPROD NEON_FP16 NEON_BF16
requested: NEON_FP16 NEON_BF16 NEON_DOTPROD
NEON_DOTPROD (1 files): + NEON_DOTPROD
NEON_FP16 (2 files): + NEON_FP16
NEON_BF16 (0 files): + NEON_BF16

C/C++:
Built as dynamic libs?: NO
C++ standard: 11
C++ Compiler: /opt/rh/devtoolset-10/root/usr/bin/c++ (ver 10.2.1)
C++ flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /opt/rh/devtoolset-10/root/usr/bin/cc
C flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -L/ffmpeg_build/lib -Wl,–gc-sections -Wl,–as-needed -Wl,–no-undefined
Linker flags (Debug): -L/ffmpeg_build/lib -Wl,–gc-sections -Wl,–as-needed -Wl,–no-undefined
ccache: YES
Precompiled headers: NO
Extra dependencies: /lib64/libopenblas.so Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent /usr/local/lib/libpng.so /usr/lib64/libz.so dl m pthread rt
3rdparty dependencies: libprotobuf ade ittnotify libjpeg-turbo libwebp libtiff libopenjp2 IlmImf tegra_hal

OpenCV modules:
To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio
Disabled: world
Disabled by dependency: -
Unavailable: java python2 ts
Applications: -
Documentation: NO
Non-free algorithms: NO

GUI: QT5
QT: YES (ver 5.15.16 )
QT OpenGL support: NO
GTK+: NO
VTK support: NO

Media I/O:
ZLib: /usr/lib64/libz.so (ver 1.2.7)
JPEG: build-libjpeg-turbo (ver 3.0.3-70)
SIMD Support Request: YES
SIMD Support: YES
WEBP: build (ver decoder: 0x0209, encoder: 0x020f, demux: 0x0107)
AVIF: NO
PNG: /usr/local/lib/libpng.so (ver 1.6.44)
TIFF: build (ver 42 - 4.6.0)
JPEG 2000: build (ver 2.5.0)
OpenEXR: build (ver 2.3.0)
GIF: NO
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES

Video I/O:
FFMPEG: YES
avcodec: YES (59.37.100)
avformat: YES (59.27.100)
avutil: YES (57.28.100)
swscale: YES (6.7.100)
avresample: NO
GStreamer: NO
v4l/v4l2: YES (linux/videodev2.h)

Parallel framework: pthreads

Trace: YES (with Intel ITT)

Other third-party libraries:
Lapack: YES (/lib64/libopenblas.so)
Eigen: NO
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.19.1)
Flatbuffers: builtin/3rdparty (23.5.9)

OpenCL: YES (no extra features)
Include path: /io/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load

Python 3:
Interpreter: /opt/python/cp39-cp39/bin/python3.9 (ver 3.9.20)
Libraries: libpython3.9m.a (ver 3.9.20)
Limited API: YES (ver 0x03060000)
numpy: /home/ci/.local/lib/python3.9/site-packages/numpy/_core/include (ver 2.0.2)
install path: python/cv2/python-3

Python (for build): /opt/python/cp39-cp39/bin/python3.9

Java:
ant: NO
Java: NO
JNI: NO
Java wrappers: NO
Java tests: NO

Install to: /io/_skbuild/linux-aarch64-3.9/cmake-install

hello mitchell.vitrano,

please refer to developer guide, Software Encode in Orin Nano.

please execute below to install MMAPI, and also gstreamer.
$ sudo apt-get install nvidia-l4t-gstreamer
$ sudo apt install nvidia-l4t-jetson-multimedia-api

thanks! I actually just figured this out not too long ago - I had to remove the installed version with ‘sudo pip3 uninstall opencv-python’ and that removed OpenCV 4.11 and python then picked up my locally compiled 4.10 with GStreamer ON. Thanks for the reply!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.