Reputation: 113
So I have a full working pipeline done in python that I am currently just dumping into an autovideosrc. I want to be able to stream through RTSP so I've been looking at gstrtspserver but from what I can tell gstrtspserver only uses a gst_parse_launch like function to construct its pipeline, such as this example
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('( videotestsrc pattern=ball is-live=1 ! x264enc speed-preset=ultrafast tune=zerolatency ! rtph264pay name=pay0 pt=96 )')
mounts.add_factory("/test", factory)
server.attach(None)
print("stream ready at rtsp://127.0.0.1:8554/test")
mainloop.run()
Is there a way to stream an existing pipeline through RTSP?
Upvotes: 1
Views: 1085
Reputation: 106
You have to derive your own class from GstRtspServer.RTSPMediaFactory and customize the method do_create_element(self, uri) so that it build and returns your own pipeline.
Upvotes: 0
Reputation: 1285
You could use gst_rtsp_media_take_pipeline (), which takes an existing pipeline. You would have to derive a class from GstRTSPMediaFactory to return that new GstRTSPMedia type.
Upvotes: 1