sbooth / SFBAudioEngine

A powerhouse of audio functionality for macOS and iOS
https://sbooth.github.io/SFBAudioEngine/
MIT License
552 stars 87 forks source link

I keep getting an error when converting to apple native format, like m4a aac #218

Closed mytianer closed 2 years ago

mytianer commented 2 years ago

It's the same whether I use AudioConverter.convert(file.url, to: targetUrl) or AudioConverter.convert(file.url, using: customEncoder). I have set the relevant parameters of SFBCoreAudioEncoder

sbooth commented 2 years ago

Could you give more information on the input format, output format, and encoder settings?

mytianer commented 2 years ago

Could you give more information on the input format, output format, and encoder settings?

The input format is any audio.

I use these parameters when converting to m4a: kAudioFileM4AType, kAudioFormatMPEG4AAC, kAudioConverterSampleRateConverterComplexity_Normal, kAudioConverterQuality_Medium, kAudioConverterCodecQuality = 1, kAudioConverterEncodeBitRate = 192000

sbooth commented 2 years ago

I can confirm there is a paramErr when setting kExtAudioFileProperty_ClientDataFormat at https://github.com/sbooth/SFBAudioEngine/blob/91c754ceb3304a120ee68ce06aaf60f604ce6a04/Encoders/SFBCoreAudioEncoder.mm#L410

sbooth commented 2 years ago

The specific error is

ExtAudioFile.cpp:701   about to throw -50: create audio converter