SDAVAssetExportSession 需要很长时间才能保存冗长的音频 M4a 文件

问题描述

我正在尝试使用以下带有函数 AVAssetExportSession.ExpoerAsyncronously() 的代码导出音频,但这需要很多时间。我听说过 SDAVAssetExportSession 但这也有同样的问题。保存 3 分钟或更长时间的音频需要很长时间。导出时间随着音频持续时间的增加增加。我怎样才能减少这个时间?

let session: SDAVAssetExportSession = SDAVAssetExportSession(asset: composition)
    session.audioSettings = [AVFormatIDKey:kAudioFormatMPEG4AAC,AVNumberOfChannelsKey:2,AVSampleRateKey:44100,AVEncoderBitRateKey:128000]
    
    prevIoUslySavedDuration = startAudioTime
    session.outputURL = url
    session.outputFileType = AVFileType.m4a.rawValue


    session.exportAsynchronously(completionHandler:{
        dispatchQueue.main.async(execute: {
            switch session.status{
            case  .Failed:
                print("Failed \(String(describing: session.error))")
                completion(false)
            case .cancelled:
                print("cancelled \(String(describing: session.error))")
                completion(false)
            case .completed:
                completion(true)
            default:
                print("complete")
            }
        })
    } )

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)