dusty-nv / jetson-utils

C++/CUDA/Python multimedia utilities for NVIDIA Jetson
MIT License
737 stars 289 forks source link

gstCamera fails when used with a device that supports V4L2_FRMSIZE_TYPE_STEPWISE #201

Open scrocker-amp opened 7 months ago

scrocker-amp commented 7 months ago

When used with a video4linux driver that has vidioc_enum_framesizes set the type to V4L2_FRMSIZE_TYPE_STEPWISE, I see the following errors from gstCamera:

[gstreamer] gstCamera -- found v4l2 device: AVC8000 PC-DVR [gstreamer] v4l2-proplist, device.path=(string)/dev/video0, udev-probed=(boolean)false, device.api=(string)v4l2, v4l2.device.driver=(string)avc8000, v4l2.device.card=(string)"AVC8000\ PC-DVR", v4l2.device.bus_info=(string)PCIe:0004:04:00.0, v4l2.device.version=(uint)330360, v4l2.device.capabilities=(uint)2233466881, v4l2.device.device_caps=(uint)85983233; [gstreamer] gstCamera -- found 4 caps for v4l2 device /dev/video0 [gstreamer] [0] video/x-raw, format=(string)YUY2, width=(int)[ 360, 720, 360 ], height=(int)[ 288, 576, 288 ], framerate=(fraction){ 2/1, 4/1, 6/1, 8/1, 10/1, 12/1, 14/1, 16/1, 18/1, 20/1, 22/1, 24/1, 25/1 }; [gstreamer] [1] video/x-raw, format=(string)UYVY, width=(int)[ 360, 720, 360 ], height=(int)[ 288, 576, 288 ], framerate=(fraction){ 2/1, 4/1, 6/1, 8/1, 10/1, 12/1, 14/1, 16/1, 18/1, 20/1, 22/1, 24/1, 25/1 }; [gstreamer] [2] video/x-raw, format=(string)RGB16, width=(int)[ 360, 720, 360 ], height=(int)[ 288, 576, 288 ], framerate=(fraction){ 2/1, 4/1, 6/1, 8/1, 10/1, 12/1, 14/1, 16/1, 18/1, 20/1, 22/1, 24/1, 25/1 }; [gstreamer] [3] video/x-raw, format=(string)RGB15, width=(int)[ 360, 720, 360 ], height=(int)[ 288, 576, 288 ], framerate=(fraction){ 2/1, 4/1, 6/1, 8/1, 10/1, 12/1, 14/1, 16/1, 18/1, 20/1, 22/1, 24/1, 25/1 }; [gstreamer] gstCamera -- couldn't find a compatible codec/format for v4l2 device /dev/video0 [gstreamer] gstCamera -- device discovery failed, but /dev/video0 exists

It looks as if gstCamera is expecting width and height to be integers, but gStreamer is returning structures or arrays.

Modifying the driver so that vidioc_enum_framesizes returns a discrete structure and sets the type to V4L2_FRMSIZE_TYPE_DISCRETE fixes the problem. However, this is not a practical long-term solution.