开发者

AVAssetExportSession SLOW

开发者 https://www.devze.com 2023-03-14 08:42 出处:网络
I am using AVAssetExportSession to export audio files. It is working, though in a speed that is practical for use. I am setting up my exporter, getting my AVAsset, and starting the export. Here is the

I am using AVAssetExportSession to export audio files. It is working, though in a speed that is practical for use. I am setting up my exporter, getting my AVAsset, and starting the export. Here is the code. Any suggestions or insight will help.

[exporter exportAsynchronouslyWithCompletionHandler:^{
    NSLog(@"we are now exporting");
    int exportStatus = exporter.status;
    switch (exportStatus) {
        case AVAssetExportSessionStatusFailed: {
            // log error to text view
            NSError *exportError = exporter.error;
            NSLog (@"AVAssetExportSessionStatusFailed: %@", exportError);
            break;
        }
        case AVAssetExportSessionStatusCompleted: {
            NSLog (@"AVAssetExportSessionStatusCompleted");
            // set up AVPlayer

            NSData *data = [NSData dataWithContentsOfURL:exportURL];
            break;
        }
        case AVAssetExportSessionStatusUnknown: { NSLog (@"AVAssetExportSessionStatusUnknown"); break;}
        case AVAssetExportSessionStatusExporting: { NSLog (@"AVAssetExportSessionStatusExporting"); break;}
        case AVAssetExportSessionStatusCancelled: { NSLog (@"AVAssetExportSessionStatusCancelled"); break;}
        case AVAssetExportSessionStatusWaiting: { NSLog (@"AVAssetExportSessionStatusWaiting"); break;}
        default: { NSLog (@"didn't get export status"); break;}
    }
    [exporter relea开发者_如何学运维se];
    [exportURL release];
}];


You're probably causing some kind of conversion - that will be slow (not that much faster than realtime). Make sure you're using the passthrough preset, AVAssetExportPresetPassthrough.

0

精彩评论

暂无评论...
验证码 换一张
取 消