mutagen icon indicating copy to clipboard operation
mutagen copied to clipboard

AAC detect

Open lud4ik opened this issue 5 years ago • 5 comments

Why aac is detected only by extension and one of possible headers ADIF?

class AAC(FileType):
   ...
    @staticmethod
    def score(filename, fileobj, header):
        filename = filename.lower()
        s = endswith(filename, ".aac") or endswith(filename, ".adts") or \
            endswith(filename, ".adif")
        s += b"ADIF" in header
        return s

Why can't rely on signature bytes

{"type": "audio", "extension": "aac", "mime": "audio/aac", "offset": 0, "signature": ["FF F1", "FF F9"]}

https://github.com/floyernick/fleep-py/blob/master/fleep/data.json#L38

lud4ik avatar Aug 27 '19 14:08 lud4ik

We could, I'm not sure what all the possible values are, the spec suggests ffff8 as well and I have files which start with fff0. And of course most of the files start with an ID3 tag, so there is no way of knowing without the extension. But we could bump the score if we find the 12 bit sync at least.

lazka avatar Sep 13 '19 14:09 lazka

I have been bitten by this problem with the file attached.

testfile.zip

It's a big problem for me, I have thousands such files.

Mutagen just reports:

lockywolf@delllaptop:~$ mutagen-inspect test-mutagen-fails.aac 
-- test-mutagen-fails.aac
can't sync to MPEG frame

ghost avatar Mar 03 '21 02:03 ghost