【发布时间】:2013-07-02 18:00:17
【问题描述】:
我正在创建一个带有动画图像的视频文件。我跟踪导出进度和状态,但是在导出进度达到 1.0 完成回调后没有调用,并且导出状态仍然等于 'AVAssetExportSessionStatusExporting'。
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 的回调吗?你检查所有的出口状态吗?
-
我有一个重复计时器,它将会话的
progress、status和error属性记录到控制台。但是上面代码中的函数exportDidFinish永远不会被调用。progress达到 1.0 后,status等于AVAssetExportSessionStatusExporting
标签: ios avfoundation