Automate video transcoding ( .m3u8 , .ts , .mp4) and generate thumbnails with AWS Elemental Mediaconvert.
This example takes an input .mp4 file and converts it into HLS format and compressed MP4 while also generating Thumbnails (specified in OutputGroups in transcode.json)
- HLS - HTTP Live Streaming is an HTTP-based adaptive bitrate streaming communications protocol
- MediaConvert generates the
.m3u8file and the.tsfiles (10s segments)
- MediaConvert generates the
To do -
- DASH - Dynamic Adaptive Streaming over HTTP
-
Create an IAM role for Mediaconvert -
AmazonS3FullAccessAmazonAPIGatewayInvokeFullAccess- Copy Role
arnand put it intranscode.json(line 6)
-
Create a Queue on MediaConvert or use
Defaultqueue (transcode.jsonline 2) (- Replace
121212121212with your Account ID
- Replace
-
Set up 2 S3 buckets - one for the input file and one to store the output
- Ensure the input bucket contains some video files to convert
-
Configure
awscliwith IAM Access key (or else modifyconvert.pyto create a session) -
Run
python3 convert.pyafter installingrequirements.txtand configuring the jobs.
- On-Demand vs Live Streaming article with Cloudfront
- AWS MediaConvert - You can export a json file from the dashboard
- MediaConvert for python