AWS for M&E Blog
Automating VOD sources for AWS Elemental MediaTailor
AWS Elemental MediaTailor Channel Assembly makes it fast, easy, and cost-effective to build schedule-based streaming channels. For customers who have existing libraries of video content, it is more efficient to bulk add that content into MediaTailor so it can be incorporated into your channel’s schedule. In this post, I discuss how to use AWS Step Functions Workflow Studio to automate the bulk addition of existing video assets into MediaTailor Channel Assembly.
This approach can be adapted to orchestrate a diverse range of media workflows, using an event-driven architecture with Amazon EventBridge and AWS Step Functions. These services enable media customers to rapidly build solutions with reliability at scale, not just with Amazon Web Services (AWS) but also to integrate software with other SaaS partner event sources.
An example template is available at AWS-samples that simplifies adding existing VOD sources from a CSV file with metadata. If you just need to bulk add VOD sources quickly, the steps to deploy example code in your AWS account and start testing quickly are contained in README.md with an accompanying AWS Serverless Application Model (AWS SAM) template. Before adding a VOD source, make sure that it meets these requirements:
- Source variants must all have the same length, as determined by the source manifest.
- Within a package configuration, each source must have consistent variant streams.
- Audio and video playlists must all use the same target duration.
- Target durations for I-frame and subtitle playlists must be identical to other media.
For more background on the services used for this simple use case, the solution follows Serverless general design principles and introduces the Step Functions Workflow Studio. High-level benefits of this approach include:
- Extensibility – easily iterate to customize and add logic
- Maintainability – reduce complexity with minimal function and integration code
- Observability – clear visuals for state and error handling
Architecture
Once sample infrastructure as code is deployed via a SAM template, uploading a csv file with metadata to an Amazon Simple Storage Service (Amazon S3) storage bucket triggers event notifications with Amazon EventBridge. This event passes the file location to initiate the state machine in Step Functions, starting with an AWS Lambda function that translates data and can be adapted to validate data.
Workflow Studio
Each VOD source is iterated using the Map function in the Workflow Studio designer, which provides a powerful visual tool to try workflow changes fast. It is easy to filter out which JSON data is required at each step using input and output filters and set maximum concurrency limits. On completion of the import, notification occurs via AWS Simple Notification Service (AWS SNS) topic that has an email subscription by default, but could be customized to any SNS endpoint protocol.
Customizing your workflow, such as channel creation steps, is easy using the Workflow Studio designer. API calls for MediaTailor are available to drag into your Step Function, including the parameters needed for each service. Integration code is minimal to take the JSON input and customize your channel, as well as implementing custom error handling, such as retry and timeouts.
For this reference example, uploading a CSV file triggers an execution of the state machine, allowing inspection of the data passed through each step and any errors. Having clear visibility of the state of each step helps when troubleshooting any operational issues.
For more detailed analysis, logs are available in Amazon CloudWatch and AWS X-Ray is enabled, tracing the latency of each API call.
Defining media workflows visually using the Workflow Studio is a quick way to integrate over 200 AWS services. You can learn more at Learn to use the AWS Step Functions Workflow Studio.
Some other use cases could include integrating with the AWS Video on Demand solution so that media files are transcoded in AWS Elemental MediaConvert and automatically added as MediaTailor VOD Sources. Other operational workflows such as Channel creation and Channel Schedules could be automated using these services. When building your media workflows, consider these tools a simplified way to integrate AWS services with minimal code; to rapidly iterate whilst enabling smooth operations.