AWS media convert thumbnail genrated from video get rotated?

818 views Asked by At

In my application, I'm using AWS media-convert jobs to generate the thumbnail from my video uploaded to s3. The video gets uploaded from mobile. It works fine when I record a video from my mobile and uploads it at the same time. I got thumbnail generated properly.

But when I upload a pre-recorded video from the same mobile and upload it the thumbnail for that video get rotated by -90 degree.

Not sure what could be the problem here.

1

There are 1 answers

0
jjohn On BEST ANSWER

It sounds like there is rotation metadata embedded in the video file that is being recording with the mobile device. Devices, like the iPhone, do this automatically depending on the orientation of the phone while it's recording. This data will tell MediaConvert to change rotation of the input file. By default, MediaConvert will use no rotation, I would suggest flipping this to 'AUTO', and let the service correctly rotate video accordingly.

Apples Quicktime file format (1), and ISO 14496-12 (Section A.6) should have more details about this piece of metadata if you are interested.

JSON Settings with Rotate set to AUTO:

    "Inputs": [
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "Offset": 0,
            "DefaultSelection": "DEFAULT",
            "ProgramSelection": 1
          }
        },
        "VideoSelector": {
          "ColorSpace": "FOLLOW",
          "Rotate": "AUTO",
          "AlphaBehavior": "DISCARD"
        },
        "FilterEnable": "AUTO",
        "PsiControl": "USE_PSI",
        "FilterStrength": 0,
        "DeblockFilter": "DISABLED",
        "DenoiseFilter": "DISABLED",
        "TimecodeSource": "EMBEDDED",
        "FileInput": "s3://bucket123/test.mov"
      }
    ]

== Documentation ==
[1] https://docs.aws.amazon.com/mediaconvert/latest/ug/manually-specified-rotation.html
[2]https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobs-prop-videoselector-rotate
[3] https://developer.apple.com/standards/qtff-2001.pdf