Solution: Live Transcoding - EyevinnOSC/community GitHub Wiki
This tutorial walks you through using Open Source Cloud for live transcoding and the different options available for streaming and distributing live content.
- If you have not already done so, sign up for an OSC account.
- Be on a paid subscription plan
- OSC command line tool installed. You need version v0.14.2 or higher.
For best guaranteed performance we recommend purchasing a reservation for at least 1 single premium node (200 EUR per month) but not required to getting started.
In this scenario the CDN pulls the stream from the encoder instance in Open Source Cloud. We strongly recommend to place a CDN origin shield between the CDN distribution nodes and the encoder instance acting as origin.
Go to the web user interface and in the navigation menu on the left choose Settings. Click on the tab API and copy the Personal access token to the clipboard. Store this token in your terminal’s environment. Replace below with your token in the clipboard.
% export OSC_ACCESS_TOKEN=<personal-access-token>
Go back to the web user interface and navigate to the service called Eyevinn Live Encoding. Click on the tab Service Secrets and the button New Secret.
Create a secret called streamkeya
containing mysecretkey
. This will be the stream key the live production software will need to be able to push the stream to the encoder.
In the web user interface click on the button "Create encoder +" and enter the following in the instance creation dialog.
- Name:
guide
- HlsOnly:
true
- StreamKey:
{{secrets.streamkeya}}
You will create one encoder instance for each live stream you want to distribute.
Once the instance is up and running you can use the REST API it provides to start and stop the encoder. API documentation is available at https://<instance-url>/api/docs
for example https://demo-guide.eyevinn-live-encoding.auto.prod.osaas.io/api/docs
You can also use the OSC command line tool to start and stop the encoder.
% osc live start-multi guide
Start streaming to rtmp://172.232.131.169:10500/live/mysecretkey and watch at https://demo-guide.eyevinn-live-encoding.auto.prod.osaas.io/origin/hls/index.m3u8
In the above example guide
is the name of the encoder instance.
Now you can configure your live production software (for example OBS) to send the RTMP stream to, in this example, rtmp://172.232.131.169:10500/live/mysecretkey
.
You can play the HLS stream directly from the origin by opening an HLS capable video player to the address returned by the OSC tool. In this example it was https://demo-guide.eyevinn-live-encoding.auto.prod.osaas.io/origin/hls/index.m3u8
.
To stop the stream you can use the OSC command line tool and run the following command in your terminal.
% osc live stop-multi guide
Configure your CDN and CDN origin shield to fetch the stream from the URL that you tested with your video player.
In this scenario the live encoder push the stream to a WebDAV compatible origin that can receive HLS for example AWS Media Package.
In this example we will create an AWS Media Package origin. Create a channel in the AWS user interface.
Note down the URL, username and password for one of the HLS ingest endpoints.
Create a secret called streamkeya
containing mysecretkey
. This will be the stream key the live production software will need to be able to push the stream to the encoder.
Create a secret for the HLS ingest endpoint to push to.
mediapackageingest=https://<username>:<password>@<URL>
where is in the format xxxxx.mediapackage.xxxxxx.amazonaws.com/in/v2/146950c8d69d45c7a20f2995803d622e/146950c8d69d45c7a20f2995803d622e/channel
In the web user interface click on the button "Create encoder +" and enter the following in the instance creation dialog.
- Name:
guide
- HlsOnly:
true
- StreamKey:
{{secrets.streamkeya}}
- OutputUrl:
{{secrets.mediapackageinget}}
You will create one encoder instance for each live stream you want to distribute.
Once the instance is up and running you can use the REST API it provides to start and stop the encoder. API documentation is available at https://<instance-url>/api/docs
for example https://demo-guide.eyevinn-live-encoding.auto.prod.osaas.io/api/docs
You can also use the OSC command line tool to start and stop the encoder.
% osc live start-multi guide
Start streaming to rtmp://172.232.131.169:10500/live/mysecretkey and watch at https://demo-guide.eyevinn-live-encoding.auto.prod.osaas.io/origin/hls/index.m3u8
In the above example guide
is the name of the encoder instance.
Now you can configure your live production software (for example OBS) to send the RTMP stream to, in this example, rtmp://172.232.131.169:10500/live/mysecretkey
.
Create two origin endpoints in AWS Media Package channel. One for HLS and one for MPEG-DASH
Copy the playback URLs for HLS and MPEG-DASH and provide it to the video player. In the screenshot below we are using the DASH-IF reference MPEG-DASH player.
With AWS Media Package you have the option to encrypt the stream and apply DRM protection.