I'm working on a mp4 container parser but I'm going crazy trying to recognize the audio codecs of the streams. I used both QtAtomViewer and AtomicParsley but when I find the atom:
trak->mdia->minf->stbl->stsd
I get always "mp4a" even if the mp4 file has an mp3 stream.
Should I look for an ".mp3" fourcc?
I attach two different mp4 structures: mp4 container with AAC audio stream
Atom trak @ 716882 of size: 2960, ends @ 719842
Atom tkhd @ 716890 of size: 92, ends @ 716982
Atom mdia @ 716982 of size: 2860, ends @ 719842
Atom mdhd @ 716990 of size: 32, ends @ 717022
Atom hdlr @ 717022 of size: 33, ends @ 717055
Atom minf @ 717055 of size: 2787, ends @ 719842
Atom dinf @ 717063 of size: 36, ends @ 717099
Atom dref @ 717071 of size: 28, ends @ 717099
Atom stbl @ 717099 of size: 2727, ends @ 719826
Atom stts @ 717107 of size: 24, ends @ 717131
Atom stsz @ 717131 of size: 1268, ends @ 718399
Atom stsc @ 718399 of size: 40, ends @ 718439
Atom stco @ 718439 of size: 32, ends @ 718471
Atom stss @ 718471 of size: 1264, ends @ 719735
Atom stsd @ 719735 of size: 91, ends @ 719826
Atom mp4a @ 719751 of size: 75, ends @ 719826
Atom esds @ 719787 of size: 39, ends @ 719826
Atom smhd @ 719826 of size: 16, ends @ 719842
mp4 container with mp3 audio stream
Atom trak @ 1663835 of size: 4844, ends @ 1668679
Atom tkhd @ 1663843 of size: 92, ends @ 1663935
Atom mdia @ 1663935 of size: 4744, ends @ 1668679
Atom mdhd @ 1663943 of size: 32, ends @ 1663975
Atom hdlr @ 1663975 of size: 45, ends @ 1664020
Atom minf @ 1664020 of size: 4659, ends @ 1668679
Atom smhd @ 1664028 of size: 16, ends @ 1664044
Atom dinf @ 1664044 of size: 36, ends @ 1664080
Atom dref @ 1664052 of size: 28, ends @ 1664080
Atom stbl @ 1664080 of size: 4599, ends @ 1668679
Atom stsd @ 1664088 of size: 87, ends @ 1664175
Atom mp4a @ 1664104 of size: 71, ends @ 1664175
Atom esds @ 1664140 of size: 35, ends @ 1664175
Atom stts @ 1664175 of size: 24, ends @ 1664199
Atom stsc @ 1664199 of size: 28, ends @ 1664227
Atom stsz @ 1664227 of size: 2228, ends @ 1666455
Atom stco @ 1666455 of size: 2224, ends @ 1668679
Thanks FE
UPDATE:
I found a way to solve the problem: by watching the code of AtomicParsley I see that it's possible to get the codec informations about the stream atom (mp4a), reading the 11th Byte into the esds (Elementary Stream Description) atom.
Now I'm working in this way:
if the value of the 11th Byte is 0x40 I assume the stream is AAC, else if I read 0x69 I assume that the stream is MP3.
I don't like these "empirics" solutions so I'm looking for a more correct way, but I found onlyUnderstanding_AAC that is not complete.
Anyone know where I can get a more detailed specification of MP4 containers?