Use gst-rtsp-server as rtsp relay (1 to N)

Adrien Aubourg adrien.aubourg at gmail.com
Tue Jul 25 12:55:06 UTC 2017


Heya !

In order to do "1-to-N" video streaming, I'm currently using nginx with the
rtmp module on a dedicated server.
But the need to reduce the video delay between the host and the viewer
began to arise. The current delay is around 5 seconds, and I'd like it to
be under 1 second.

To reduce the delay, I'd like to stream over udp/rtp thanks to rtsp.

I had a look at the examples of gst-rtsp-server. Thanks to them:
- I succeeded to deliver a video to several clients (test-readme,
test-launch and test-mp4)
- I succeeded to receive a video from OBS [1] (using custom ffmpeg output)
- I succeeded to record into a file on the server the stream emitted from
OBS

Unfortunately, I don't know how to "connect" the "record" pipeline to the
"play" pipelines.
I tried using fdsink/fdsrc, or tcpserversink with localhost, without
success.

How would you do such thing; use gst-rtsp-server to receive a stream
(RECORD) and dispatch them through clients (PLAY) ?

Here's my base code around which I'm working, nothing fancy though:
--------------------------------
#!/usr/bin/python3

import sys
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import GObject, Gst, GstRtspServer

if __name__ == "__main__":
    GObject.threads_init()
    loop = GObject.MainLoop()
    Gst.init(None)

    server = GstRtspServer.RTSPServer()
    server.set_service('8554')

    factory = GstRtspServer.RTSPMediaFactory()
    factory.set_launch("( decodebin name=depay0 ! fakesink decodebin
name=depay1 ! fakesink )")
    factory.set_shared(True)
    factory.set_transport_mode(GstRtspServer.RTSPTransportMode.RECORD)

    server.get_mount_points().add_factory("/input", factory)

    server.attach(None)
    print("stream ready at rtsp://51.254.33.165:8554/input")

    loop.run()
--------------------------------

Thank you for your help,
Cordially,
Adrien

[1] https://obsproject.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170725/22f1741e/attachment.html>


More information about the gstreamer-devel mailing list