Using GStreamer to realize RTSP or RTMP to send camera image.

Hi,

1.The data format output by the camera is YUYV. How to convert YUYV to H264 format with gstreamer on TX2, and then send it with rtsp or rtmp.

Use this command “gst-launch-1.0 v4l2src! xvimagesink” to output images normally.

After “GST RTSP server” is installed, video images cannot be pushed to the client (VLC media Player) by “RTSP” with the following command.

./test-launch "( v4l2src device=/dev/video0 norm=255 ! video/x-raw-yuv,format='fourcc'YUY2,width=640,height=480 ! x264enc tune="zerolatency" threads=4  ! rtph264pay name=pay0 pt=96 )" stream ready at rtsp://192.168.2.101:8554/test

The error message prompted is as follows:

(test-launch:11544): GStreamer-WARNING **: 15:37:51.045: 0.10-style raw video caps are being created. Should be video/x-raw,format=(string).. now.

2.In addition to using GStreamer, what other ways can video images be sent to the client (VLC media player)?

Thanks.

Hi,
Please refer to
https://devtalk.nvidia.com/default/topic/1018689/jetson-tx2/vlc-playing-gstreamer-flow/post/5187270/#5187270

Looks like your camera supports YUYV 640x480p30. The gst pipeline should be

"( v4l2src device=/dev/video0 ! video/x-raw,width=640,height=480,framerate=30/1 ! nvvidconv ! video/x-raw(memory:NVMM),format=NV12 ! omxh265enc ! rtph265pay name=pay0 pt=96 )"

Thanks DaneLLL,

When I run the following program, the CPU usage reaches 33%.

./test-launch "( v4l2src device=/dev/video0 ! video/x-raw,width=640,height=480,framerate=30/1 ! nvvidconv ! video/x-raw(memory:NVMM),format=NV12 ! omxh265enc ! rtph265pay name=pay0 pt=96 )" stream ready at rtsp://192.168.2.101:8554/test

How can I reduce the CPU usage or set the hardware codec?
Since I have data for 4 cameras to process, I need to minimize the CPU usage.

Hi,
You may utilize tegrastats to get accurate CPU loading of each core.

Since v4l2src is native gstreamer plugin and it uses CPU[video/x-raw buffers], you need nvvidconv to copy to NVMM[video/x-raw(memory:NVMM)] buffers. This step takes CPU loading. You may run ‘$ sudo nvpmodel -m 0’ and ‘sudo jetson_clcoks’ to get CPU cores running at max clocks.