To capture YUY2 NVMM buffer from usb camera, I customized the nvv4l2camerasrc plugin with advice from Macrosilicon USB - #5 by DaneLLL.
But it did not work on some NX boards.
I can see green screen as follow:
I can see good preview with the given sample 12_camera_v4l2_cuda.
I have found one interesting point:
If I run a v4l2src pipeline first, then run the nvv4l2camerasrc pipeline, then no green screen issue.
But issue is still there if I unplug and plug the usb camera again.
Hi,
The ioctl() calls of 12_camera_v4l2_cuda and nvv4l2camerasrc are not identical. This may be the rootcause of the failure. Since 12_camera_v4l2_cuda works well with the sensor, please check if you can unify the ioctl() calls to nvv4l2camerasrc and try.
Thanks DaneLLL.
I followed your advice and found the difference.
In nvv4l2camerasrc, pixel format should be specified as V4L2_PIX_FMT_YUYV before calling ioctl(src->video_fd, VIDIOC_S_FMT, src->fmt).
It happens to be that the default format of my camera is M-JPEG.
After this fix, no green screen issue seen anymore.