iphone - 录制的视频方向问题

标签 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;
}

捕获 session 方向

AVCaptureConnection *CaptureConnection = [MovieFileOutput connectionWithMediaType:AVMediaTypeVideo];
if ([CaptureConnection isVideoOrientationSupported])
{
    AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationPortrait;

    [CaptureConnection setVideoOrientation:orientation];
}

谢谢,

最佳答案

设置 CaptureVideoOrientation.i.e:

AVCaptureVideoOrientation orientation =AVCaptureVideoOrientationLandscapeRight

关于iphone - 录制的视频方向问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17694113/

相关文章:

iphone - 尝试从磁盘访问缓存请求时 NSURLCache 返回 nil

iphone - Objective-C 属性 setter 如何发出失败信号?

iphone - 为什么 NSUserDefaults 无法保存 NSMutableDictionary?

iphone - AVAssetExportSession 错误 -11820

iphone - 在 iOS 上的 Objective-C 中设置委托(delegate)

ios - 检查 iOS 7 或更早版本的最佳方法?

iphone - 适用于 iOS 的高质量文本转语音 SDK

ios - Swift Combine 属性继承在 Xcode 11.4 beta 2/iOS 13.4 上抛出 'Fatal error: Call of deleted method'

iphone - NSString stringWithFormat 很慢

iphone - iPad 中的 FBWebDialog 旋转问题