Comparing should-be identical AAC audio files - timestamp?

380 Views Asked by At

I have problems encoding AAC/M4A audio files on iPhone (iOS) and in simulator in a way so that

  1. mono/stereo and
  2. the track duration

are recognized correctly by external players like VLC.

For closing in on the problems on various devices, I have written code which generates test files for various encoding configurations. The encoded sound is a generated sine wave which is identical all the time. This works nicely. In the next step, I do a binary comparison of these test files which were generated on different divices and in the simulator. To my surprise, the .m4a files are never identical (the aac files are identical all the time). I use the ExtAudioFile...() methods for writing the files and I use the file type identifier kAudioFileM4AType.

I suspect that there is a timestamp included in these files which confuses my binary comparison.

Can anybody confirm or refute that there is a timestamp in M4A files, which will always confuse a binary comparison?

1

There are 1 best solutions below

0
On

M4A is a container format, and would almost certainly contain some metadata. It's very likely some of this metadata is different from one encoding to another, as you suspect.

You might do better writing some kind of algorithm to see if your M4A file contains a byte stream that matches the AAC data you have. One way to approach this would be to compare both files (M4A and AAC with same raw sound data) manually in a Hex editor and try to find the offset where the AAC data begins and/or ends, and then just compare that data.