AWS Media Blog

VOD Automation Part 1: Create a Serverless Watchfolder Workflow Using AWS Elemental MediaConvert

Introduction

File-based video processing workflows on AWS can be built using AWS Elemental MediaConvert to transcode source media into output formats. Using MediaConvert, video providers with any size content library can easily and reliably transcode on-demand content for multiscreen delivery. Once you start using MediaConvert to transcode videos, the next step is usually to build an automated workflow to process your content.

In part 1 of this series on automating video on demand (VOD) workflows, we’ll show you how to create a serverless watchfolder, which is a simple method to automate video processing. Users with video ready to be processed simply upload their files to a specific storage folder or location. The upload to this “watched folder” automatically starts an ingest workflow that analyzes and converts the video, storing the output files in locations for on-demand delivery.

Serverless watchfolder workflow

In this VOD automation sample, we have created a serverless video conversion watchfolder workflow solution using several AWS services including Amazon S3, AWS Lambda, Amazon CloudWatch Events, Amazon Simple Notification Service, and AWS Elemental MediaConvert.

Each video uploaded to the S3 bucket input folder creates the following outputs:

  • An Apple HLS adaptive bitrate stream, for playout on multiple devices with different network bandwidth connections
  • An MP4 file as a self-contained file
  • Thumbnail images created at regular intervals

The repository on GitHub (links below) contains sample code for the Lambda function depicted in the diagram below as well as an AWS CloudFormation template for creating the function and related resources. There is a companion tutorial in README-tutorial.md for creating this workflow using the AWS console. The tutorial goes into detail on how the workflow is built and configured.

 

Project repository on GitHub for the workflow

Tutorial: https://github.com/aws-samples/aws-media-services-vod-automation/blob/master/MediaConvert-WorkflowWatchFolderAndNotification/README-tutorial.md

CloudFormation: https://github.com/aws-samples/aws-media-services-vod-automation/blob/master/MediaConvert-WorkflowWatchFolderAndNotification/README.md

Walkthrough of the workflow

  1. A user uploads a video to the watchfolder bucket /inputs folder in S3. Only files added to the inputs folder will trigger the workflow.
  2. The s3:PutItem event triggers a Lambda function that calls MediaConvert to convert the video.
  3. Converted videos are stored in the configured S3 output folder by MediaConvert.
  4. When the conversion job finishes, MediaConvert emits aws:mediaconvert Job State Change Event type CloudWatch events with the job status.
  5. The COMPLETE and ERROR status events trigger SNS to send notifications to subscribers.

Adapt this workflow to use different encoding settings

It’s easy to create outputs with other formats supported by MediaConvert. MediaConvert job settings can be placed in JSON files in the watchfolder S3 bucket /jobs folder. The workflow will run a job for each settings file. If no settings are specified in /jobs, then the Default job included in this project runs.

More resources

To learn more about the broadcast grade encoding features of AWS Elemental MediaConvert, check out the features page.

The Video on Demand on AWS Solution is also available for you to try. It ingests source videos, processes the videos for playback on a wide range of devices, and stores the transcoded media files for on-demand delivery to end users using Amazon CloudFront. This solution is a great place to start for building production VOD processing workflows.

And be sure to check out the next blog post in this VOD Automation series… coming soon.