difference between audio data in .aac and .m4a files at the byte level
Asked Answered
B

0

6

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:

enter image description here

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:

enter image description here

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.

Bolme answered 18/1, 2019 at 10:47 Comment(2)
hm, so, slight confusion on my end: How do you know the bytestreams should be the same?Kevakevan
@MarcusMüller I don't. I'm still trying to understand the structure of aac files, and I am assuming that all the audio data inside the .aac should be somewhere in the .m4a file. Since I found the first frame of aac neatly arranged as a block of memory in the m4a file, I assumed it should be something similar for the next frames as well, but looks like it's not, and hence the questionBolme

© 2022 - 2024 — McMap. All rights reserved.