admin管理员组

文章数量:1418084

I am using AWS MediaConvert to transcode user-uploaded videos and overlay a logo in the bottom-right corner. However, I am struggling to position the image dynamically relative to the video's resolution.

What I Want to Achieve:

  • The logo should always be positioned in the bottom-right corner, regardless of the video's resolution or aspect ratio.
  • The logo should scale proportionally based on the video dimensions.
  • The solution must work for both horizontal (landscape) and vertical (portrait) videos.
  • I cannot pre-calculate the video resolution before sending the job.

What I Have Tried:

AWS MediaConvert does not allow percentage-based positioning (e.g., sourceWidth - overlayWidth - 10). It only accepts absolute pixel values for ImageX and ImageY.

Currently, my configuration works fine for standard 1280x720 videos:

"VideoPreprocessors": {
  "ImageInserter": {
    "InsertableImages": [
      {
        "ImageInserterInput": "s3://my-bucket/logo.png",
        "Width": 200,
        "Height": 100,
        "ImageX": 1080,
        "ImageY": 580,
        "Layer": 1,
        "Opacity": 50,
        "StartTime": 0
      }
    ]
  }
}

However, this approach fails when processing videos of different resolutions:

  • If the video is 1920x1080, the logo is too small and appears in the wrong place.
  • If the video is vertical (e.g., 720x1280), the logo gets cut off or misplaced.
  • AWS MediaConvert does not seem to provide any built-in way to dynamically position the overlay.

Questions:

  1. Is there any way to dynamically position the overlay image relative to the video's resolution, without knowing the resolution beforehand?
  2. Are there any hidden options or workarounds in AWS MediaConvert that allow for relative positioning?
  3. If not, how can I achieve this without having to download the video to check its resolution before processing?

Any guidance would be much appreciated! Thanks.

本文标签: amazon web servicesAWS MediaConvertPosition Overlay Image Relatively to Video DimensionsStack Overflow