Gstreamer network pipeline task

Good day to all
We are using jetson xavier for our project

R32 (release), REVISION: 4.4, GCID: 23942405, BOARD: t186ref, EABI: aarch64, DATE: Fri Oct 16 19:37:08 UTC 2020

Our goal is to catch video from camera (Flir boson) and sent it to the remote host to show video stream wit VLC
I tried to solve this task in several ways

  1. Using tcpsink
    gst-launch-1.0 -v v4l2src ! x264enc key-int-max=12 byte-stream=true ! mpegtsmux ! tcpserversink port=8888 host=MY_HOST
    I can capture this stream with VLC but the problem is huge (3 sec) latency, our network channel is not good (~1mBit/s). So buffer become full in few seconds and video stack
    Maybe there is the way to send one frame of each 10(for example) ? It will be ok for us

  2. Using udpsink
    gst-launch-1.0 v4l2src device=/dev/video0 ! decodebin ! x264enc ! rtph264pay ! udpsink host=REMOTE_HOST port=5000

It works if I am using gstreamer on remote host, but I can no capture this stream with TCP

  1. Using RTSP
    I tried to using this topic :
    VLC playing gstreamer flow

Please also try test-launch.c @ https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-launch.c

sudo apt-get install libgstrtspserver-1.0 libgstreamer1.0-dev
gcc test-launch.c -o test-launch $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-rtsp-server-1.0)
./test-launch “videotestsrc ! omxh265enc ! rtph265pay name=pay0 pt=96”

Host
Open network stream rtsp://<TARGET_IP_ADDRESS>:8554/test via VLC

While I am trying to compile
test-launch.c I got error :

test-launch.c:(.text+0x154): undefined reference to `gst_rtsp_media_factory_set_enable_rtcp’

I googled this error and found that gst_rtsp_media_factory_set_enable_rtcp is the part of gstreamer 2.0 that is not released yet, so I can not use this code
Maybe you can send me the correct code or advise how to setup jetson xavier to use this version

Please advise what is the best way to solve this problem

here is the cameras properties

rakia@rakia-dev1:~/Desktop/vimtestpy$ v4l2-ctl -d0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: ‘YU12’
Name : Planar YUV 4:2:0
Size: Discrete 640x512
Interval: Discrete 0.017s (60.000 fps)
Interval: Discrete 0.033s (30.000 fps)

Index       : 1
Type        : Video Capture
Pixel Format: 'Y16 '
Name        : 16-bit Greyscale
	Size: Discrete 640x512
		Interval: Discrete 0.017s (60.000 fps)
		Interval: Discrete 0.033s (30.000 fps)

Index       : 2
Type        : Video Capture
Pixel Format: 'NV12'
Name        : Y/CbCr 4:2:0
	Size: Discrete 640x512
		Interval: Discrete 0.017s (60.000 fps)
		Interval: Discrete 0.033s (30.000 fps)

Index       : 3
Type        : Video Capture
Pixel Format: ''
Name        : 3132564e-0000-0010-8000-00aa003
	Size: Discrete 640x512
		Interval: Discrete 0.017s (60.000 fps)
		Interval: Discrete 0.033s (30.000 fps)

Hi,
A forum user has mentioned delay is more in TCP when comparing to UDP. Please refer to discussion in
Gstreamer TCPserversink 2-3 seconds latency - #5 by DaneLLL

So suggest you use UDP. The source supports NV12, so you may try

$ gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=512,format=NV12,framerate=30/1 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=REMOTE_HOST port=5000 sync=0

Thank you very much!
We still have problem with network bandwidth
Now the network bandwidth consumption ~ 10mBit

We need to reach 0.5 mbit saving image resolution

We can decrease the quality and skip 90% of frames to save the bandwidth - could you please advise I how to do it?
Thank you!

Hi,
You may try to drop frame with videorate plugin and encode in 500kbps. Please refer to the command of using videorate:

$ gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=YUY2,width=640,height=480,framerate=30/1' ! videorate drop-only=true ! 'video/x-raw,framerate=5/1' !  nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! fpsdisplaysink text-overlay=0 video-sink=nvoverlaysink sync=0 -v

Thank you. Can you please advise me how to decrease quality of video?

Hi
Please set to CBR mode and set virtual buffer size. May refer to this post:
Random blockiness in the picture RTSP server-client -Jetson TX2 - #5 by DaneLLL

Thank you, but I am not sure that I understand how it works
Could you please send me some example with udpsink?

Hi,
You may run this pipeline first:

$ gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=512,format=NV12,framerate=30/1 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! tee name=t ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=REMOTE_HOST port=5000 sync=0

And then add videorate plugin. And then try to set CBR + virtual buffer size. To apply the suggestions step by step.

I have problem with your pipeline

rakia@rakia-dev1:~$ gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=512,format=NV12,framerate=30/1 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! ‘video/x-raw(memory:NVMM),width=1280,height=720’ ! tee name=t ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host=192.168.10.20 port=8002 sync=0
WARNING: erroneous pipeline: no property “idrinterval” in element “nvv4l2h264enc0”

Hi,
The property is present from r32.5.1. You may remove it for a try.

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