skip to Main Content

I have a S3 bucket with a lot of .mp4 videos inside different folders, I wish to convert them to HLS using AWS media Convert.

I’ve created a lambda function which gives me list of all the .mp4 videos in that bucket, but that info is not enough for AWS media convert to run and media convert JOB.

What will be the best approach to handle such case? Converting all existing mp4 files in a s3 bucket using media convert.

2

Answers


  1. Yes you can use AWS Elemental MediaConvert to convert media files. You did not mention what Lambda run-time you are using to write the Lambda function. I will assume JavaScript to answer this question.

    To use AWS SDK for JavaScript to write a Lambda function that invokes AWS Elemental MediaConvert , use the following code examples as a reference.

    Notice that you require a lot of parameters to successfully convert a file using this service.

    https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javascriptv3/example_code/mediaconvert

    Also — be sure to read the service docs too.

    https://docs.aws.amazon.com/mediaconvert/latest/ug/what-is.html

    Login or Signup to reply.
  2. You can use the metadata Tags on an existing file to indicate whether it should be re-transcoded. Basically set a ‘needs transcoding’ flag on all existing files in a batch operation, then transcode the files using a Lambda to call MediaConvert; then update the asset flags upon success message in the MediaConvert logs.

    Note: MediaConvert outputs will overwrite existing S3 files of the same name. If you want to preserve filenames then you’ll need to copy the old source file to a tmp dir before re-transcoding into the master directory.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search