This is for trying to understand the aac file structure
For simplicity we can assume m4a file with only aac audio (that is, no video)
I am comparing an m4a file and an aac file made from the m4a file using the faac library
A screenshot of the byte level comparison of the two files is given below:
the upper part is the m4a file and the lower part is the aac file
For the very first frame, from the lower part the AAC ADTS header is FF F9 4C 80 12 3F FC
and from here and here the actual aac audio data should have 138 bytes
From the lower part we can see that the bytes from DE
to 80
match a block of data in the upper window (the green coloured part)
I had assumed that I had found the offset in the m4a file, from where the actual aac audio data is stored. I though that the bytes 21 4C ...
in the upper window contained all the bytes of the next frame of aac audio, and if we look at the lower window, we can indeed see that ... a3 80
(end of the green coloured part in the lower window) is followed by another ADTS header (FF F9 4C 80 12 1F FC
, which says the number of audio in the next aac frame should be 137 bytes)
However, the bytes read from the aac file do not match those in the m4a file as expected, as shown in the screenshot below:
They match up to a certain point but everything after that looks random.
What is the relationship between m4a file and the corresponding aac file created from it, at the byte level?
The main goal is to be able to modify this matlab project (which takes m4a input and decodes to raw wav data) to read aac audio data directly from aac file, then use the aac decoder functions from that matlab project unchanged.