我正在创建一个视频文件,并在上面创建图像动画。我跟踪导出进度和状态,但导出进度达到1.0后,不会调用完成回调,并且导出状态仍等于“AVAssetExportSessionStatusExporting”。AVAssetExportSession:导出完成后未调用完成回调
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:movieAsset presetName:AVAssetExportPresetMediumQuality];
self.session = exportSession;
[exportSession release];
session.videoComposition = self.videoComposition;
NSString *filePath = NSTemporaryDirectory();
NSString *fileName = [[@"Output_" stringByAppendingString:number] stringByAppendingString:@".mov"];
filePath = [filePath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
[[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
}
session.fileLengthLimit = 1024 * 1024 * 10;
session.outputURL = [NSURL fileURLWithPath:filePath];
session.outputFileType = AVFileTypeQuickTimeMovie;
[session exportAsynchronouslyWithCompletionHandler:^{
dispatch_async(dispatch_get_main_queue(), ^{
[self exportDidFinish];
});
}];
它实际上是创建一个输出文件,它是不可读的。我想看到的是一些错误消息,但导出会话的error
属性保持空白。
所以,你收到一些回调与AVAssetExportSessionStatusExporting?你检查所有的出口状态吗? – birukaze
我有一个重复计时器,它将会话的'progress','status'和'error'属性记录到控制台。但是上述代码中的函数'exportDidFinish'永远不会被调用。 '进度'达到1.0后'status'等于'AVAssetExportSessionStatusExporting' – pckill