首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OSStatus错误-12769?

OSStatus错误-12769?
EN

Stack Overflow用户
提问于 2014-07-04 14:48:54
回答 1查看 2.4K关注 0票数 1

所以我一直试图用AVAssetExportSession来修剪一个正方形的视频。但出于某种原因,我总是犯这样的错误:

代码语言:javascript
复制
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x1a03be70 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x1a04c5e0 "The operation couldn’t be completed. (OSStatus error -12769.)", NSLocalizedFailureReason=An unknown error occurred (-12769)}

从苹果的网站上,我发现-11800是一个未知的错误,但是OSStatus error -12769呢?我在互联网上到处搜索,没有发现任何与这个错误代码有关的问题。请帮帮忙。谢谢!

我的密码是:

代码语言:javascript
复制
AVAsset *asset = [[AVURLAsset alloc]initWithURL:self.originalVidUrl options:nil];
AVAssetTrack *clipVideoTrack = [[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
if (clipVideoTrack.naturalSize.width==clipVideoTrack.naturalSize.height) {
    NSLog(@"Square video");
    NSArray *presets = [AVAssetExportSession exportPresetsCompatibleWithAsset:asset];
    if ([presets containsObject:AVAssetExportPresetHighestQuality]) {
        self.exportSession = [[AVAssetExportSession alloc]initWithAsset:asset presetName:AVAssetExportPresetHighestQuality];
        self.exportSession.outputURL = [NSURL fileURLWithPath: self.tmpVidPath];
        self.exportSession.outputFileType = AVFileTypeMPEG4;
        CMTime start = ...
        CMTime duration = ...
        CMTimeRange range = CMTimeRangeMake(start, duration);
        self.exportSession.timeRange = range;
        [self.exportSession exportAsynchronouslyWithCompletionHandler:^{
            switch ([self.exportSession status]) {
                case AVAssetExportSessionStatusFailed:
                    NSLog(@"%@",self.exportSession.error);
                    break;
                case AVAssetExportSessionStatusCancelled:
                    NSLog(@"Export canceled");
                    break;
                default:
                    NSLog(@"Export Success, File Saved.");
                    break;
            }
        }];
    }
}

本代码适用于与本机相机应用程序拍摄的视频(即非正方形/非处理视频)。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-07-11 04:50:35

我想我找到了解决办法,但我不知道为什么,也不知道它是如何工作的。

只需将预设的名称从AVAssetExportPresetHighestQuality更改为AVAssetExportPreset1280x720,就可以了!

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24576808

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档