AVAssetExportSession 慢

发布于 2024-11-16 07:55:42 字数 1319 浏览 2 评论 0原文

我正在使用 AVAssetExportSession 导出音频文件。它正在工作,尽管速度是实用的。我正在设置我的导出器,获取我的 AVAsset,并开始导出。这是代码。任何建议或见解都会有帮助。

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

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];
}];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赏烟花じ飞满天 2024-11-23 07:55:42

您可能会引起某种转换 - 这会很慢(不会比实时快多少)。确保您使用的是直通预设 AVAssetExportPresetPassthrough。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文