h264 instead

This commit is contained in:
Alex 2024-12-16 13:08:14 -04:00
parent 92d3a6b2ec
commit f273630bc7
1 changed files with 8 additions and 8 deletions

View File

@ -2,33 +2,33 @@
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import Gst, GstRtspServer, GLib
from gi.repository import Gst, GstRtspServer, GObject
class CustomRTSPMediaFactory(GstRtspServer.RTSPMediaFactory):
def __init__(self):
super().__init__()
super(CustomRTSPMediaFactory, self).__init__()
self.set_shared(True)
def do_create_element(self, url):
pipeline = (
"udpsrc port=5600 caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265\" ! "
"rtph265depay ! h265parse ! rtph265pay name=pay0 pt=96"
'udpsrc port=5600 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! '
'rtph264depay ! h264parse ! rtph264pay name=pay0 pt=96'
)
return Gst.parse_launch(pipeline)
class CustomRTSPServer(GstRtspServer.RTSPServer):
def __init__(self):
super().__init__()
super(CustomRTSPServer, self).__init__()
factory = CustomRTSPMediaFactory()
mount_points = self.get_mount_points()
mount_points.add_factory("/video", factory)
mount_points.add_factory("/test", factory)
self.attach(None)
def main():
Gst.init(None)
server = CustomRTSPServer()
loop = GLib.MainLoop() # Updated to GLib
print("RTSP Server running at rtsp://127.0.0.1:8554/video")
loop = GObject.MainLoop()
print("RTSP Server running at rtsp://127.0.0.1:8554/test")
loop.run()
if __name__ == "__main__":