AWS Workflow for video-on-demand with automated API
AWS Elemental MediaConvert is a file-based video transcoding service that allows you to easily create video-on-demand (VOD) content for broadcast and multiscreen delivery at scale without having to worry about the complexity of building and operating your own video processing infrastructure. This terraform module is used to set an automated workflow in order to transcode videos with your configuration.
Terraform 0.12 and newer.
Name | Version |
---|---|
terraform | >= 0.12 |
aws | >= 2.11 |
AWS
$ aws mediaconvert describe-endpoints
{
"Endpoints": [
{
"Url": "https://abcd1234.mediaconvert.us-west-2.amazonaws.com"
}
]
}
Clone our repository where you plan to use this module.
Before using the module, change directory to mediaconvert_lambda.
$ cd mediaconvert_lambda && ls
job.json mediaconvert.py
job.json is a MediaConvert Job configuration example, you may want to modify job.json file in order to change MediaConvert Job settings. Some values are populated from Lambda function, ( "[Populated by Lambda function]" values ).
Apple HLS :
Resolution | Bitrate (bits/s) |
---|---|
1280x720 | 192000 |
1920x1080 | 192000 |
MP4 :
Resolution | Bitrate (bits/s) |
---|---|
1920x1080 | 192000 |
Once your MediaConvert Job configuration is done, zip mediaconvert_lambda's content :
mediaconvert_lambda$ zip -r ../mediaconvert_lambda.zip .
You're now ready to use this module.
module "workflow_vod" {
source = "./aws-workflow-video-on-demand"
region = "us-west-2"
input_bucket_name = "my_input_bucket_name"
output_bucket_name = "my_output_bucket_name"
lambda_zip_path = "./aws-workflow-video-on-demand/mediaconvert_lambda.zip"
project_base_name = "my_workflow_vod_name"
bucket_event_prefix = "input/"
bucket_event_suffix = ".mov"
mediaconvert_endpoint = "https://abcd1234.mediaconvert.us-west-2.amazonaws.com"
}
What does it do ?
# vars.tf
/*
// module configuration variables
// - By overriding default values provided by the module
*/
variable "region" {
description = "AWS region"
default = "us-west-2"
}
variable "input_bucket_name" {
description = "Input bucket name which contains videos to be transcoded."
default = "my_input_bucket_name"
type = string
}
variable "output_bucket_name" {
description = "Output bucket name which contains videos after transcoding."
default = "my_output_bucket_name"
type = string
}
variable "bucket_event_prefix" {
description = "Element prefix to trigger lambda function."
default = "input/"
}
variable "bucket_event_suffix" {
description = "Element suffix to trigger lambda function."
default = ".mov"
}
variable "project_base_name" {
description = "Project name."
default = "my_workflow_vod_name"
}
variable "lambda_zip_path" {
description = "Path to lambda function and configuration zip."
default = "./aws-workflow-video-on-demand/mediaconvert_lambda.zip"
}
variable "speke_server_url" {
description = "For future versions."
default = ""
}
variable "speke_system_id" {
description = "For future versions."
default = ""
}
variable "mediaconvert_endpoint" {
description = "AWS Element MediaConvert API endpoint."
default = "https://abcd1234.mediaconvert.us-west-2.amazonaws.com"
}
# in file using module
module "workflow_vod" {
source = "./aws-workflow-video-on-demand"
}