Skip to content

SDAVAssetExportSession takes long to save lengthy audio M4a files #101

@alirazamsp

Description

@alirazamsp

` 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")
            }
        })
    } )`

Above is the piece of code I am using to export audio file as M4a. It takes long time to save audios of 3 minutes or long. Exporting time increases as the audio duration increase. How can I reduce this time ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions