Streaming from RTMP device to SRT listener

Posted on Mon 14 November 2022 in Multimedia, Wirtualizacja • 2 min read

Supose you have device like LiveU Solo or one of very popular chinese video encoders, those devices do not support SRT protocol so if you want stream to vMix you must find solution.

Generally you need to create some kind of middleware that will ingest RTMP stream and push it to SRT Listener in vMix.

You can set up nginx with nginx_rtmp module on server and ask nginx to restream video to web page with embedded HTML5 player. Then you can get it with vMix web browser input. But you can expect loss of quality.

Better way is to compile FFmpeg with SRT support and then ingest RTMP and restream with SRT:

git clone https://github.com/Haivision/srt.git
cd srt
./configure
make && make install
sudo apt -y install libssl-dev tclsh
Then get sources of FFmpeg as descibed there: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
but add following directive to configure before compiling:
./configure --enable-libsrt ...
But even better option is to create Docker container with all stuff prepared and ready to ingest and restream.
Supose your SRT converter is a Linux machine accessible at myserver.com domain and your vMix machine is behind firewall at my_vmix.com.
On myserver.com you need to run following shell script which pulls and starts Docker image with SRT capable version of FFmpeg:
#!/bin/sh
docker run --restart=unless-stopped -d --name=my_srt_converter -p 1935:1935 eyevinntechnology/toolbox-srttx --passthrough --inputtype=rtmp my_stream my_vmix.com:6001
As you can see it runs container which waits for RTMP stream on 1935 port then restream it to my_vmix.com on port 6001. This port on firewall redirects SRT stream to local vMix machine with SRT Listener waiting.
In my case local machine is 192.168.1.10 and SRT Listener has port 5000.
So everything looks like this:
image1