在我的应用程序中,我使用AVCapture/AssetsLibrary.录制和保存视频。当我在纵向录制时,录制的视频的方向是可以的,但当我在横向录制时,录制的视频的方向是90度,这是不好的。我需要这个问题的帮助。我的代码是..
在我的appDelegate.m中
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
NSUInteger orientations = UIInterfaceOrientationMaskAllButUpsideDown;
if(self.window.rootViewController){
UIViewController *presentedViewController = [[(UINavigationController *)self.window.rootViewController viewControllers] lastObject];
orientations = [presentedViewController supportedInterfaceOrientations];
}
return orientations;
}和myViewController.m中
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}捕获会话方向
AVCaptureConnection *CaptureConnection = [MovieFileOutput connectionWithMediaType:AVMediaTypeVideo];
if ([CaptureConnection isVideoOrientationSupported])
{
AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationPortrait;
[CaptureConnection setVideoOrientation:orientation];
}谢谢,
发布于 2014-04-22 15:07:04
设置CaptureVideoOrientation.i.e:
AVCaptureVideoOrientation orientation =AVCaptureVideoOrientationLandscapeRight发布于 2015-11-17 19:13:06
移动记录设备将旋转元数据与.mp4或.mov视频一起保存。
它可以有4个值: 0、90、180和270:

图片由Rotation Metadata in Video Files Created by Mobile Devices提供
如果您使用的播放器支持旋转元数据,您将看到纵向视频(90°)显示为纵向。如果不是这样,你就会把它看作风景。
不支持它的播放器(上面的列表形式链接):
https://stackoverflow.com/questions/17694113
复制相似问题