Establishment of RTSP Server through RTSP streaming video

I am using Orin AGX - Jetson

I would like to bulid an RTSP Server by receiving streaming video transmitted as RTSP using python through Gst-launch-1.0

The code below runs, but the video does not play when accessing the RTSPServer address.

import sys
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import Gst, GstRtspServer, GObject,     GLib
loop = GLib.MainLoop()

Gst.init(None)
class     TestRtspMediaFactory(GstRtspServer.RTSPMediaFactory): 
def __init__(self):             
    GstRtspServer.RTSPMediaFactory.__init__(self)
def do_create_element(self, url): 
    #set mp4 file path to filesrc's location property 
    src_demux = "rtspsrc location=rtsp://rtsp streaming address/test" 
    pipeline = "{0} ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw ! autovideosink".format(src_demux) 
    print ("Element created: " + pipeline) 
    return Gst.parse_launch(pipeline)
class GstreamerRtspServer(): 
def __init__(self): 
    self.rtspServer = GstRtspServer.RTSPServer() 
    self.rtspServer.set_service("8600") 
    factory = TestRtspMediaFactory() 
    factory.set_shared(True) 
    mountPoints = self.rtspServer.get_mount_points() 
    mountPoints.add_factory("/4channels", factory) 
    self.rtspServer.attach(None)
    
if __name__ == '__main__': 
s = GstreamerRtspServer() 
try:
    loop.run()
except Exception as e:
    print("Error:", e)

This is the log that appears when executing python code and the phrase that appears when connecting to RTSPServer.
Python log:
<Gst.Pipeline object at 0xffff804a0180 (GstPipeline at 0xffff88122120)>
0:00:03.196835412 718987 0x1a46e920 FIXME rtspmedia rtsp-media.c:4201:gst_rtsp_media_suspend: suspend for dynamic pipelines needs fixing

Text when running video:
Could not get/set settings from/on resource.

Please give advice to experts.

Hi,
Please try test-launch and see if it works:
Jetson AGX Orin FAQ

Q: Is there any example of running RTSP streaming?

And for comparison, please try this string in your python code:

"videotestsrc is-live=1 ! nvvidconv ! nvv4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96"

Thank you very much for your reply.

Yes, there is. Below is a screenshot of the execution from the python code.

Hi,
So it looks like the original pipeline may not be correct. You can investigate this.

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