2

So I've seen these answers and many others:

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

How do I rotate a video from UIImagePickerController before uploading to a webserver

I understand how to get the orientation of the video from the UIImagePickerController but How do I actually rotate the video url that the Image Picker returns so when I upload it its not rotated 90 degrees?

EDIT:

I'm using this method to get the orientation of the video. After I get the videos orientation how do I actually rotate it to that returned orientation?

- (UIInterfaceOrientation)orientationForTrack:(AVAsset *)asset
{
AVAssetTrack *videoTrack = [[asset      tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
CGSize size = [videoTrack naturalSize];
CGAffineTransform txf = [videoTrack preferredTransform];

if (size.width == txf.tx && size.height == txf.ty)
    return UIInterfaceOrientationLandscapeRight;
else if (txf.tx == 0 && txf.ty == 0)
    return UIInterfaceOrientationLandscapeLeft;
else if (txf.tx == 0 && txf.ty == size.width)
    return UIInterfaceOrientationPortraitUpsideDown;
else
    return UIInterfaceOrientationPortrait;
}
Community
  • 1
  • 1
Sean
  • 335
  • 4
  • 16

1 Answers1

0
- (UIImageOrientation)getImageOrientationWithVideoOrientation:(UIInterfaceOrientation)videoOrientation {
UIImageOrientation imageOrientation;
switch (videoOrientation) {
    case UIInterfaceOrientationLandscapeLeft:
        imageOrientation = UIImageOrientationUp;
        break;
    case UIInterfaceOrientationLandscapeRight:
        imageOrientation = UIImageOrientationDown;
        break;
    case UIInterfaceOrientationPortrait:
        imageOrientation = UIImageOrientationRight;
        break;
    case UIInterfaceOrientationPortraitUpsideDown:
        imageOrientation = UIImageOrientationLeft;
        break;
}
return imageOrientation;
}
evya
  • 3,381
  • 1
  • 25
  • 28