August 25, 2020

Install Nimble Streamer with SRT on MacOS using Docker

Nimble Streamer has full support of SRT protocol for the majority of platforms such as Linux and Windows. The MacOS support is missing due to a number of technical reasons. However our customers have been asking us about such capability.

With Docker, you can now bring SRT support in Nimble Streamer on macOS. Nimble will start and work properly on you Mac.

This article assumes you are familiar with macOS Terminal and you have an understanding of networking technologies. It's not a detailed description of Docker technology but rather a how-to describing our specific use case.

Here's a video that follows this article to demonstrate all steps. Read also read the text below to get more details on every step.

Now let's follow the steps below.

1. Install Docker for MacOS

Download Docker from its official website and follow installation instructions for MacOS. Those are very easy steps so we won't describe them in details.

2. Get Dockerfile from our GitHub

Create a new directory on your disk and download Dockerfile from our GitHub.

Change WMSPANEL_ACCOUNT and WMSPANEL_PASS parameters to your login and password in WMSPanel. Use WMSPANEL_SERVER_NAME parameter to set server name, it will be used in WMSPanel at the moment of container compilation and your server will be registered under that name.

3. Build image

Open the Terminal and go to the directory you've created earlier.

Run this command to create an image with the latest version of Nimble Streamer and SRT package:
docker build --no-cache -t nimble-srt:latest .
Now wait for a completion. If the operation was successful, you'll get "Successfully tagged nimble-srt:latest" message and your server will appear in WMSPanel marked as grey.

If anything goes wrong please contact our helpdesk with full log of your operations.

4. Run and Stop container

Now run your newly created container using this command:
docker run -d --rm -p 8081:8081 -p 1935:1935 -p 4444:4444/udp nimble-srt
After that you'll see your server in panel changing its color to green and status to "Running".

Once the container is launched you can connect to it using IP address of your Mac using mapped ports.

This new container is running in closed network of your docker so if you'd like to play streams produced by Nimble Streamer in that container, you need to specify proper IP in server settings at WMSPanel. Go to Servers top menu, then open server info page and click on Manage custom IP/Ports to add the IP of your Mac. After that you'll be able to perform the playback

To stop container, you need to get its ID using "docker ps" command and then stop using "docker stop CONTAINER_ID" command:

osa-vm-macos:nimble_img osa$ docker ps -q
osa-vm-macos:nimble_img osa$ docker stop 53778662dec3

5. Port mappings

In previous section we used TCP ports 8081 (for HLS and other HTTP-based protocols), 1935 (for RTMP) and UDP 4444 (for SRT). You may want to user other ports instead or add more ports. Please make sure these ports are not used by macOS.

To add another UDP port for container mapping just add "-p" parameter specifying required port, e.g. "-p 5555:5555/udp". Full command will look like this one:
docker run -d --rm -p 8081:8081 -p 1935:1935 -p 4444:4444/udp -p 5555:5555/udp nimble-srt
If you need TCP port then just remove "/udp".

6. Set up SRT in WMSPanel

Now you can set up SRT streaming using WMSPanel to control your Nimble instance in container with the previously mapped ports. We used port 4444 in our example so the SRT listener setup in "MPEGTS In" tab will look like this:

You can refer to SRT setup article to lean more about SRT setup process in Nimble Streamer.

Once you complete that you can start streaming SRT via IP and port specified above, using any SRT tool of your choice, like ffmpeg + srt-live-transmit, vMix. OBS or Larix Broadcaster.

7. Connect to the console of your container

If you need to log into the console of your container, get container ID first using this command
docker ps -q
Then use the result value in this command:
docker exec -it CONTAINER_ID /bin/bash

Once you get access, you can work with Nimble Streamer logs to track problems or update server parameters via nimble.conf file.

More on virtualization

The Dockerfile which we use in this article can be used for creating containers at other OSes.

Docker for macOS is basically using a small virtual Linux machine to work so you can also use other virtualization methods of running Nimble Streamer with SRT under Mac, like Virtual Box or VMware Workstation. Let us know if you need some special virtual machine to work with hypervisors.

Feel free to tell us about your experience of using Docker with Nimble Streamer.