how to use hardware decode for usb camera in Tx2

I can use the following code to decode rtsp.

rtspsrc location=10.10.10.10:8854 latency=200 ! rtph264depay ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw, width=896, height=640, format=(string)BGRx ! videoconvert ! appsink

For local video file, the below code can work out.

filesrc location=test.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw, format=(string)BGRx ! queue ! videoconvert ! queue ! video/x-raw, format=(string)BGR ! appsink

However, I cannot find any material for hardware-decoding usb camera in Tx2. Any suggestions ?

Thanks in advance.

update

gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1,width=1280,height=720 ! xvimagesink

Most orders I can find are the same as previous one. However, the previous one cannot activate the NVDEC module.

Therefore, is there no need to use NVDEC module when v4l2src is running ?

Hi,
Please check
https://devtalk.nvidia.com/default/topic/1057681/jetson-tx1/logitech-c930e-on-jetson-tx1-very-slow-and-choppy-video/post/5363417/#5363417

Usually USB cameras are in YUV422(UYVY, YUYV, …) and you can refer to the link to launch the camera.

Thanks for your suggestion.
Following the link, I can launch the camera now. However, I observe that the NVDEC module doesn’t start.

So I guess that there is no need to use the NVDEC module to complete this task, since YUYV is already a raw data. Am I right ?

Hi,

Yes. NVDEC is for decoding compressed stream such as H264,H265.

Searching a few related materials, I’m a little confused now.

From the official website NVIDIA VIDEO CODEC SDK | NVIDIA Developer, I can find that YUV444 and YUV420 are listed in “Decode HW”. So is YUV format video supported in NVDEC ?

From other post Issue to decode Raw video YUY2 / YUYV 422 using CUDA , the "NvDecoder : cuvidCreateVideoParser" fail with "CUDA_ERROR_INVALID_SOURCE" - Video Processing & Optical Flow - NVIDIA Developer Forums and official website, I know that YUV422 is not supported right now. And it is known that YUY2 belongs to YUV422. So can I guess that I still cannot use hardware-encode for my use camera?

Hi,
VIDEO CODEC SDK is not supported on Jetson platforms.

For video encoding, you can refer to

$ gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=300 ! video/x-raw,format=YUY2,width=848,height=480,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=a.mp4

nvvidconv plugin is hardware engine for format conversion.