所以我已经看到了这些答案和许多其他答案:
如何检测 (iPhone SDK) 视频文件是以纵向还是横向录制的。
如何在上传到网络服务器之前从 UIImagePickerController 旋转视频
我了解如何从 UIImagePickerController 获取视频的方向,但是如何实际旋转 Image Picker 返回的视频 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;
}