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
- Login to your facebook account and on the homepage there's a Live Video section in the center, click on it.
- Click on Go live
- Choose Streaming software and note the Stream key. The stream key will be used while adding the rtmp endpoint.
- Copy the Server URL listed under Advanced Settings. The server URL will also be used while adding the rtmp endpoint.
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
-
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.
-
Go to the stream you want to restream and click on the hamburger icon located at the extreme right of the screen.
-
Click on Edit RTMP Endpoint.
- Add the Facebook RTMPs endpoint and click Add RTMP endpoint
Congratulations! The stream is live on Facebook.
How to Publish Live Stream on Youtube
-
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.
- Go to YouTube and locate the Create button on the top right side and select Go Live.
- 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
-
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.
-
Go to the stream you want to restream and click on the hamburger icon located at the extreme right of the screen.
-
Click on Edit RTMP Endpoint.
- 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
-
Login to your Twitch account.
-
Navigate to the profile icon on the top right and go to Creator Dashboard
- Go to Settings > Stream and copy the primary Stream Key
- 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
-
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.
-
Go to the stream you want to restream and click on the hamburger icon located at the extreme right of the screen.
-
Click on Edit RTMP Endpoint.
- 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.