Skip to main content

Simulcasting to social media channels

This guide will show you how to use Ant Media Server to push your live stream to social media channels like Facebook, YouTube, Twitch, and other third-party RTMP endpoints.

How to Publish Live Stream on Facebook

Obtain the RTMPs endpoint from Facebook

  1. Login to your facebook account and on the homepage there's a Live Video section in the center, click on it.

  1. Click on Go live

  1. Choose Streaming software and note the Stream key. The stream key will be used while adding the rtmp endpoint.

  1. Copy the Server URL listed under Advanced Settings. The server URL will also be used while adding the rtmp endpoint.

info

If you want to use a persistent stream key, you just need to enable Persistent Stream key in the Advanced settings option.

The Facebook RTMPs Endpoint URL that will be used in Ant Media Server will be of the format: server-URL/stream-key

example:

rtmps://live-api-s.facebook.com:443/rtmp/FB-7359771564075190-0-AbwqSZYF2WgvXCVc

Add the RTMPs endpoint to the stream

  1. Go to the Live Stream section of your application on the Ant Media Server then to New Live Streams and create the stream as per your need.

  2. Go to the stream you want to restream and click on the hamburger icon located at the extreme right of the screen.

  3. Click on Edit RTMP Endpoint.

  1. Add the Facebook RTMPs endpoint and click Add RTMP endpoint

Congratulations! The stream is live on Facebook.

How to Publish Live Stream on Youtube

info
  • YouTube does not accept streams without audio, thus your stream needs to include audio.

  • In addition, this link provides suggested upload encoding settings for YouTube streaming.

Obtain the RTMP endpoint from YouTube

To publish live streams on your YouTube account, it is first needed to get the YouTube RTMP endpoint.

  1. Go to YouTube and locate the Create button on the top right side and select Go Live.

  1. It will open the YouTube Studio page where there's Stream URL and Stream key

Then copy the Stream URL and Stream Key.

The YouTube RTMP Endpoint URL that will be used in Ant Media Server will be of the format: stream-URL/stream-key

example

rtmp://a.rtmp.youtube.com/live2/dq1j-waph-e322-waxd-dxzd

Add the RTMP endpoint to the stream

  1. Go to the Live Stream section of your application on the Ant Media Server then to New Live Streams and create the stream as per your need.

  2. Go to the stream you want to restream and click on the hamburger icon located at the extreme right of the screen.

  3. Click on Edit RTMP Endpoint.

  1. Add the YouTube's RTMP endpoint and click Add RTMP endpoint

Congratulations! The stream is live on YouTube.

How to Publish Live Stream on Twitch

Obtain the RTMP endpoint from Twitch

  1. Login to your Twitch account.

  2. Navigate to the profile icon on the top right and go to Creator Dashboard

  1. Go to Settings > Stream and copy the primary Stream Key

  1. To get the Twitch RTMP ingest endpoint, please go to Twitch Ingest Server and copy the endpoint nearest to you.

Twitch RTMP Endpoint URL that will be used in Ant Media Server will be of the format: ingest-endpoint/stream-key

example

rtmp://del01.contribute.live-video.net/app/live_1019144780_gAWcIi9n8WTjQY5WvxHCarrltIXj3M

Add the RTMP endpoint to the stream

  1. Go to the Live Stream section of your application on the Ant Media Server then to New Live Streams and create the stream as per your need.

  2. Go to the stream you want to restream and click on the hamburger icon located at the extreme right of the screen.

  3. Click on Edit RTMP Endpoint.

  1. Add your Twitch RTMPs endpoint and click Add RTMP endpoint

Congratulations! The stream is live on Twitch.

How to Add/Remove RTMP Endpoints?

There are two options for adding/removing RTMP endpoints.

One of them is Add/Remove RTMP Endpoint with Dashboard, as shown in the examples above. It is intended for the general purpose.

Another option is to use the REST API to Add/Remove RTMP Endpoints.

REST API to add/remove RTMP endpoint

This option is for advanced users by making an API request to the rtmp-endpoint.

Add an RTMP endpoint

curl -X 'POST' \
'https://AMS-domain:5443/App-Name/rest/v2/broadcasts/streamId/rtmp-endpoint' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"rtmpUrl": "rtmp://endpoint-URL/StreamKey",
}

After adding the endpoint, you will receive one random dataId that will be used to remove the added endpoint using the remove rtmp-endpoint Rest API described in next step.

{
"success": true,
"message": null,
"dataId": "customqfjJGd",
"errorId": 0
}

You can get more information in the following REST API.

Remove an RTMP endpoint

Now, that dataId will be used to remove the added RTMP Endpoint.

curl -X 'DELETE' \
'https://AMS-domain:5443/App-Name/rest/v2/broadcasts/streamId/rtmp-endpoint?endpointServiceId=dataId-from-add-endpoint-response' \
-H 'accept: application/json'

You can get more information in the following REST API.

Click for more detail about REST API Guide.

PS: To use the Rest APIs, please add your IP address to the Enable IP Filter for RESTful API option in the application Settings.