Convert RTP to RTSP

How Do I convert the RTP (provided by jetson.utils.videoOutput(“rtp://@:1234”)) to RTSP so that the same can ve streamed and be viewed over network.

This may not be optimal, but for answering your question:

Assuming this jetson_utils based code:

from jetson_utils import videoSource, videoOutput

input = videoSource("csi://0", argv=['--input-width=1920', '--input-height=1080', '--input-frameRate=30'])      # Or "/dev/video0" for V4L2 camera
output = videoOutput("rtp://127.0.0.1:1234", argv=['--output-width=1920', '--output-height=1080', '--output-frameRate=30', '--output-codec=h264']) 

while True :
	img = input.Capture()
	output.Render(img)

	# exit on input/output EOS
	if not input.IsStreaming() or not output.IsStreaming():
		break

You would first install these packages:

sudo apt install libgstrtspserver-1.0 libgstreamer1.0-dev

Then you may use this python script that would relay RTP/H264 from port 1234 to RTSP port 8554:

import gi
gi.require_version('Gst','1.0')
gi.require_version('GstRtspServer','1.0')
from gi.repository import GLib, Gst, GstRtspServer

Gst.init(None)

mainloop = GLib.MainLoop()
server = GstRtspServer.RTSPServer()
mounts = server.get_mount_points()

factory = GstRtspServer.RTSPMediaFactory()
factory.set_launch('( udpsrc port=1234 ! application/x-rtp, encoding-name=H264 ! rtph264depay ! h264parse ! rtph264pay name=pay0 )')

mounts.add_factory("/test", factory)
server.attach(None)

print("stream ready at rtsp://127.0.0.1:8554/test")
mainloop.run()

Then you would be able to test from the Jetson (assuming it has a display):

gst-launch-1.0 uridecodebin uri=rtsp://127.0.0.1:8554/test ! nvvidconv ! autovideosink

and then try to read the stream at uri rtsp://JetsonIP:8554/test from other hosts.

The dev branch of jetson-inference/jetson-utils has native support for RTSP output. It internally manages the GstRtspServer. You should be able to try it out if you clone/build the dev branch and use something like jetson.utils.videoOutput("rtsp://@:1234/my_stream")