amplify-video icon indicating copy to clipboard operation
amplify-video copied to clipboard

Thumbnail generation for VOD assets

Open wizage opened this issue 5 years ago • 7 comments

Is your feature request related to a problem? Please describe. Add a VOD MediaConvert template to VOD solution. This involves creating a custom template.

Describe the solution you'd like Provide a custom template in ./provider-utils/awscloudformation/mc-templates/

Relates to #4

wizage avatar Oct 07 '19 17:10 wizage

Relates to #18

wizage avatar Nov 22 '19 16:11 wizage

Where to put thumbnails when you put them? Source bucket, output bucket, a new bucket for thumbnails.

Should this template have special build steps to populate the output bucket variable?

wizage avatar Jul 06 '20 21:07 wizage

How'd you end up going with this, @wizage? I've noticed a few issues referencing the ability to add thumbnails as an output but haven't yet come across a definite guide/example on what a custom template could look like and/or what steps to take.

Would be great for this functionality to be configurable within amplify video. If that's too chunky a task then a guide in the Wiki would be great as well.

I did find this blog post from 2018, and was hoping to reverse engineer a custom template JSON by creating a template via the console. However it's a little too outdated to be useful.

vitalbone avatar Dec 14 '20 04:12 vitalbone

How did I miss this page on the Wiki?!

vitalbone avatar Dec 14 '20 21:12 vitalbone

Where to put thumbnails when you put them? Source bucket, output bucket, a new bucket for thumbnails.

Should this template have special build steps to populate the output bucket variable?

Hi @wizage ,

I've added some basic poster image generations settings to my template but I'm now realising that the output bucket name being hard coded in the template is an issue. Is there a way that we can inject the output bucket name into this template?

      {
        "CustomName": "Poster Images",
        "Name": "File Group",
        "Outputs": [
          {
            "ContainerSettings": {
              "Container": "RAW"
            },
            "VideoDescription": {
              "CodecSettings": {
                "Codec": "FRAME_CAPTURE",
                "FrameCaptureSettings": {
                  "FramerateNumerator": 30,
                  "FramerateDenominator": 88,
                  "MaxCaptures": 3,
                  "Quality": 80
                }
              }
            },
            "Extension": ".jpg",
            "NameModifier": "poster-image"
          }
        ],
        "OutputGroupSettings": {
          "Type": "FILE_GROUP_SETTINGS",
          "FileGroupSettings": {
            "Destination": "s3://xxxxxxxxxxxxx-develop-output-xxxxxxx/posters/"
          }
        }
      }

kylekirkby avatar Aug 26 '21 11:08 kylekirkby

Hi kylekirby - You can omit the "FileGroupSettings" in the template JSON and add it dynamically using the lambda /provider-utils/awscloudformation/cloudformation-templates/vod-helpers/LambdaFunctions/InputLambda/index.js using code similar to the blurb below.

if (outputTypeList.length === 1) {
    if (outputTypeList[0] === 'HLS') {
      hlsJobSettings.OutputGroups[0].OutputGroupSettings.HlsGroupSettings.Destination = `s3://${outputBucketName}/${FileName}/`;
      hlsJobSettings.Inputs[0].FileInput = `s3://${Bucket}/${decodeURIComponent(AddedKey.replace(/\+/g, ' '))}`;
      jobSettings = hlsJobSettings;
    } else if (outputTypeList[0] === 'DASH') {
      dashJobSettings.OutputGroups[0].OutputGroupSettings.DashIsoGroupSettings.Destination = `s3://${outputBucketName}/${FileName}/`;
      dashJobSettings.Inputs[0].FileInput = `s3://${Bucket}/${decodeURIComponent(AddedKey.replace(/\+/g, ' '))}`;
      jobSettings = dashJobSettings;
    }
  } 

Let me know if that helps !

shamikatamazon avatar Aug 26 '21 17:08 shamikatamazon

@shamikatamazon arh! Perfect I'll try this out and report back. Looks ideal :)

kylekirkby avatar Aug 26 '21 18:08 kylekirkby