小编Kar*_*llo的帖子

exportAsynchronouslyWithCompletionHandler失败并显示多个视频文件(代码= -11820)

我正在录制小型视频剪辑(大约一秒左右,前后摄像头,可能有不同的方向).然后尝试使用AVAssetExportSession合并它们.我基本上使用适当的变换和音频和视频轨道制作合成和视频组合.

问题是,如果你有超过4个视频剪辑,在iOS 5上会失败,而在iOS 6上,限制似乎是16个剪辑.

这对我来说似乎真的令人费解.AVAssetExportSession是在做一些奇怪的事情,还是对可以传递给它的剪辑数量有一些未记录的限制?以下是我的代码的一些摘录:

-(void)exportVideo
{
    AVMutableComposition *composition = video.composition;
    AVMutableVideoComposition *videoComposition = video.videoComposition;
    NSString * presetName = AVAssetExportPresetMediumQuality;

    AVAssetExportSession *_assetExport = [[AVAssetExportSession alloc] initWithAsset:composition presetName:presetName];
    self.exportSession = _assetExport;

    videoComposition.renderSize = CGSizeMake(640, 480);
    _assetExport.videoComposition = videoComposition;

    NSString *exportPath = [NSTemporaryDirectory() stringByAppendingPathComponent: @"export.mov"];
    NSURL *exportUrl = [NSURL fileURLWithPath:exportPath];

    // Delete the currently exported files if it exists
    if([[NSFileManager defaultManager] fileExistsAtPath:exportPath])
        [[NSFileManager defaultManager] removeItemAtPath:exportPath error:nil];

    _assetExport.outputFileType = AVFileTypeQuickTimeMovie;
    _assetExport.outputURL = exportUrl;
    _assetExport.shouldOptimizeForNetworkUse = YES;

    [_assetExport exportAsynchronouslyWithCompletionHandler:^{
        switch (_assetExport.status)
        {
            case AVAssetExportSessionStatusCompleted: …
Run Code Online (Sandbox Code Playgroud)

video objective-c ios

8
推荐指数
2
解决办法
3090
查看次数

标签 统计

ios ×1

objective-c ×1

video ×1