It somehow stopped working with theora but now it works with H264...
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 16 Sep 2020 21:27:17 +0000 (23:27 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 16 Sep 2020 21:27:17 +0000 (23:27 +0200)
lagarde.py

index 1724d290d2cb99562031c045a212d40e77e2dfcc..a5f8fbdffbc1e76c6954af16436002c28d8cd4bc 100755 (executable)
@@ -32,7 +32,12 @@ class GstreamerRtspServer():
         server.set_address("::")
         server.set_service('8554')  # port as string
         factory = GstRtspServer.RTSPMediaFactory()
-        factory.set_launch("intervideosrc ! decodebin ! theoraenc ! queue ! rtptheorapay name=pay0")
+        # factory.set_launch("intervideosrc ! decodebin ! theoraenc ! queue ! rtptheorapay name=pay0")
+        # factory.set_launch("intervideosrc ! decodebin ! videoconvert ! video/x-raw,format=I420 ! theoraenc ! queue ! rtptheorapay name=pay0")
+        # factory.set_launch("intervideosrc ! decodebin ! videorate ! videoconvert ! video/x-raw,format=I420,framerate=10/1 ! theoraenc ! queue ! rtptheorapay name=pay0")
+        # factory.set_launch("intervideosrc ! decodebin ! videoconvert ! video/x-raw,format=I420 ! x264enc ! queue ! rtph264pay pt=96 name=pay0")
+        factory.set_launch("intervideosrc ! decodebin ! x264enc ! queue ! rtph264pay pt=96 name=pay0")
+        # factory.set_launch("intervideosrc ! decodebin ! videorate ! videoconvert ! video/x-raw,framerate=10/1 ! x264enc ! queue ! rtph264pay pt=96 name=pay0")
         factory.set_shared(True)
         mountPoints = server.get_mount_points()
         mountPoints.add_factory("/cug", factory)
@@ -78,7 +83,7 @@ class Lagarde:
         caps = pad.get_current_caps()
         padsize = caps.get_size()
         for i in range(padsize):
-            s = caps.get_structure(i) # Gst.Structure
+            s = caps.get_structure(i)  # Gst.Structure
             name = s.get_name()
             if name.startswith('video'):
                 q = Gst.ElementFactory.make('queue')
@@ -91,6 +96,7 @@ class Lagarde:
                 pad.link(q.get_static_pad('sink'))
                 q.link(conv)
                 conv.link(sink)
+                self.pipe.set_state(Gst.State.PLAYING)
 
     async def listen_to_gstreamer_bus(self):
         self.webrtcbin = Gst.ElementFactory.make('webrtcbin', 'laplace')