Re: Encoding AAC in an M4A using ExtCoreAudioFile on iPhone OS
Re: Encoding AAC in an M4A using ExtCoreAudioFile on iPhone OS
- Subject: Re: Encoding AAC in an M4A using ExtCoreAudioFile on iPhone OS
- From: William Stewart <email@hidden>
- Date: Thu, 30 Jul 2009 14:36:18 -0700
on a 3G iphone there is no aac encoder, so it can't find any support
for the format
on a 3GS iphone, there is an aac encoder, but with 3.0 you can't
access this with ext audio file (just with audio input queue). So you
have a permissions error
On Jul 30, 2009, at 12:29 PM, Evan Olcott wrote:
OK, I see that it's there, I suppose I'd better re-phrase my
question then:
Why does this code return a 'fmt?' error on an iPhone 3G and a
'perm' error on an iPhone 3GS?
====
NSURL *url = [NSURL fileURLWithPath:@"/directory/file.ext"];
AudioStreamBasicDescription description;
ExtAudioFileRef outExtAudioFile;
OSStatus err;
description.mSampleRate = 44100;
description.mFormatID = kAudioFormatMPEG4AAC;
description.mFormatFlags = 0;
description.mBytesPerPacket = 0;
description.mFramesPerPacket = 0;
description.mBytesPerFrame = 0;
description.mChannelsPerFrame = 1;
description.mBitsPerChannel = 0;
description.mReserved = 0;
// complete the AudioStreamBasicDescription
UInt32 size = sizeof(description);
AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, nil,
&size, &description);
// create the audio file
err = ExtAudioFileCreateWithURL((CFURLRef)url, kAudioFileM4AType,
&description, nil, 0, &outExtAudioFile);
// no error here
description.mSampleRate = 44100;
description.mFormatID = kAudioFormatLinearPCM;
description.mFormatFlags = kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked |
kAudioFormatFlagIsNonInterleaved;
description.mBytesPerPacket = 2;
description.mFramesPerPacket = 1;
description.mBytesPerFrame = 2;
description.mChannelsPerFrame = 1;
description.mBitsPerChannel = 16;
description.mReserved = 0;
err = ExtAudioFileSetProperty(outExtAudioFile,
kExtAudioFileProperty_ClientDataFormat,
sizeof(AudioStreamBasicDescription), &description);
// 'perm' error here
====
From what I can read from messages on this list, this seems to be a
result of not being able to access the hardware encoder... is my
assumption correct?
Can I tickle ExtAudioFile's converter to use the software encoder
instead? Or is it even *possible* for third-party apps to encode AAC
via the ExtAudioFile API?
On Jul 27, 2009, at 1:40 PM, William Stewart wrote:
you would have to check available encoders - this is an AudioFormat
call and it tells you what encoders are available for your use (and
with iphone you have the extra notion of hardware v software
versions to deal with - see AudioFormat.h for some details about
this)
On Jul 24, 2009, at 9:43 AM, Evan Olcott wrote:
Getting a 'fmt?' error when trying to encode AAC in an M4A file on
the ExtAudioFileCreateWithURL call on the iPhone device.
Checking the list of kAudioFileGlobalInfo_AvailableFormatIDs for
kAudioFileM4AType via AudioFileGetGlobalInfo lists 'alac', 'aach'
and 'aac ' as available. Checking
kAudioFileGlobalInfo_WritableTypes through the same call also
lists 'm4af' as one of the types it supports.
So through the API, it seems like it's "available", but... if I am
reading it correctly, there is no way to identify whether a
certain FORMAT is readable or writable within a FILE TYPE. What is
needed is a kAudioFileGlobalInfo_WritableFormats property?
Is this the situation here, that AAC writing is not available on
the iPhone device, but that there is no way to discover this via
the API?
In either case, where can I find a list of file types and formats
that the iPhone OS can read and write?
Ev
Senior Software Developer
Audiofile Engineering
http://www.audiofile-engineering.com/
_______________________________________________
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
Ev
Senior Software Developer
Audiofile Engineering
http://www.audiofile-engineering.com/
_______________________________________________
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