Giter Site home page Giter Site logo

mgny / dolby-vision-on-aws Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-solutions/video-on-demand-on-aws

1.0 2.0 0.0 8.68 MB

A reference implementation to deploy an encoding and distribution workflow for Dolby Vision video on demand content.

License: Apache License 2.0

JavaScript 89.87% Shell 2.18% Python 7.95%

dolby-vision-on-aws's Introduction

Dolby Vision on AWS

How to implement a dolby-vision workflow on AWS leveraging AWS Step Functions, AWS Elemental MediaConvert, and AWS Elemental MediaPackage.

On this Page

Architecture Overview

Architecture

Deployment

The solution is deployed using a CloudFormation template with a lambda backed custom resource.

Please ensure you test the new template before updating any production deployments.

Workflow Configuration

The workflow configuration is set at deployment and is defined as environment variables for the input-validate lambda function (which is the first step in the ingest process).

Environment Variables:

  • CloudFront: CloudFront domain name, used to generate the playback URLs for the MediaConvert outputs
  • Destination: The name of the destination S3 bucket for all of the MediaConvert outputs
  • Source: The name of the source S3 bucket
  • JobsBucket: The name of the S3 bucket for input job metadata files
  • Templates: The name of the S3 bucket for custom encoding templates
  • WorkflowName: Used to tag all of the MediaConvert encoding jobs
  • AcceleratedTranscoding Enabled Accelerated Transocding in MediaConvert. options include ENABLE, DISABLE, PREFERRED. for more detials please see:
  • EnableSns Send SNS notifications for the workflow results.
  • EnableSqs Send the workflow results to an SQS queue

WorkFlow Triggers

Source Metadata

The stack is deployed with the workflow trigger parameter set to MetadataFile; therefore the S3 notification is configured to trigger the workflow whenever a JSON file is uploaded. This allows different workflow configuration to be defined for each source video processed by the workflow.

Important: The source video file and/or custom templates must be uploaded to S3 before the metadata file is uploaded, and the metadata file must be valid JSON with a .json file extension.

Example JSON job metadata file (with default template):

{
    "srcVideo": "SolLevante_IMF_DolbyVision_PQP3D65_UHD_24fps/VIDEO_e4da5fcd-5ffc-4713-bcdd-95ea579d790b.mxf",
    "jobTemplate": {
        "type": "default",
        "name": "dolby-vision-on-aws-default-template-cmaf-dvp5-24fps"
    }
}

Example JSON job metadata file (with custom template):

{
    "srcVideo": "SolLevante_IMF_DolbyVision_PQP3D65_UHD_24fps/VIDEO_e4da5fcd-5ffc-4713-bcdd-95ea579d790b.mxf",
    "jobTemplate": {
        "type": "custom",
        "name": "custom-job-24fps-mp4_2160p_1080p-full-template.json"
    }
}

Required fields for the metadata file are srcVideo, jobTemplate, name and type. The workflow will default to the environment variables settings for the ingest validate lambda function for any settings not defined in the metadata file.

Full list of options:

{
    "srcVideo": "string",
    "srcBucket": "string",
    "destBucket": "string",
    "cloudFront": "string"
}

Sample job metadata files are found in the test folder.

The solution also supports adding additional metadata, such as title, genre, or any other information, you want to store in Amazon DynamoDB.

Encoding Templates

At launch the Solution creates 10 MediaConvert job templates which are used as the default encoding templates for the workflow:

  • default-template-cmaf-dvp5-24fps
  • default-template-cmaf-dvp5-25fps
  • default-template-cmaf-dvp5-30fps
  • default-template-cmaf-dvp5-50fps
  • default-template-cmaf-dvp5-60fps
  • default-template-mp4-dvp5-24fps
  • default-template-mp4-dvp5-25fps
  • default-template-mp4-dvp5-30fps
  • default-template-mp4-dvp5-50fps
  • default-template-mp4-dvp5-60fps

Custom encoding templates can be also created by the user and located in the S3 bucket "Templates".

The type and name of the template to be used are specified in the job metadata file by the user. If custom encoding template is chosen, it checks the S3 bucket for Templates, gets the user-given encoding template json, then submits a job to Elemental MediaConvert. If default template is chosen, the job is submitted with one of the default encoding templates described above.

Sample custom encoding templates are found in the test folder.

Accelerated Transcoding

(This option is not tested with Dolby Vision encoding job. Therefore, it is set to DISABLED by default.)

Version 5.1.0 introduces support for accelerated transcoding which is a pro tier feature of AWS Elemental MediaConvert. This feature can be configured when launching the template with one of the following options:

  • ENABLED All files upload will have acceleration enabled. Files that are not supported will not be processed and the workflow will fail
  • PREFERRED All files uploaded will be processed but only supported files will have acceleration enabled, the workflow will not fail.
  • DISABLED No acceleration.

For more detail please see Accelerated Transcoding.

Source code

Node.js 12

  • archive-source: Lambda function to tag the source video in s3 to enable the Glacier lifecycle policy.
  • custom-resource: Lambda backed CloudFormation custom resource to deploy MediaConvert templates configure S3 event notifications.
  • dynamo: Lambda function to Update DynamoDB.
  • encode: Lambda function to submit an encoding job to Elemental MediaConvert.
  • error-handler: Lambda function to handler any errors created by the workflow or MediaConvert.
  • input-validate: Lambda function to parse S3 event notifications and define the workflow parameters.
  • media-package-assets: Lambda function to ingest an asset into MediaPackage-VOD.
  • output-validate: Lambda function to parse MediaConvert CloudWatch Events.
  • profiler: Lambda function used to send publish and/or error notifications.
  • step-functions: Lambda function to trigger AWS Step Functions.

Python 3.7

  • mediainfo: Lambda function to run mediainfo on an S3 signed url.

./source/mediainfo/bin/mediainfo must be made executable before deploying to lambda.

Creating a custom build

The solution can be deployed through the CloudFormation template available on the solution home page: Video on Demand 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 Amazon S3 bucket in your account.

Prerequisites:

1. Running unit tests for customization

Run unit tests to make sure added customization passes the tests:

cd ./deployment
chmod +x ./run-unit-tests.sh
./run-unit-tests.sh

2. 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 (e.g. for us-east-1 create a bucket named my-bucket-us-east-1).

aws s3 mb s3://my-bucket-us-east-1

3. Create the deployment packages

Build the distributable:

chmod +x ./build-s3-dist.sh
./build-s3-dist.sh my-bucket dolby-vision-on-aws version

Notes: The build-s3-dist script expects the bucket name as one of its parameters, and this value should not include the region suffix.

Deploy the distributable to the Amazon S3 bucket in your account:

aws s3 cp ./regional-s3-assets/ s3://my-bucket-us-east-1/dolby-vision-on-aws/version/ --recursive --acl bucket-owner-full-control

4. Launch the CloudFormation template.

  • Get the link of the dolby-vision-on-aws.template uploaded to your Amazon S3 bucket.
  • Deploy the Video on Demand to your account by launching a new AWS CloudFormation stack using the link of the dolby-vision-on-aws.template.

Additional Resources

Services

Other Solutions and Demos


Copyright 2020 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. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

dolby-vision-on-aws's People

Contributors

tomnight avatar georgebearden avatar shsenior avatar mgny avatar aassadza avatar jpeddicord avatar stevemorad avatar

Stargazers

 avatar

Watchers

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