【问题标题】:OSStatus error -12769?OSStatus 错误 -12769?
【发布时间】:2014-07-04 14:48:54
【问题描述】:

所以我一直在尝试使用AVAssetExportSession 来修剪方形视频。但由于某种原因,我不断收到此错误:

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 呢?我在互联网上到处搜索,但没有看到任何与此错误代码相关的问题/问题。请帮忙。谢谢!

我的代码在这里:

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;
            }
        }];
    }
}

附:此代码适用于使用本机相机应用拍摄的视频(即非方形/未处理的视频)。

【问题讨论】:

    标签: ios objective-c avassetexportsession avasset


    【解决方案1】:

    我想我找到了解决方案,但我不知道为什么或如何工作。

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

    【讨论】:

    • 我需要保持视频的原始分辨率。有什么想法可以解决它吗?
    猜你喜欢
    • 1970-01-01
    • 2011-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-01
    • 1970-01-01
    • 2014-07-14
    • 1970-01-01
    相关资源
    最近更新 更多