English 中文(简体)
The codec could not be accessed. (-66672)
原标题:

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.

问题回答

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





相关问题
The codec could not be accessed. (-66672)

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 ...

what is AudioStreamBasicDescription for m4a file format

I have tried with more AudioStreamBasicDescription for m4a file format. Still I am getting some issues with that. Please anyone tell me the exact AudioStreamBasicDescription for m4a file format.

How to record voice in .m4a format

Already I have created an iPhone application to record. It will record in .caf file. But I want to record in .m4a format. Please help me to do this. Thanks.

flash audio player for m4a (AAC) audio file embedded in html

I m looking for a (free) flash player that I can embed in my site and use to play a .m4a (.mp4 with AAC audio) file that will be obtained using a URL (i.e. it s not local to the server hosting the web ...

WPF MediaElement: SpeedRatio not working for .m4a files?

I m working with a simple mediaplayer based on this msdn example where the user can control volume, playback speed (SpeedRatio) and seek (Position) using 3 sliders. Everything works correctly when I ...

How to read tags out of m4a files in .NET?

I ve got some heavily modified code that ultimately came from the Windows Media SDK that works great for reading tags out of MP3 and WMV files. Somewhere along the line, Windows Media Player added ...

热门标签