Skip to content

AWS MediaConvert - Position Overlay Image Relatively to Video Dimensions

1

I am using Elastic Transcode but it must to migrate to Mediaconvert by November 2025.

Now, I'm struggling to use 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 just as possible to do it with Elastic Transcode.

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?

I can't imagine that one thing so simple in Elastic is turning so difficult in MediaConvert.

Any guidance would be much appreciated! Thanks. 🚀

  • Thanks for reporting the feature gap between MediaConvert and Elastic Transcoder that is causing issues with your migration. I have created an engineering ticket to address this. Please create a support ticket requesting this feature so that I can notify you when it is deployed.

1 Answer
0

I understand your frustration with transitioning from Elastic Transcoder to MediaConvert, especially when it comes to dynamically positioning overlays. Unfortunately, MediaConvert does not currently offer a direct way to position overlays using percentages or relative positioning as Elastic Transcoder did. However, there are some approaches you can consider to achieve your desired outcome:

  1. Input overlays: Instead of using output overlays, consider using input overlays. Input overlays scale with the video resolution, which means your logo will automatically adjust its size and position relative to the video dimensions. This approach works for both landscape and portrait orientations.

  2. Multiple output overlays: If you need to maintain precise control over the logo size, you could create multiple output presets with different overlay sizes and positions. Then, use a Lambda function to determine the input video's resolution and select the appropriate preset before submitting the MediaConvert job.

  3. Motion graphic overlays: These also scale with the video resolution, similar to input overlays. You could create a motion graphic that positions your logo in the bottom-right corner and scales appropriately.

  4. Custom sizing logic: If you know the range of possible input resolutions, you could create a set of predefined overlay sizes and positions. Then, use a Lambda function to select the best fit based on the input video's metadata, which MediaConvert can provide without downloading the entire video.

While these solutions may not be as straightforward as percentage-based positioning, they can help you achieve your goal of dynamically positioning the logo in the bottom-right corner for various video resolutions and orientations.

It's worth noting that the AWS team is continually improving MediaConvert, so it might be beneficial to submit a feature request for relative positioning of overlays. This could potentially lead to a more direct solution in the future.
Sources
Sizing your overlay for scaling - MediaConvert
Working with image insertion (overlays) - MediaConvert
Sizing Your Overlay to Account for Scaling - AWS Elemental Server

answered 2 years ago

  • Hi, About your first point I don't see how this solves the relative positioning problem since also input image inserter required absolute coordinates.

    Since both ImageX and ImageY still require absolute pixel values, the logo position won't adapt correctly when switching between landscape and portrait videos. Is there any way to specify relative positioning (like percentages) for the logo placement, similar to how Elastic Transcoder worked?"

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.