Re: AudioFileStream unable to read m4a data
Re: AudioFileStream unable to read m4a data
- Subject: Re: AudioFileStream unable to read m4a data
- From: Mark's Studio <email@hidden>
- Date: Mon, 31 Mar 2008 19:21:33 +0200
Have you set the MagicCookie ?
I am streaming AAC and it works, (not using the AudioFileStream),
i am sending the ASBD and the magicCookie before i start streaming and
set it on my AudioConverter,
but i guess you could use one of these to set it.
kAudioQueueProperty_MagicCookie,
kAudioFileStreamProperty_MagicCookieData
On 31/03/2008, at 18.24, Jens Alfke wrote:
On 28 Mar '08, at 3:23 PM, I wrote:
I'm using AudioFileStream to parse audio data arriving over a TCP
socket; on the other end, the sender is using AudioFile to read the
contents of the file starting at offset 0. [...] it's failing on
every AAC (.m4a) file. AudioFileStreamParseBytes keeps returning
the error code 'typ?'.
I spent a lot of time struggling with this over the weekend, and I'm
still really frustrated. I could really, really use some advice.
Here's what I've figured out:
* AAC files begin with a magic number, and then a large (circa 32K)
header before the audio data starts. I think this is a packet table;
it seems to consist of a list of 32-bit offsets.
* AudioFileReadBytes skips this table: if you ask for bytes at
offset zero, you get the beginning of the compressed audio itself.
* But AudioFileStreamParseBytes needs to read the entire file,
including the magic number and packet table. If you just start
feeding it the audio, it can't parse it.
So it looks as though one can't stream AAC files using AudioFile on
the sending end and AudioFileStream on the receiver. You have to
stream the raw .m4a file in its entirety. Which is a shame because
this increases latency — I was having trouble when starting the
stream because audio files may have up to 100K of non-audio at the
beginning, especially ones with large hi-res album cover art
embedded. This wastes several seconds of network bandwidth before
the receiver can even start to buffer any audio.
I know that AAC is used for streaming audio, so I imagine there must
be a way to avoid that packet table at the beginning. Do I have to
set some parameters in the encoder or something?
—Jens _______________________________________________
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
Peter Mark
Mark's Recording Studio A/S
Lundeskovsvej 3
2900 Hellerup
Denmark
Tel: +45 35366078 Fax: +45 35366038
www.marks-studio.dk
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