无法访问编解码器。 (-66672)

发布于 2024-10-11 13:02:00 字数 1362 浏览 3 评论 0原文

我正在尝试使用 AudioUnit 将 caf 文件转换为 m4a 文件。我已经实现了要转换的代码。当我尝试运行该应用程序时,收到以下错误消息;

couldn't set destination client format (-66672)

我从以下链接获取了示例代码;
http://developer.apple.com/library/ios/ #samplecode/iPhoneExtAudioFileConvertTest/Introduction/Intro.html

代码:

size = sizeof(clientFormat);
XThrowIfError(ExtAudioFileSetProperty(sourceFile, kExtAudioFileProperty_ClientDataFormat, size, &clientFormat), "couldn't set source client format");
//UInt32 encoderSpecifier = kAudioFormatMPEG4AAC;
//XThrowIfError(AudioFormatGetPropertyInfo(kAudioFormatProperty_Encoders, sizeof(encoderSpecifier), &encoderSpecifier, &size), "AudioFormatGetPropertyInfo: couldn't get property info");
size = sizeof(clientFormat);
XThrowIfError(ExtAudioFileSetProperty(destinationFile, kExtAudioFileProperty_ClientDataFormat, size, &clientFormat), "couldn't set destination client format");
AudioConverterRef audioConverter;
size = sizeof(audioConverter);
XThrowIfError(ExtAudioFileGetProperty(destinationFile, kExtAudioFileProperty_AudioConverter, &size, &audioConverter), "Couldn't get Audio Converter!");

我没有得到解决方案。我尝试过将属性设置为输出文件。但我遇到了同样的问题。

请帮我解决它。

I am trying to convert caf file to m4a file using AudioUnit. I have implemented the code to convert. When I tried to run the application, I am getting following error message;

couldn't set destination client format (-66672)

I got the sample code from following link;
http://developer.apple.com/library/ios/#samplecode/iPhoneExtAudioFileConvertTest/Introduction/Intro.html

CODE:

size = sizeof(clientFormat);
XThrowIfError(ExtAudioFileSetProperty(sourceFile, kExtAudioFileProperty_ClientDataFormat, size, &clientFormat), "couldn't set source client format");
//UInt32 encoderSpecifier = kAudioFormatMPEG4AAC;
//XThrowIfError(AudioFormatGetPropertyInfo(kAudioFormatProperty_Encoders, sizeof(encoderSpecifier), &encoderSpecifier, &size), "AudioFormatGetPropertyInfo: couldn't get property info");
size = sizeof(clientFormat);
XThrowIfError(ExtAudioFileSetProperty(destinationFile, kExtAudioFileProperty_ClientDataFormat, size, &clientFormat), "couldn't set destination client format");
AudioConverterRef audioConverter;
size = sizeof(audioConverter);
XThrowIfError(ExtAudioFileGetProperty(destinationFile, kExtAudioFileProperty_AudioConverter, &size, &audioConverter), "Couldn't get Audio Converter!");

I am not getting the solution for it. I have tried like setting the properties to the output file. But I am getting the same issue.

Please help me to resolve it.

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

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

发布评论

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

评论(1

以为你会在 2024-10-18 13:02:00

我也遇到过这个问题 - 它没有详细记录,但原因可能是您必须将音频类别设置为与硬件编码兼容的类别。

特别是,任何提供与设备上其他声音混合的音频会话都会使编码器停止工作。

我知道 AVAudioSessionCategoryPlayAndRecord、AVAudioSessionCategorySoloAmbient 和 AVAudioSessionCategoryAudioProcessing 肯定可以工作(只要您不覆盖 kAudioSessionProperty_OverrideCategoryMixWithOthers 属性)。

实际上,我已经将将任何音频文件编码为 AAC 所需的所有内容组装到异步类中: TPAACAudioConverter

I encountered this one too - It's not well-documented, but the reason is probably that you have to set the audio category to one compatible with hardware encoding.

In particular, any audio session that provides mixing with other sounds on the device will stop the encoder from working.

I know that AVAudioSessionCategoryPlayAndRecord, AVAudioSessionCategorySoloAmbient and AVAudioSessionCategoryAudioProcessing work for sure (as long as you're not overriding the kAudioSessionProperty_OverrideCategoryMixWithOthers property).

I've actually assembled everything you need to encode any audio file to AAC into an asynchronous class: TPAACAudioConverter

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