Hello community,
I try to use the dvi2usb grabber with OpenCv in C++ and Ubuntu.
For some reason I can’t get it:
cv::VideoCapture cap;
if(!cap.open("/dev/video4", cv::CAP_V4L2)){
cout << "NOT POSSIBLE" << endl;
return -1;
}
this works just fine for another cheap usb grabber and my webcam but not for the Epiphan.
The grabber uses V4L2.
I can get the Epiphan on OBS which uses V4L2 as well, but not with OpenCv.
if I set a few parameters before cap.open
:
cap.set(cv::CAP_PROP_FRAME_WIDTH, 1920);
cap.set(cv::CAP_PROP_FRAME_HEIGHT, 1080);
cap.set(cv::CAP_PROP_FPS, 50);
I get a warning:
…cap_v4l.cpp (836) createBuffers VIDEOIO(V4L2:/dev/video4): failed mmap(6220800): errno=22 (Invalid argument)
When I look up the available formats in terminal with:
v4l2-ctl -d /dev/video0 --list-formats
I get this result:
v4l2-ctl -d /dev/video4 --list-formats
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: ‘RGB3’
Name : 24-bit RGB 8-8-8Index : 1
Type : Video Capture
Pixel Format: ‘BGR3’
Name : 24-bit BGR 8-8-8Index : 2
Type : Video Capture
Pixel Format: ‘RGB4’
Name : 32-bit A/XRGB 8-8-8-8Index : 3
Type : Video Capture
Pixel Format: ‘RGBP’
Name : 16-bit RGB 5-6-5Index : 4
Type : Video Capture
Pixel Format: ‘UYVY’
Name : UYVY 4:2:2Index : 5
Type : Video Capture
Pixel Format: ‘YUYV’
Name : YUYV 4:2:2Index : 6
Type : Video Capture
Pixel Format: ‘YU12’
Name : Planar YUV 4:2:0Index : 7
Type : Video Capture
Pixel Format: ‘YV12’
Name : Planar YVU 4:2:0Index : 8
Type : Video Capture
Pixel Format: ‘NV12’
Name : Y/CbCr 4:2:0
I guess I have to configure the VideoCapture a little more with the CAP_PROP_..
options, but I don’t know which one, but maybe something else is wrong.
I am grateful for all advises to fix this.
BR Michael