Architecture details - Video on Demand on AWS Foundation

Architecture details

This section describes the components and AWS services that make up this solution and the architecture details on how these components work together.

Ingest

To invoke the video processing workflow, you must upload the source video assets to the source S3 bucket through standard tools. For example, you can use the AWS Management Console, AWS Command Line Interface (AWS CLI), or third-party tools that interface with Amazon S3.

By default, this solution creates an assets01 folder in the root of the source S3 bucket with a job-settings.json file. Each time you upload a video to the assets01 folder, or any other folder that you created:

  1. An Amazon S3 event notification invokes the job-submit Lambda function.

  2. The job-submit Lambda function:

    1. Receives the details for the source video from the event.

    2. Applies the settings contained in the job settings file in the same top-level folder as the uploaded video in Amazon S3.

    3. Submits a job to MediaConvert using the processed job settings file.

To help you track the job in MediaConvert, the solution includes the following in the submitted job:

  • Name of the workflow defined at deployment

  • A globally unique identifier (GUID) created by the job-submit Lambda function

Encoding

The solution supports MediaConvert QVBR encoding mode, which ensures consistent, high-quality video transcoding with the smallest file size for any type of source video content.

By default, this solution includes a sample encoding job settings file that encodes your source videos into MP4, SD and HD formats of HLS, and SD and HD formats of DASH. You can overwrite the provided encoding job settings to use output formats that are supported by MediaConvert.

The sample job settings file created as part of the CloudFormation deployment has the QVBR rate control activated with accelerated transcoding set to PREFERRED. This generates the following output:

  • HLS ABR with 5 renditions @ 1920x1080, 1280x720, 960x540, 640x360, 480x270

To change the settings, you can update or replace the job settings file in Amazon S3 with your own settings. For details, refer to Exporting and importing AWS Elemental MediaConvert jobs in the MediaConvert User Guide. To ensure validity of the job settings file, only export jobs that have successfully run and completed.

Processing

This solution includes an EventBridge rule configured to invoke the job-complete Lambda function each time an encoding job starts up, completes successfully, or fails in MediaConvert. This function retrieves the details of the job from the event and generates the CloudFront URLs for the MediaConvert outputs. The solution then adds details for the input file, job settings, and outputs to a jobs-manifest.json file stored at the root of the source S3 bucket. The following is an example jobs-manifest.json file.

{ "Jobs": { "jobId-0001": { "FileInput": "s3://SOURCE_BUCKET/example.mp4", "JobSettings": {...}, "Outputs": { "HLS": "https://cloudfront.net/..." } }, "jobId-0002": { "FileInput": "s3://SOURCE_BUCKET/example2.mp4", "JobSettings": {...}, "Outputs": { "HLS": "https://cloudfront.net/..." } } } ... }

The job-complete Lambda function also sends a summary of the job and the outputs to the Amazon SNS topic created at deployment. Errors from the encoding process are also captured by the Lambda function and sent to the SNS topic.

AWS services in this solution

AWS service Description
AWS CloudFormation Core. This solution uses AWS CloudFormation templates and stacks to automate its deployment.
Amazon CloudFront Core. Accelerates delivery of the video content from the destination S3 bucket to end users.
AWS Elemental MediaConvert Core. Transcodes media files from their source format into HLS ABR files.
AWS Lambda Core. Provides job submit functions without provisioning or managing servers.
Amazon SNS Core. Sends notifications of completed jobs.
Amazon S3 Core. Provides the storage for source video files and the outputs from MediaConvert.
Amazon CloudWatch Supporting. Logs metrics about encoding jobs in MediaConvert.
Amazon EventBridge Supporting. Invokes the Lambda job complete function.
AWS Systems Manager Supporting. Provides application-level resource monitoring and visualization of resource operations and cost data.