Low light HD USB camera in ubuntu can't get high resolution good quality data

Hi there,

I am using the low light HD usb camera with ubuntu.
When I do ls /dev/video*, I got:
/dev/video0 /dev/video1

However, if I connect the camera to mac or windows, only one device will present. And if I use the camera recording in windows, I can get high quality 1920*1080 data.

I have tried to record with VLC on both video0 and video1, both of them can do the record. Video0 will get 640480 with higher quality and larger file size. Video1 will get 19201080 but with compression and smaller file size.

I want to get 1920*1080 with high quality video (uncompressed or less compression) and read in opencv, which device should I use? Besides, why there are 2 device presented in Ubuntu 16 system?

Thanks!

1 device is mjpeg, 1 device is h.264. A single usb device may present multiple endpoints/interfaces.

You can check the available resolutions/formats with v4l2-ctl --list-formats-ext. Windows and VLC are just picking different settings that the device is capable of.

Refer to the opencv documentation to configure the device within it’s capabilities.

1 Like

Hi Jacob,

Thanks a lot for your reply!
With v4l2-ctl --list-formats-ext, I got:

ioctl: VIDIOC_ENUM_FMT
Index       : 0
Type        : Video Capture
Pixel Format: 'MJPG' (compressed)
Name        : Motion-JPEG
	Size: Discrete 1920x1080
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 1280x720
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 800x600
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 640x480
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 640x360
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 352x288
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 320x240
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 1920x1080
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)

Index       : 1
Type        : Video Capture
Pixel Format: 'YUYV'
Name        : YUYV 4:2:2
	Size: Discrete 640x480
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 800x600
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 640x360
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 352x288
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 320x240
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)
	Size: Discrete 640x480
		Interval: Discrete 0.033s (30.000 fps)
		Interval: Discrete 0.040s (25.000 fps)
		Interval: Discrete 0.067s (15.000 fps)

Does it mean if I want to get uncompressed data, the max resolution will be 640*480?

I tried both of these two device in opencv with VideoCapture. With /dev/video0, I can get the video, but the size is 640*480, even if I set the W and H to 1920 and 1080, and the set function return 1.

With /dev/video1, I got error message:
VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
It seems the OpenCV I installed didn’t support the image format, I googled and found some people reinstalled OpenCV with different configuration, do you know any faster way to enable me get the data from video1?

Thanks a lot!

1 Like

Yes. What’s your problem with compression?

I think you will need to consult the opencv guys and documentation. I haven’t used it before, I’m sorry.

1 Like