opencv python error on cv2.VideoCapture()

Dear all

I'm facing an error when trying to create a VideoCapture object (in this code, associated to device "0" -> /dev/video0)
I am running FreeBSD 14. The issue can be reproduced on the current freebsd opencv package (4.6.0), the port and the latest opencv 4.9.0 compiled from sources.

I checked permissions on /dev/video0, status on webcamd and possible hw issues. I tested the camera with jitsi on a browser and it works fine.

Python:
Python 3.9.18 (main, Jan 27 2024, 01:18:52)
[Clang 16.0.6 (https://github.com/llvm/llvm-project.git
llvmorg-16.0.6-0-g7cbf1 on freebsd14 Type "help", "copyright",
"credits" or "license" for more information.
>>> import cv2
>>> cam = cv2.VideoCapture(0)
[ WARN:0@2.637] global cap_gstreamer.cpp:2839 handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory.
[ WARN:0@2.649] global cap_gstreamer.cpp:1698 open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0@2.649] global cap_gstreamer.cpp:1173 isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created libdc1394 error: Failed to initialize libdc1394
>>> cv2.__version__
'4.9.0'
>>>

PS: When instead of the camera device file I place a file in VideoCapture (eg, cam = cv2.VideoCapture('someclip.mpg') ) works well and it reproduces the video on the frame.

Best,
 
Not sure if I should move this to "Multimedia/Gaming" or "Userland scripting and programming". I'll go with "multimedia/gaming" first.
 
Not sure if I should move this to "Multimedia/Gaming" or "Userland scripting and programming". I'll go with "multimedia/gaming" first.
If it helps to contextualize it, we use opencv in GNU Health, a health and hospital management system for different contexts involving cameras (admissions, microscopes / histopathology.. ).
 
Back
Top