tinytag icon indicating copy to clipboard operation
tinytag copied to clipboard

Support ADTS (.aac) files

Open DohrliOfDeath opened this issue 5 years ago • 3 comments
trafficstars

Hello, I'm not sure how difficult it would be, but .aac support would be really nice.

It would make sense as .aac is often seen as the successor to .mp3, as it has better or same audio quality, but with a smaller file size.

Thanks in advance

DohrliOfDeath avatar Apr 24 '20 08:04 DohrliOfDeath

Hey @DohrliOfDeath

Most of the time aac is actually in a mp4 container, so you can just change this line here: https://github.com/devsnd/tinytag/blob/master/tinytag/tinytag.py#L119

from

(b'.m4b', b'.m4a', b'.mp4'): MP4,

to

(b'.m4b', b'.m4a', b'.mp4', b'.aac'): MP4,

Which should do the trick for many files.

Please report back if that works for you, and if it does not, please provide a sample file that I can work with.

devsnd avatar May 02 '20 12:05 devsnd

Yes this worked for me, thank you. However, I don't think this would work for most people, as I tried to create a new .aac file with ffmpeg:

ffmpeg -i input.wav output.aac

and this did not work, I got a NoneType from tinytag.

On my part, this solution is fine, but if this problem comes up again, or someone wants to look into it, here is a sample file: output.tar.gz

DohrliOfDeath avatar May 02 '20 14:05 DohrliOfDeath

Hey Dohrli,

thanks for the sample fiel.

The aac you created however is a "pure" audio file, in the sense that it's not inside an audio container format; Usually the container format, like MP4, contain all the data. What's more confusing is that AAC inside an MP4 container often have the .aac extension and having .mp4 as extension often means that it contains AAC, but often is also does not.

Anyway, that means that the only meta-data that could be read from your output.aac is duration and sample rate. This could only be done by parsing the actual audio data. I haven't looked into the AAC audio format to find out if that's easy to do though.

devsnd avatar May 16 '20 13:05 devsnd