redirect incoming stream to SRT with monaserver2

1,098 views
Skip to first unread message

Felix König

unread,
Feb 24, 2021, 6:28:25 PM2/24/21
to MonaServer

Hello,

I found a blog post about low latency video streaming: https://batoct.com/2020/02/23/low-latency-video-streaming-obs/
In it, it mentions that latency can be reduced by outputting the incoming stream via the SRT protocol instead of regular RTMP. Unfortunately it does not contain configuration snippets it ultimately used. I have no prior experience with any of these protocols, nor with monaserver and its configuration syntax and am struggling to have any intuitive feeling for what makes sense here, so please bear with me.

What _does_ work for me is simply streaming to rtmp://127.0.0.1:1935/live and consuming that stream from rtmp://127.0.0.1:1935/live/stream

The configuration file contains these sample configurations:

; UDP/TS input on port 1234 will be recorded in a mp4 file
; [test=Publication]
; IN 0.0.0.0:1234 UDP/TS
; OUT record.mp4

; resource 127.0.0.1:88/path/video.mp4 will be served to SRT on port 1234
; [test=Publication]
; IN 127.0.0.1:88/path/video.mp4
; OUT @0.0.0.0:1234 SRT/TS


The documentation lists UDP/TCP/SRT/RTP/HTTP/FILE as possible protocols. But my input is RTMP, so what am I supposed to use?
Looking at the logs I noticed that just streaming to rtmp://127.0.0.1:1935/live seems to use the publication "stream" (is it just the stream key?), so I attempted to simply add an OUT directive for that:

[stream=Publication]
OUT @0.0.0.0:1234 SRT/TS


But if I do this, or for anything else I tried, I always get "stream not supported" log messages at startup, for example:

Server.cpp[293] @0.0.0.0:1234 SRT/TS, @0.0.0.0 stream not supported

If I still try to connect to the stream:


ffplay just gives me the following errors and hangs:

ffplay version git-2020-05-10-fc99a24 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200328
  configuration:<snip>
00:26:36.098000*E:SRT.d: epoll/update: IPE: update struck EID 1 which is NOT SUBSCRIBED to @427389682
00:26:36.201000*E:SRT.d: epoll/update: IPE: update struck EID 1 which is NOT SUBSCRIBED to @427389682
00:26:36.303000*E:SRT.d: epoll/update: IPE: update struck EID 1 which is NOT SUBSCRIBED to @427389682
...

I am sure I already made many mistakes, but using the examples and documentation I have available I am unable to progress any further with this and would appreciate your help.

Best Regards,
Felix

Thomas Jammet

unread,
Feb 25, 2021, 3:17:10 AM2/25/21
to MonaServer
Hi Felix

It's good to see that you're interested in SRT, it's one of our last features in MonaServer!

I see that the example of MonaServer.ini file you are using is out of date, it was an old version which I wrongly let in the sourceforge packages. I have just updated all MonaServer&MonaTiny binaries on sourceforge so you can download them.

So the right configuration for your publication "stream" is the following :

[stream=Publication]
OUT srt://@0.0.0.0:1234

And to play it you just have to run the following command :

ffplay.exe srt://127.0.0.1:1234

Or you can also play this link directly from vlc.
Note that you don't need to configure the publication statically and you can use directly the dynamic protocol running on port 9710 by default.
For example to play a publication (published from any protocol) with srt you can run ffplay like this :


Here "stream" is the name of your publication.
Sadly vlc does not support this format (srt query strings are not supported).
And to publish dynamically the media "stream" with SRT run this ffmpeg command :

ffmpeg.exe -re -i <your file> -c copy -f mpegts srt://127.0.0.1:9710/?streamid=#!::r=stream,m=publish

Let us know how it works on your side.

Regards

Thomas
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages