Thursday, October 3, 2019

Low Latency Streaming from OBS to BrightSign Using SRT

There are a few free video streaming services that support low-latency streaming over the internet, notably Mixer and YouTube ultra-low latency. However if you prefer local streaming (perhaps to conserve bandwidth) or prefer open source, let's take a look at how you can stream from OBS Studio to BrightSign players (not open source) or other devices that support SRT streaming protocol such as VLC.

Hopefully at some point soon OBS will support SRT, but for now we'll need to run a separate application. Assuming that you are already using OBS for streaming to an external destination, we'll use the "recording" feature to send to Haivision's srt-live-transmit application.

There's some work required to compile srt-live-transmit, and I'll admit I haven't gotten it to work on Windows yet, but it's easy on Linux (including Windows Subsystem for Linux) and Mac.

SRT for Mac

Getting SRT on Mac just involves launching the "Terminal" program and running two commands:

brew update
brew install srt

This will install srt-live-transmit at:

/usr/local/Cellar/srt/1.4.0/bin/srt-live-transmit

SRT for Linux or WSL

If you have Ubuntu installed under Windows 10 through Windows Subsystem for Linux, you can run the following commands in the terminal:

sudo apt update
sudo apt upgrade
sudo apt install tclsh pkg-config cmake libssl-dev build-essential git
git clone https://github.com/Haivision/srt.git
cd srt
./configure
make

After the compilation process, you should have:

~/srt/srt-live-transmit

Sending from OBS to srt-live-transmit

From the terminal (on Mac, Linux, or WSL), run the following command:

./srt-live-transmit udp://:1234 srt://:5678 -v

On your Mac you may first need to change to the right directory:
cd /usr/local/Cellar/srt/1.4.0/bin/

That command listens for a UDP stream (that we'll send from OBS) and listens for a request to unicast it as an SRT stream. The -v means verbose mode, which allows us to read what it is doing.

In OBS we need to go into Settings, click on Output, switch the Output Mode to Advanced and click on the Recording tab. Switch the Type to Custom Output (FFmpeg) and the FFmepeg Output Type to Output to URL.

The File path or URL should be set to udp://127.0.0.1:1234?pkt_size=1316 (127.0.0.1 means sending to the same computer that OBS is running on) and the Container Format should be changed to mpegts. I haven't done any testing, but I'm assuming that decreasing the Keyframe interval should decrease latency, and decreasing the Audio Bitrate is probably fine to decrease bandwidth usage.



Click OK, then the Start Recording button. Have a look at the terminal window where srt-live-transmit is running. You should see information about the stream.

Add the SRT source to BrightSign or play it as a network source in VLC (if your sending computer is at 10.0.0.200 then srt://10.0.0.200:5678). You should see your stream that is being transmitted from OBS and relayed by srt-live-transmit.

Hopefully this works for you, feel free to comment if you encounter issues.

No comments: