Iphone 从UIImagePickerController拾取视频后旋转视频以上载到服务器

Iphone 从UIImagePickerController拾取视频后旋转视频以上载到服务器,iphone,xcode,uiimagepickercontroller,Iphone,Xcode,Uiimagepickercontroller,因此,我看到了这些答案和许多其他答案: 我知道如何从UIImagePickerController获取视频的方向,但我如何实际旋转图像选择器返回的视频url,以便在上传时不会旋转90度 编辑: 我用这个方法来获得视频的方向。在获得视频方向后,我如何将其旋转到返回的方向 - (UIInterfaceOrientation)orientationForTrack:(AVAsset *)asset { AVAssetTrack *videoTrack = [[asset tracksWi

因此,我看到了这些答案和许多其他答案:

我知道如何从UIImagePickerController获取视频的方向,但我如何实际旋转图像选择器返回的视频url,以便在上传时不会旋转90度

编辑:

我用这个方法来获得视频的方向。在获得视频方向后,我如何将其旋转到返回的方向

- (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;
}

你找到答案了吗?
- (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;
}