Gstreamer stream to local network


I am trying to compose a video scene which needs to be streamed to localhost, where another desktop should be able to access the stream by it’s ip/port preferabley using VLC

I have two problems here.
1: gstreamer over time consumes all the available RAM and then just throws message “Killed”
2: The video stream is not accessable neither with rtp:// nor rtsp:// when trying to open network stream using VLC from another desktop.

The pipepline I’ve constructed looks like this. What did I do wrong?

gst-launch-1.0 -e \
	videotestsrc pattern=0 name=source_1 \
	videotestsrc pattern=5 name=source_2 \
	nvcompositor name=comp sink_0::width=1920 sink_0::height=1080 sink_1::xpos=1280 sink_1::width=640 sink_1::height=360 \
	source_1. ! video/x-raw,format=YUY2,width=1920,height=1080,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! tee name=tee_source_1 \
	tee_source_1. ! queue ! comp. \
	tee_source_1. ! queue max-size-buffers=2 leaky=downstream ! nvvidconv ! video/x-raw,format=BGRx ! appsink emit-signals=true sync=false name=sink_primary \
	source_2. ! video/x-raw,format=YUY2,width=1920,height=1080,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),width=640,height=360' ! tee name=tee_source_2 \
	tee_source_2. ! queue ! comp. \
	tee_source_2. ! queue max-size-buffers=2 leaky=downstream ! nvvidconv ! video/x-raw,format=BGRx,width=640,height=360 ! appsink emit-signals=true sync=false name=sink_secondary \
	comp. ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! nvv4l2h265enc bitrate=8000000 ! h265parse ! tcpserversink host= port=5000

For 1, it may just be because of appsink in terminal. No application consumes the frames. With gst-launch, use fakesink instead.

For 2, RTP relies on UDP packetiztion, so you would change tcpserversink to : rtph265pay ! udpsink host= port=5000.
If you want to use RTSP instead, you would build test-launch example from gstreamer libgstrtspserver.
You would find many examples searching this forum.

Thanks, first problem has been resolved!
Yet I’m stuck once again with the second problem.
I have made the changes you have suggested yet I am unable to open rtp stream through VLC. I found out that I have to supply some parameters to VLC through .sdp file so I have added attributes to rtph265pay as follows

rtph265pay config-interval=10 pt=96

and defined .sdp file

m=video 5000 RTP/AVP 96
c=IN IP4
a=rtpmap:96 H265/90000

Still nothing happens. Any advice ?

I’d suggest you start from this simple stream server, assuming your Jetson has IP

gst-launch-1.0 videotestsrc ! nvvidconv ! omxh265enc insert-vui=1 ! h265parse ! rtph265pay config-interval=1 ! udpsink host= port=5000

Then from another terminal from Jeston you may check with:

gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, media=video, encoding-name=H265 ! rtph265depay ! h265parse ! nvv4l2decoder ! nvvidconv ! xvimagesink

if all ok, it should be ok with your sdp file from VLC:

vlc test.sdp

Turns out I have to define IP address of the recieveing machine, so having my desktop local ip I have to defien udpsink as

udpsink host= port=5000

But this means I can only stream to the given list of IP’s, but what I want to achieve is to be able to play the stream from any device connected to my local network like an IP camera,
Initially I thought If I’d stream to and then open the stream from another device using the jetson’s IP address I would be able to play the stream but turns out it doesnt work that way.
Is there a way I can achieve my desired result ?

My previous post was just for testing locally from Jetson, nice you’ve moved to the next step.
For streaming to several hosts on LAN, you would use multicast. Check this topic.