Re: ExtAudioFileSetProperty( kExtAudioFileProperty_FileDataFormat ) returns error 1718449215
Re: ExtAudioFileSetProperty( kExtAudioFileProperty_FileDataFormat ) returns error 1718449215
- Subject: Re: ExtAudioFileSetProperty( kExtAudioFileProperty_FileDataFormat ) returns error 1718449215
- From: Ryan Walklin <email@hidden>
- Date: Thu, 6 Aug 2009 10:11:36 +1200
AAC frames are ~1024 samples long, (ie a block of compressed samples),
so you'll need to alter some of the other values in your audioFormat.
This is the same for other compressed formats. Try using
ExtAudioFileRead to examine an existing AAC file to see the format you
need to set.
-Ryan
On 6/08/2009, at 10:07 AM, Andrew E. Davidson wrote:
Sorry for the repost, The formatting on my original post got scrambled
Hi
I am trying to use ExtAudioFile to convert a PCM file I create on
the iPhone
using AudioQueues into a compressed format ( aac)
Here is the high level structure of my code
1. Open input file
2. get AudioStreamBasicDescription from input file
3. cp inputASBD to outputASBD
4. outputASBD mFormatID = kAudioFormatMPEG4AAC;
5. get the audio channel layout
6. create output file with type kAudioFileM4AType
7. set kExtAudioFileProperty_ClientDataFormat
8. for() { read; write;}
for some unknown reason I keep getting a 1718449215 error when I try
to set
kExtAudioFileProperty_ClientDataFormat. I believe this is a 'format
error'
Could the problem be with the way I set up the recording format? I
set the
recording up this way because I need 16 int PCM.
here is how I set up the audio format when I made the recording
audioFormat.mSampleRate = self.hardwareSampleRate / 4.0;
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mChannelsPerFrame = 1;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
audioFormat.mBitsPerChannel = 16;
audioFormat.mBytesPerPacket = 2;
audioFormat.mBytesPerFrame = 2;
// open input file
err = ExtAudioFileOpenURL ( inputURL, &audioSourceFile);
// get the input file format
err = ExtAudioFileGetProperty ( audioSourceFile,
kExtAudioFileProperty_FileDataFormat, &sizeOfFormatASBDStruct
&audioSourceFormat );
//Copy the inputFormat to outputFormat
.
outputFormat.mFormatID = kAudioFormatMPEG4AAC;
// get the channel layout and create the output file
AudioChannelLayout *acl = NULL;
ExtAudioFileGetProperty( audioSourceFile,
kExtAudioFileProperty_FileChannelLayout, &size, acl );
ExtAudioFileCreateWithURL(outURL, kAudioFileM4AType, &outputFormat,
acl,
kAudioFileFlags_EraseFile, &outputFile);
ExtAudioFileSetProperty( outputFile,
kExtAudioFileProperty_ClientDataFormat, sizeOfFormatASBDStruct,
&audioSourceFormat );
Any idea what I am doing wrong? I get the same error when I try to
convert
PCM to mp3
Thanks
Andy
_______________________________________________
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
_______________________________________________
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