Why doesn't file detect the mime-type of mp3 properly?

Posted by Grumbel on Ask Ubuntu See other posts from Ask Ubuntu or by Grumbel
Published on 2011-10-30T18:37:59Z Indexed on 2012/04/03 23:41 UTC
Read the original article Hit count: 220

Filed under:

Something odd I recently encountered, running file --mime-type on a collection of MP3 gets the mime-time wrong a third of the time:

$ for i in */*.mp3; do cat "$i"| file --mime-type -; done  | sort  | uniq -c
140 /dev/stdin: application/octet-stream
309 /dev/stdin: audio/mpeg

There doesn't seem to be any obvious reason, as even MP3s from the same source, will sometimes fail and sometimes not.

Bug, feature or anything obvious I am missing here?

© Ask Ubuntu or respective owner

Related posts about files