Re: rendering output to a file
Re: rendering output to a file
- Subject: Re: rendering output to a file
- From: William Stewart <email@hidden>
- Date: Wed, 28 May 2008 11:43:22 -0700
On May 25, 2008, at 1:27 PM, tahome izwah wrote:
Most likely because you need to define mBytesPerPacket,
mBytesPerFrame, mBitsPerChannel and mFormatFlags to be something other
than 0.
Just to clarify:
for AAC these are correct values. AAC is a variable bit rate codec,
so it has no constant value for any of these fields. Because it is a
compresed format, there is no "bits per channel" value. AAC does not
use format flags.
So Tahome's comment above is about the fact that if you change *just*
the mFormatID to Linear PCM, then that doesn't work and you need to
provide non-zero values for all of these fields.
Bill
The header needs to match the data that you're providing,
otherwise you'll get a format error.
--th
2008/5/22 Ashley Allen <email@hidden>:
Hi Tahome,
Thanks for the suggestion. I was able to write to a file and use
afplay to
play it back!!!!
The following parameters are passed to the ExtAudioFileCreateNew
for the
stream description which works.
fileformat.mSampleRate = 44100.0;
fileformat.mFormatID = kAudioFormatMPEG4AAC;
fileformat.mFormatFlags = 0;
fileformat.mBytesPerPacket = 0;
fileformat.mFramesPerPacket = 1024;
fileformat.mBytesPerFrame = 0;
fileformat.mChannelsPerFrame = 2;
fileformat.mBitsPerChannel = 0;
fileformat.mReserved = 0;
If I change the format to linear pcm the create call fails
complaining about
the format. I don't understand why. I copied these settings from an
example, so how they relate to each other is unclear to me. Do
different
encodings require different settings? What's the strategy for
determining
these values? It seems to depend on hardware and data rates. Are
there
formulas or libraries to calculate these settings for different
encodings?
Also, if I try to change the file type from caff to m4af or mp4f,
the file
gets created but the number of bytes are set to zero. Neither
QuickTime or
iTunes can play the contents. I'm doing something wrong considering
the file
should be encoded as a kAudioFormatMPEG4AAC.
Thanks again,
Ashley
_______________________________________________
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