Re: Using AudioConverter to create compressed audio
Re: Using AudioConverter to create compressed audio
- Subject: Re: Using AudioConverter to create compressed audio
- From: Brad Ford <email@hidden>
- Date: Wed, 23 Jan 2008 23:31:34 -0800
On Jan 23, 2008, at 9:48 PM, Neil Clayton wrote:
I'm attempting to use AudioConverter to create compressed data from
PCM data.
The input ASBD comes out from the AU that is receiving the data
(I'll be passing a copy of the data this AU receives, so in effect
splitting off at that point and compressing the same thing), The
output ASBD is from the QT SCAudio component. The audio
converter initializes OK, and I'm able to successfully set it's
magic cookie.
At this stage I'm compressing PCM to AAC.
Hold on there. Typically magic cookies are not for setting on the
output side of an audio converter. They are for telling an audio
converter about compressed _input_ buffers when you're decompressing.
Typically a magic cookie on output is insufficient to configure an
encode. You should be getting the
kQTSCAudioPropertyID_CodecSpecificSettingsArray and passing it to the
audio converter as the kAudioConverterPropertySettings. There are a
few legacy encoders that have no
kQTSCAudioPropertyID_CodecSpecificSettingsArray, but do have a magic
cookie. For these, it's ok to pass the
kQTSCAudioPropertyID_MagicCookie from SCAudio to the audio converter
as the kAudioConverterCompressionMagicCookie, but AAC is not one of
them. So you should be using the
kQTSCAudioPropertyID_CodecSpecificSettingsArray property instead.
There's a technote about this: http://developer.apple.com/qa/qa2006/qa1390.html
<SNIP>
So here I copy some frames from the internal queue, and then make
the passed in buffer reference that queue (the AudioBufferList
passed by the audio buffer appear to have the right number of
buffers (2) for the PCM data, but are not initialized in any other
way).
So the flow is AU -> Internal conversion queue -> AudioBufferList ->
AudioConverter.
Where in the last case the audio converter always receives a
reference to the AudioBufferList data pointers. It's always PCM
data going in.
This appears to all go as planned - except that I get
kAudioConverterErr_InvalidInputSize back from the call to
AudioConverterFillComplexBuffer.
kAudioConverterErr_InvalidInputSize usually means your mDataByteSize's
are wrong in the audiobufferlist you're filling out in your
inputProc. Do they jibe with the number of data packets you're saying
that you're returning?
-Brad Ford
QuickTime Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden