Search code examples
objective-ciosxcodeios4ios5

video orientation UIImagePickerController


I am choosing videos using UIImagePickerController, then uploading the video to a web server using ASIHTTPRequest. However, videos that were shot with the iPhone held upside-down in landscape or portrait are inverted on the web server. When those uploaded videos are viewed on an iPhone, they are also scaled thy 75% or so vertically so that they appear squished.

Is there a way to determine the video orientation (including whether it was shot upside-down) of a video chosen using UIImagePickerController?

Also, is there a way to change the orientation of the video before uploading?

I'd also like to not allow uploads of video shot in portrait orientation.

Thanks


Solution

  • Found the answer in anther post. AVAsset gives you two properties, [avAsset naturalSize] and [avAsset preferredTransform], that allow you to determine the video orientation.

    Here's the related post:

    How to detect (iPhone SDK) if a video file was recorded in portrait orientation, or landscape.