darknet
darknet copied to clipboard
libv4l2: error getting capabilities: Inappropriate ioctl for device
I know this issue is related to opencv configuration while building. this is happening only on darknet/yolo. Highly appreciate if you can share the opencv configuration (cmake command and output)
Failed to query video capabilities: Inappropriate ioctl for device libv4l2: error getting capabilities: Inappropriate ioctl for device VIDEOIO ERROR: V4L: device ../../ Unable to query number of channels Couldn't connect to webcam.
I have installed FFMPEG (from source), GStreamer & opencv with LIBV4L = ON.
-- Video I/O: -- DC1394: YES (ver 2.2.4) -- FFMPEG: YES -- avcodec: YES (ver 56.60.100) -- avformat: YES (ver 56.40.101) -- avutil: YES (ver 54.31.100) -- swscale: YES (ver 3.1.101) -- avresample: YES (ver 2.1.0) -- GStreamer: YES -- v4l/v4l2: linux/videodev2.h
Could you share the call sequence made, to open/read the webcam device ?
opencv4 configuration is as described in the post "Enabling OpenCV 4.1.0 pkg-config" at http://gpupowered.org/
Just to confirm I ran the opencv webcam code in [https://answers.opencv.org/question/1/how-can-i-get-frames-from-my-webcam/], inside the arapaho test code, and it worked fine on the integrated webcam on the Dell laptop I have, ubuntu 18.04. I did not build ffmpeg from source, but installed as dependency per the link http://www.linuxfromscratch.org/blfs/view/svn/general/opencv.html.
Thanks for your response @prabindh here is my code sequence
if(filename){
printf("video file: %s\n", filename);
cap = cvCaptureFromFile(filename);
}else{
cap = cvCaptureFromCAM(cam_index);
if(width){
cvSetCaptureProperty(cap, CV_CAP_PROP_FRAME_WIDTH, width);
}
if(height){
cvSetCaptureProperty(cap, CV_CAP_PROP_FRAME_HEIGHT, height);
}
if(fps){
cvSetCaptureProperty(cap, CV_CAP_PROP_FPS, fps);
}
}
if(!cap) error("Couldn't connect to webcam.\n");
with 3.4.5 opencv version on Ubuntu 16.04, we are getting following errror
Failed to query video capabilities: Inappropriate ioctl for device libv4l2: error getting capabilities: Inappropriate ioctl for device VIDEOIO ERROR: V4L: device ../../ Unable to query number of channels Couldn't connect to webcam.
Any reason to still stick with this API, instead of the "VideoCapture" class ? Have you tried out the snippet at - https://answers.opencv.org/question/1/how-can-i-get-frames-from-my-webcam/. If that also does not work, do try with different camera. I am also puzzled why this should happen only with yolo. Are you able to run it standalone ?
Any update on this ?