Create an Automatic video transcoding using AWS Elastic MediaConverter for a Video Streaming App

Objectives

The objective was to set up an automatic workflow to transcode a media object to different types of formats and resolution using AWS MediaConverter and Transcoding Job. 

The client provides various kinds of financial services to their customers all over the world. They had recently planned to build a mobile app which helps the end signed user to learn more about financial courses. Initially the client had built their application in AWS Cloudfront with encrypted signed urls. However, the Cloudfront charges had become very high due to the large number of video downloads and streaming.  The client had approached us to find  a solution to reduce AWS cost to optimum level. So we planned to create an architecture of an online video streaming without using Cloudfront. Instead of Cloudfront, we used AWS Media Converter and KMS encryption to achieve the automatic video conversion and passed to the application level. The client’s development team had worked on integrating the encrypted & converted urls from AWS Mediaconverter to their mobile app.

In a nutshell, the following were the main requirements from the client side.

Client Requirements:

  1. Create an automated transcoding job to convert input media files in a S3 bucket to transcoded media files as output and keep the thumbnail images.
  2. The conversion task is triggered when the user uploads a media file to the input S3 bucket. Notification service and triggering is handled by SNS & Cloudwatch.
  3. Arrange the transcoded outputs files to respective names of folders in the output S3 bucket.
  4. Setup KMS for video encryption and decryption.

The Workflow of the Environment setup

Work flow-Automatic video transcoding using AWS Elastic MediaConverter
  1. A user uploads a MP4 video object to the input directory of the S3 bucket. Whenever an object is added to the inputs folder, workflow will be triggered.
  2. The s3:PutItem event triggers a Lambda function that calls MediaConvert to convert the video to different resolutions.
  3. Converted videos are stored in the configured S3 output folder by MediaConvert.
  4. When the conversion job finishes, MediaConvert sends a report to CloudWatch events with the job status.
  5. The complete and error status events trigger SNS to send notifications to the administrator.

Tools Used

  1. Json script
  2. Python Script
  3. AWS Lambda
  4. AWS MediaConverter
  5. AWS KMS
  6. AWS Cloudwatch
  7. AWS SNS
  8. AWS IAM
  9. AWS S3 Buckets

Results

We deployed the stack script and modified the JSON & Python scripts to achieve the desired output in AWS.

  1. Uploaded a MP4 video file to the input folder of the S3 bucket by using the upload option in the bucket.
  2. Once the upload was completed, the mediaconverter service was opened and the jobs option selected. The mediaconverter started to convert the media file and completed status was shown when the job was done.
AWS Elastic MediaConverter interface
  1. The converted media files are stored in the output folder of the S3 bucket.
  2. The programmer used KMS for decrypting the video files from their application and also enabled a sign-in option to watch and download the videos.
GET STARTED WITH OUR CLOUD SERVICES

Sunny Antony

Exec member, Cloud Architect & Technical Consultant

Leave a Reply