录制的视频定位问题

时间:2013-07-17 07:49:15

标签: iphone ios ios6 orientation

在我的应用程序中,我使用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];
}

谢谢,

2 个答案:

答案 0 :(得分:0)

设置CaptureVideoOrientation.i.e:

AVCaptureVideoOrientation orientation =AVCaptureVideoOrientationLandscapeRight

答案 1 :(得分:0)

旋转元数据由移动录制设备与.mp4或.mov视频一起保存。

它可以有4个值:0,90,180和270:

Rotation Metadata in Video Files Created by Mobile Devices

图片由Rotation Metadata in Video Files Created by Mobile Devices

提供

如果您使用的播放器支持旋转元数据,您将看到纵向视频(90°)显示为纵向。如果没有,你会把它看作景观。

不支持它的玩家(上面的列表表单链接):

  • Firefox 42
  • Mac上的Opera
  • Media Player Classic