nicholjs
nicholjs

Reputation: 1762

AVAssetExportSession SLOW

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 release];
    [exportURL release];
}];

Upvotes: 4

Views: 3836

Answers (1)

Gordon Childs
Gordon Childs

Reputation: 36074

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.

Upvotes: 4

Related Questions