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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Adrien Aubourg
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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Adrien Aubourg
Heya,

I tried to connect two pipelines from two different factories.
The "record" factory used fdsink, and the "play" factory used fdsrc. The UNIX socket were created by Python (I tried DGRAM and STREAM).

For now, I'm still struggling.
Anyway, is this the right way to do ?

How would you proceed to create a proxy server with gst-rtsp-server ?

Thanks,
Adrien

2017-07-25 14:55 GMT+02:00 Adrien Aubourg <[hidden email]>:
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


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel