I have a RTSP viewer on a small local network that I would like to use as a monitor. I'ts really just to access the CLI in the event that an automated service on a Rspberry pi doesn't start or run correctly.
so far I have this script using gstreamer, but I can't seem to connect to it. It appears that the server is running but I can't connect to it.
I have shutdown the firewall and have verified that the port is open with netstat. I'mnot sure what do try next.
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import Gst, GstRtspServer, GLib
class CLI_RTSPServer(GstRtspServer.RTSPMediaFactory):
def __init__(self):
super(CLI_RTSPServer, self).__init__()
#self.set_launch("( fbdevsrc device=/dev/fb0 ! videoconvert ! x264enc tune=zerolatency ! rtph264pay name=pay0 pt=96 )")
self.set_launch("( fbdevsrc device=/dev/fb0 ! videoscale ! video/x-raw,width=640,height=480 ! videoconvert ! x264enc tune=zerolatency bitrate=500 ! rtph264pay name=pay0 pt=96 )")
if __name__ == "__main__":
Gst.init(None)
server = GstRtspServer.RTSPServer()
factory = CLI_RTSPServer()
factory.set_shared(True)
server.set_service("554") # Bind to the default RTSP port 554
server.get_mount_points().add_factory("/cli", factory)
server.attach(None)
print("RTSP server is running at rtsp://localhost:8554/cli")
loop = GLib.MainLoop()
loop.run()