-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unrecognized mp3 file #75
Comments
Actually libmagic has a lot of checks for identifying different mp3's: Your file would match this rule:
We could implement the logic from libmagic. However I don't know how we should map to file extension, because MP1, MP2 and MP3 all just resolve to audio/mpeg |
I see your call for libmagic reimplementation in js, I would be glad to help with the effort... I think
I've no idea... for my use case I need only the mime type. magic header comment seems to speak only |
I was actually thinking about just implementing the mp3 stuff from libmagic, not the whole thing. We made an issue about implementing everything (#68). And I actually tried to use a couple hours to implement the instruction set from libmagic. I got some of them right, but I realized that they have a quite big instruction set, some of which are not trivial to implement, so I gave up. Also it got quite slow. But the logic required for parsing audio/mpeg is quite trivial to implement, PRs are welcome :) |
Also libmagic covers a lot of obscure and ancient stuff we no longer care about. Would be very bloaty to compile it with emscripten. I think a better approach would be to find a way to precompile a selection of the rules into some kind of generated JS. |
The format of the rules is well explained in the man page, so this should be possible. Only, as @midif said, there are lot of stuff to implement... But it could be done incrementally at least |
I also have a mono mp3 file with |
In PR #101 It should fix this case as well as other cases I encountered. |
I have some mp3 file not recognized by file-type:
first bytes in file are 0xffe380, while file-type check for 0x494433 or else 0xfffb.
https://en.wikipedia.org/wiki/List_of_file_signatures only list the two checks actually done by file-type, but the magic header file used by posix
file
command seems to list a more complex check:The text was updated successfully, but these errors were encountered: