AWS Elemental MediaConvert transcoding failed with Error initializing encoder for video target [2] [Height must be a multiple of 2]

37 views Asked by At

Below is parameter passed to process the transcoding and thumbnail generation for the video in MediaConvert. Below parameter process transcoding fine but getting Error initializing encoder for video target [2] [Height must be a multiple of 2] for few customers


{
  "Queue": "arn:aws:mediaconvert:us-east-1:123456789:queues/Default",
  "UserMetadata": {},
  "Role": "arn:aws:iam::757098027126:role/service-role/MediaConvert_Default_Role",
  "Settings": {
    "TimecodeConfig": {
      "Source": "ZEROBASED"
    },
    "OutputGroups": [
      {
        "Name": "File Group",
        "Outputs": [
          {
            "Preset": "720pvideo",
            "AudioDescriptions": [
              {
                "AudioSourceName": "Audio Selector 1"
              }
            ],
            "Extension": "mp4"
          }
        ],
        "OutputGroupSettings": {
          "Type": "FILE_GROUP_SETTINGS",
          "FileGroupSettings": {
            "Destination": "s3://production-output/transcoded/mp4-dz9kwrhfq6qselei23t0swzbs35s"
          }
        }
      },
      {
        "Name": "File Group",
        "Outputs": [
          {
            "Preset": "thumbnail",
            "Extension": "jpg"
          }
        ],
        "OutputGroupSettings": {
          "Type": "FILE_GROUP_SETTINGS",
          "FileGroupSettings": {
            "Destination": "s3://production-output//transcoded/thumbnail/"
          }
        }
      }
    ],
    "FollowSource": 1,
    "Inputs": [
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "DefaultSelection": "DEFAULT"
          }
        },
        "VideoSelector": {},
        "TimecodeSource": "ZEROBASED",
        "FileInput": "s3://production-input/dz9kwrhfq6qselei23t0swzbs35s"
      }
    ]
  },
  "BillingTagsSource": "QUEUE",
  "AccelerationSettings": {
    "Mode": "DISABLED"
  },
  "StatusUpdateInterval": "SECONDS_60",
  "Priority": 0
}

Custom preset for 720p video

{
  "Description": "Create 1280*720 video with bitrate as 5000000 bits/s",
  "Name": "720pvideo",
  "Settings": {
    "VideoDescription": {
      "Width": 1280,
      "ScalingBehavior": "DEFAULT",
      "Height": 720,
      "CodecSettings": {
        "Codec": "H_264",
        "H264Settings": {
          "MaxBitrate": 5000000,
          "RateControlMode": "QVBR",
          "QvbrSettings": {
            "QvbrQualityLevel": 7,
            "QvbrQualityLevelFineTune": 0.33
          },
          "SceneChangeDetect": "TRANSITION_DETECTION"
        }
      }
    },
    "AudioDescriptions": [
      {
        "CodecSettings": {
          "Codec": "AAC",
          "AacSettings": {
            "Bitrate": 192000,
            "CodingMode": "CODING_MODE_2_0",
            "SampleRate": 48000
          }
        }
      }
    ],
    "ContainerSettings": {
      "Container": "MP4",
      "Mp4Settings": {}
    }
  }
}

Custom preset for thumbnail generation

{
  "Name": "thumbnail",
  "Settings": {
    "VideoDescription": {
      "ScalingBehavior": "FIT_NO_UPSCALE",
      "Sharpness": 50,
      "CodecSettings": {
        "Codec": "FRAME_CAPTURE",
        "FrameCaptureSettings": {
          "FramerateNumerator": 1,
          "FramerateDenominator": 3,
          "MaxCaptures": 2,
          "Quality": 80
        }
      }
    },
    "ContainerSettings": {
      "Container": "RAW"
    }
  }
}

I didn't got any solution for this issue. Does anybody knows the solution for this problem ?

2

There are 2 answers

0
BASTIN A On BEST ANSWER

By setting width and height for thumbnail custom preset resolved the issue. Seems few customer video height are not multiple of 2

  "Name": "thumbnail",
  "Settings": {
    "VideoDescription": {
      "Width": 1920,
      "ScalingBehavior": "FIT_NO_UPSCALE",
      "Height": 1080,
      "Sharpness": 50,
      "CodecSettings": {
        "Codec": "FRAME_CAPTURE",
        "FrameCaptureSettings": {
          "FramerateNumerator": 1,
          "FramerateDenominator": 3,
          "MaxCaptures": 2,
          "Quality": 80
        }
      }
    },
    "ContainerSettings": {
      "Container": "RAW"
    }
  }
}
0
aws-robclem On

That warning is coming after the probe on the input file. Its vertical size is likely an odd number. Your thumbnail custom preset is the easiest workaround.

FYI there is an easy way to probe files in advance of converting them by means of a AWS Lambda function to evaluate aspects of the source file. The same lambda Fn could then use this information to either quarantine the file or customize an appropriate MediaConvert template and trigger a new transcode job.

The blog article here has more information : https://aws.amazon.com/blogs/media/processing-user-generated-content-using-aws-lambda-and-ffmpeg/