Solution: Live Transcoding - EyevinnOSC/community GitHub Wiki

Getting Started

This tutorial walks you through using Open Source Cloud for live transcoding and the different options available for streaming and distributing live content.

Prerequisites

  • 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.

Live Transcoding and CDN pull stream

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.

live_encoding_cdn_pull

Step 1: Setup secrets

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.

Skärmavbild 2024-07-11 kl  07 39 00

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.

Step 2: Create encoder instance

In the web user interface click on the button "Create encoder +" and enter the following in the instance creation dialog.

Skärmavbild 2024-07-11 kl  07 41 57

  • Name: guide
  • HlsOnly: true
  • StreamKey: {{secrets.streamkeya}}

You will create one encoder instance for each live stream you want to distribute.

Step 3: Start encoder

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.

Step 4: Watch the stream

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.

Skärmavbild 2024-07-11 kl  07 47 36

Step 5: Stop the stream

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

Step 6: Configure CDN

Configure your CDN and CDN origin shield to fetch the stream from the URL that you tested with your video player.

Live Transcoding and push to WebDAV origin

In this scenario the live encoder push the stream to a WebDAV compatible origin that can receive HLS for example AWS Media Package.

live_encoding_cdn_push

Step 1: Setup origin

In this example we will create an AWS Media Package origin. Create a channel in the AWS user interface.

Skärmavbild 2024-07-09 kl  22 08 02

Note down the URL, username and password for one of the HLS ingest endpoints.

Step 2: Setup secrets

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

Step 2: Create encoder instance

In the web user interface click on the button "Create encoder +" and enter the following in the instance creation dialog.

Skärmavbild 2024-07-11 kl  09 37 07

  • Name: guide
  • HlsOnly: true
  • StreamKey: {{secrets.streamkeya}}
  • OutputUrl: {{secrets.mediapackageinget}}

You will create one encoder instance for each live stream you want to distribute.

Step 3: Start encoder

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.

Step 4: Setup origin endpoints

Create two origin endpoints in AWS Media Package channel. One for HLS and one for MPEG-DASH

Skärmavbild 2024-07-11 kl  09 56 20

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.

Skärmavbild 2024-07-11 kl  09 55 58

With AWS Media Package you have the option to encrypt the stream and apply DRM protection.

⚠️ **GitHub.com Fallback** ⚠️