how to use hardware decode for usb camera in Tx2

I can use the following code to decode rtsp.

rtspsrc location= 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.


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 ?

Please check

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 ?


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, I can find that YUV444 and YUV420 are listed in “Decode HW”. So is YUV format video supported in NVDEC ?

From other post 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?

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.