Search code examples
androidiosvideoorientationvideo-processing

How to handle video orientation from mobile devices


I have a server component that processes video uploads for a web/iOS/Android application.

However I am running into a problem handling the video orientation. Is there a good way to solve this? I have a tool MediaInfo that rips the meta data out of the device but this is what i am encountering

iOS

  • the portrait is correct 90 or 270
  • the landscape is crazy. if you hold the device with the button to the left, it reports 0 for the front camera and 180 for the back

Android

  • here the situation is reversed the landscape is correct both front and back camera
  • the portrait is 90 or 270 depending on if you are using the front or back camera
  • furthermore some devices like Motorola Droids and Evo4G dont record the meta data at all

has anyone seen a clean solution for this?


Solution

  • There is no clean solution for android devices that do not report the orientation.

    For all the other orientations, I had overly complicated it in my mind. The flip between front and back means the angles are correct if rotated clockwise