Live Streaming with RTMP

Example

:gear: Custom Services

The quickest way to get started testing with a custom service is to pull an existing project. For this example, we’ll be using a Github project called Node Media Server to create a simple RTMP server to receive and view the stream data.

Prerequisites

  1. Follow the steps in this guide to enable live streaming on your account
  2. Download and Install NPM
  3. Download and install FFMPEG
  4. Download and install Ngrok

Getting Started

Download and Install Node Media Server

At the time of writing, the quickest and easiest way to get set up is to run the following command in a shell terminal:

npm i node-media-server -g && node-media-server

Here’s a screenshot of what that looks like:

Log in to the Media Server

You can navigate to http://localhost:8000/admin to see the web portal for your new server. Log in with the username admin and the password admin.

You’re the proud owner of a brand new RTMP server! :tada:

Test the Server

In a new terminal window, you can now use FFMPEG and an MP4 file that you’ve downloaded to test the RTMP server. If you are looking for a video to use, you can download the sample videos found here.

Example Command for H.264 and AAC

ffmpeg -re -i INPUT_FILE_NAME -c copy -f flv rtmp://localhost/live/STREAM_NAME

Example Command for Other Formats

ffmpeg -re -i INPUT_FILE_NAME -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -ar 44100 -f flv rtmp://localhost/live/STREAM_NAME

Once we are streaming to the server, we can view that stream by navigating to http://localhost:8000/admin/streams

Clicking the stream name will allow us to view the content being streamed to the server:

Streaming From Zoom

Now that we have confirmed the server accepts RTMP streams, we’ll need to set up our server so that it is accessible to Zoom.

Currently, it’s hosted on localhost, and in order to make the server accessible publicly, we’ll need to use Ngrok.

Start Ngrok

In a new terminal window, we’ll tell Ngrok to forward TCP traffic for port 1935 (the default RTMP port) through our public tunnel

ngrok tcp 1935

Your terminal window should look like this:

image

Make sure to save the forwarding URL which in this case is tcp://2.tcp.ngrok.io:14905

:warning: Each time you restart Ngrok the forwarding URL will change unless you have a paid plan
:warning: Using Ngrok impacts the latency and bandwidth of the stream. Do not use Ngrok for performance or latency testing.

Configure Zoom

The next step is to set up Zoom with our new live streaming server. We’ll just need to enable the feature on our account, fill out some information in Zoom and then we can view the stream from our server.

Configure Your Account

Make sure that you are testing with a Pro Plan or higher and that you have enabled Live Streaming for meetings on your account.

Create and start a Meeting

Create a new meeting that we will live stream. Open the latest version of the Zoom client and start the meeting

Configure Live Streaming

Click the three dots in the lower right-hand corner of the action bar and then click Live on Custom Live Streaming Service .

You will be presented with a browser page to fill in your live streaming server’s information:

image

:information_source: You can use the Update a Live Stream API to set this information programmatically

The Streaming URL is the base URL where your stream should be transmitted. It is the same URL that you used in FFMPEG but without the /STREAM_NAME path at the end. This is because STREAM_NAME is the Streaming Key in this case.

The Steaming Key has its own field in Zoom and will be appended to the Streaming URL so that the built URL is rtmp://3.tcp.ngrok.io:28098/live/ZOOM

As this is the name of the stream, the Streaming Key can be whatever you choose.

The Live Steaming Page URL is the URL where you can view your stream. As this is just a test server, our best option is to redirect to the streams page. To do this, we can start ngrok on port 8000 using ngrok http 8000 and use that URL.

Click Go Live! to return to the meeting.

View Your Broadcast

Now that we are streaming our meeting to our new RTMP server, we’ll want to make sure this stream is working as expected.

Navigate to http://localhost:8000/admin/streams to see the ZOOM stream listed:

Clicking on that stream will present us with the Zoom Meeting that is being streamed to our server:

:tada: :balloon: Congratulations! You’re now live streaming your Zoom Meeting to your own server! :balloon: :tada: