[Matroska-devel] AAC+ detection

Moritz Bunkus moritz at bunkus.org
Fri Aug 8 20:00:15 CEST 2003


Bad news from the AAC+ detection front. I've tried menno's suggestion
which basically was...

 <menno> there may be another way that could work though
 <menno> 1. search for a 3 bit value 6 (ID_FIL) (ok this is not an
         uncommon bit field, but there should be a pttaren after that)
 <menno> 2. read the 4 bits after that, if it is the value 15 read 8
         more bits
 <menno> 3. read 4 more bits, if it is value 13 or 14 you may have
          detected SBR
 <menno> 4. repeat this for every 3 bit value 6 until you find that
         value of 13 or 14
 <menno> 5. stop when you handled more data then 1 SBR frame, if you
         didn't find the value 13 or 14 you don't have SBR
 <menno> ChrisHJW: once for every channel element
 <menno> but detecting it once should be ok
 <menno> I think this pattern is unlikely to occur randomly
 <menno> but it's not fail safe

So my detection code looks like this:

  for (old_pos = 0; old_pos < (size - 3) * 8; old_pos++) {
    if (bc.get_bits(3, value))
      return false;
    if (value != 6)
    if (bc.get_bits(4, value))
      return false;
    if ((value == 15) && bc.get_bits(8, value))
      return false;
    if (bc.get_bits(4, value))
      return false;
    if ((value == 13) || (value == 14))

For the two AAC+ sample files that I do have (castanets.aac,
sample_44-2-16_HE_AAC.aac) I find exactly two places with this
pattern. For some other files I have (vsshort.aac encoded with faac,
some other file someone sent me encoded with Nero 5) i get varying
number of occurences - 0 times, 4 times, 26 times.

Could someone with menno's email address please forward this email to
him and ask him for advice? Maybe I didn't get the code right, maybe the
same is not as rare as we'd hope it would be, maybe maybe...

And could someone please encode
http://www.bunkus.org/videotools/mkvtoolnix/samples/vsshort.wav with
Nero 6 to AAC+ and send that file to me? Chris? :)


 ==> Ciao, Mosu (Moritz Bunkus)

More information about the Matroska-devel mailing list