2013-07-17 25 views
3

在我的应用我记录和保存使用AVCapture/AssetsLibrary.When我记录在纵向记录的视频的方向是确定的视频,但是当我在风景拍摄录制的视频的定位是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]; 
} 

感谢,

+0

你是如何配置的方向捕获会话? – Wain

+0

@请看我编辑的代码! – Machete

回答

0

设置CaptureVideoOrientation.i.e:

AVCaptureVideoOrientation orientation =AVCaptureVideoOrientationLandscapeRight 
0

旋转元数据由移动记录装置连同的.mp4或.mov视频保存。如果玩家你使用支持旋转元数据,你会看到

图片提供的 Rotation Metadata in Video Files Created by Mobile Devices

Rotation Metadata in Video Files Created by Mobile Devices

它可以有4个值:0,90,180和270纵向视频(90°)显示为纵向。如果不是这样,你会把它看作景观。不支持它(上面列表形式的链接)

玩家:

  • 火狐42
  • 歌剧院在Mac
  • 媒体播放器经典