Giter VIP home page Giter VIP logo

aloysmose / live-stream-on-aws Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-solutions/live-streaming-on-aws

0.0 1.0 0.0 1.8 MB

The live stream solution is a reference deployment that demonstrates how to deliver highly available live streaming video through an integrated workflow between Elemental Cloud and AWS.

Home Page: http://www.elemental.com/

License: Apache License 2.0

Python 0.95% Shell 0.19% CSS 1.72% JavaScript 96.97% HTML 0.17%

live-stream-on-aws's Introduction

Live Streaming on AWS

How to implement Live streaming on AWS at scale leveraging AWS Elemental MediaLive, MediaPackage and Amazon CloudFront. This repo contains the source code for the AWS solution Live Streaming on AWS.

Architecture Overview

Architecture

AWS Elemental MediaLive
Is configured to ingest 2 live feeds and transcode the content into multiple adaptive bitrate HLS content. The solution can be configured to ingest RTP RTMP HLS and MediaConnect streams and will apply 1 of 3 encoding profiles which include bitrates of 1080p through 270p. The encoding profile is set at launch and is based on the source resolution (See Encoding Profiles below).

AWS Elemental MediaPackage
Ingests the MediaLive Output and package the Live stream into HLS, DASH, MSS and CMAF formats that are delivered through 3 MediaPackage custom endpoints.

Amazon CloudFront
Is configured with the MediaPackage custom endpoints as the Origins for the distribution. CloudFront then enable the live stream content to be delivered globally and at scale.

Optional Demo Deployment
As part of the CloudFormation template a Demo HTML preview player is deployed to an Amazon S3 bucket which is a single page HTML/JavaScript application that will playback the HLS, DASH, MSS and CMAF streams. In addition, the solution can be configured to ingest a Demo HLS feed hosted on AWS.

Deployment

The solution is deployed using a CloudFormation template with a lambda backed custom resource, available in both NodeJS and Python. For details on deploying the solution please see the details on the Solution home page: Live Streaming on AWS

Encoding Profiles

To solution Configures AWS Elemental MediaLive with one of three encoding profiles based on the source resolution defined at launch as a CloudFormation parameter. The three options are 1080, 720, 540 and correspond to the following encoding profiles:

1080p Profile::
1080p@6500kbps, 720p@5000kbps, 720p@3300kbps, 540p@2000kbps, 432p@1200kbps, 360p@800kbps, 270@400kbps, 234p@200kbps.

720p Profile::
720p@5000kbps, 720p@3300kbps, 540p@2000kbps, 432p@1200kbps, 360p@800kbps, 270@400kbps, 234p@200kbps.

540p Profile::
540p@2000kbps, 432p@1200kbps, 360p@800kbps, 270@400kbps, 234p@200kbps.

The profiles are defined in JSON and and can be found in:

  source/custom-resource-js/lib/medialive/encoding-profiles/
  source/custom-resource-py/encoding-profiles/

Source code

source/custom-resources-js::
A NodeJS based Lambda function used as a custom resource for deploying MediaLive and MediaPackage resources through CloudFormation.

source/custom-resources-py::
A Python based Lambda function used as a custom resource for deploying MediaLive and MediaPackage resources through CloudFormation.

source/console::
A single page application used to demo playback of the live stream. This is deployed to an AWS S3 bucket as part of the CloudFormation deployment.

Creating a custom Build

To solution can be deployed through the CloudFormation template available on the solution home page: Live Streaming on AWS. To make changes to the solution, download or clone this repo, update the source code and then run the deployment/build-s3-dist.sh script to deploy the updated Lambda code to an S3 bucket in your account.

Pre-requirements:

1. Create an Amazon S3 Bucket.

The CloudFormation template is configured to pull the Lambda deployment packages from Amazon S3 bucket in the region the template is being launched in. Create a bucket in the desired region with the region name appended to the name of the bucket. eg: for us-east-1 create a bucket named: bucket-us-east-1

2. Create the deployment packages:

Run the build-s3-dist.sh script, passing in 2 variables:

  • CODEBUCKET = the name of the S3 bucket (do NOT include the -region extension)
  • CODEVERSION = this will be the subfolder containing the code.

This will:

  • copy the console files to ./deployment/dist/.
  • copy the CloudFormation template to ./deployment/dist/ and updates the source code mappings.
  • zip and copy the source code to ./deployment/dist/

Example:

  cd deployment/
  ./build-s3-dist.sh bucket 1.01

This will deploy the source code to:

  s3://bucket-us-east-1/live-streaming-on-aws/1.01/.

And update the CloudFormation template mappings:

  SourceCode:
    General:
      S3Bucket: bucket
      KeyPrefix: live-streaming-on-aws/1.01

3. Upload the Code to Amazon S3.

Use the AWS CLI to sync the lambda code and demo console files to amazon S3:

  cd deployment/
  aws s3 sync .dist/ s3://bucket-us-east-1/live-streaming-on-aws/1.01/.

4. Launch the CloudFormation template.

Launch the updated CloudFormation template from deployment/dist/ folder.


Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at

http://www.apache.org/licenses/

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and limitations under the License.

live-stream-on-aws's People

Contributors

tomnight avatar shsenior avatar aassadza avatar georgebearden avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.