4

I am a newbie Mac programmer just for 3 months. I got a Audio Queue Services problem, hope anyone can help me.

I using Audio Queue Services API created a recording program, and output AAC format data. It's seems good, everything work fine.

Until I get to use the MP4V2 Library(an open source library) to output a .mp4 file, the problem is occur.

Problem 1:

I use magic cookie as a AAC header to input to MP4V2 library function MP4WriteSample(). Inside the .mp4 file has data, but the player(ex:Quicktime) can't recognized the .mp4 file, it can't play the audio data.


Problem 2:

I set my audio queue basic descriptions format in following :

    aqData.mDataFormat.mSampleRate = 44100.0;
    aqData.mDataFormat.mFormatID = kAudioFormatMPEG4AAC;  // AAC codec.
    aqData.mDataFormat.mChannelsPerFrame = 2;
    aqData.mDataFormat.mFramesPerPacket = 1024;

and use AudioQueueGetProperty() to get magic cookie.

Than I print out my magic cookie contants, like that:

    <03808080 22000000 04808080 14401500 18000001 f4000001 f4000580 80800212 10068080 800102>

total 39 Bytes.

What exactly it mean?

What the 39 Bytes each represented mean?

Can it convert to AAC header?

Reference :

Set a Magic Cookie for an Audio File

Set a Magic Cookie for a Playback Audio Queue

CoreAudio - how to determine the end of the playing aac file


Thanks a lot.

Ryan

Community
  • 1
  • 1
Ryan Liang
  • 51
  • 5

1 Answers1

0

set file type to kAudioFileM4AType

AudioFileCreateWithURL (
            audioFileURL,
            kAudioFileM4AType,
            &audioFormat,
            kAudioFileFlags_EraseFile,
            &audioFileID
    );
Kjuly
  • 34,476
  • 22
  • 104
  • 118
Bryan
  • 1