HW-Accelerated decoding USB wecam with OpenCV

Hi,
I’ve been trying to get HW-accelerated decoding to work on my Jetson with OpenCV, without much success.
I can get it to work with gst-launch, but not in OpenCV.
I’m using a C920 webcam as an input, with MPEG gst-launch-1.0 v4l2src device="/dev/video0" io-mode=2 ! "image/jpeg, width=1920, height=1080, framerate=30/1" ! nvjpegdec ! "video/x-raw" ! nvoverlaysink -e and it works well, but as I understand it, I can’t use nvjpegdec in OpenCV because it overwrites jpegdec. So how can I compile OpenCV to be able to use it ?
I’ve also tried with H264, but framerate is very inconsistent, even in gst-launch.
I’ve also read that nvjpegdec isn’t supported for use in OpenCV, if so, how can I capture a cv::Mat from GStreamer in some way ?
Thanks.

Hi,
Please try this command:
Set camera decoder in OpenCV on Jetson Nano - #8 by DaneLLL
You can use nvv4l2decoder to decoding JPEGs.

This works indeed (and around the same time I found a similar solution here : Save video with OpenCV and usb-webcamera ) but now i can’t sync my multiple cameras with OpenCV’s Grab function (they seem to be out a couple of frames). Can I do something similar with GStreamer, or as a workaround, use gstreamer to concatenate the cameras into one single image that’s time-synced in GStreamer ?

Hi,
Could you go to OpenCV forum to get suggestion for the use-case? We don’t actually have experience about Grab functions. Users in the forum shall have more expertise in OpenCV functions.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.