I'm trying to read raw video from web camera connected to my linux machine. I'm using OpenCV and l4v2 library (gstreamer). Here are some details on my camera:
root@blah:~$ v4l2-ctl -d /dev/video0 --list-formats
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUV 4:2:2 (YUYV)
Index : 1
Type : Video Capture
Pixel Format: ''
Name : e436eb7d-524f-11ce-9f53-0020af0
Index : 2
Type : Video Capture
Pixel Format: 'RGB3' (emulated)
Name : RGB3
Index : 3
Type : Video Capture
Pixel Format: 'BGR3' (emulated)
Name : BGR3
Index : 4
Type : Video Capture
Pixel Format: 'YU12' (emulated)
Name : YU12
Index : 5
Type : Video Capture
Pixel Format: 'YV12' (emulated)
Name : YV12
Here is my super simple code:
VideoCapture capture = VideoCapture(0);
if (!capture.isOpened()) {
// Error in opening the video input
cerr << "Unable to open video file for read: " << FLAGS_in_video << endl;
}
else {
cout << "Opened video for read: " << FLAGS_in_video << endl;
}
And here is output and error I get:
Trying to open device 0 to read.
VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP
mmap: Invalid argument
Opened video for read: 0
Unable to stop the stream.: Bad file descriptor
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
I've built OpenCV with WITH_V4L and WITH_LIBV4L flags ON.
I'd appreciate any help or advise on how to fix it. Thank you.