On Linux / Unix Command file:

" -i Causes the file command to output mime type strings rather than the more traditional human readable ones "

Why does it always output "application/octet-stream" for images and videos? How can I obtain the specific mime type of an image or a video with this command or with any other command?

Thanks.

link|improve this question
What is the output without -i ? – Kyle Brandt Nov 20 '09 at 13:50
Without -i the output gives details about the format, for example, "Macromedia Flash Video" – Lucia Nov 20 '09 at 14:08
This may be a better candidate for superuser.com, BTW – Suppressingfire Nov 20 '09 at 22:24
feedback

2 Answers

up vote 0 down vote accepted

Can you tell us what the output is with out the -i switch?

Also, what is the output of the file --version, maybe you are missing magic files?

file --version
file-4.26
magic file from /etc/magic:/usr/share/file/magic

You might just need to update your magic package (I love how these sentances sound :-) ). Do so on debian / ubuntu :

apt-get install libmagic1
link|improve this answer
file someflv.flv: /tmp/phpGo4d1V: Macromedia Flash Video ||| file -i someflev.flv: /tmp/phpGo4d1V: application/octet-stream ||| file --version file-4.17 magic file from /usr/share/file/magic – – Lucia Nov 20 '09 at 14:07
Output of grep flv /usr/share/file/magic ? – Kyle Brandt Nov 20 '09 at 14:24
Or maybe you need: /usr/share/file/magic.mime ? – Kyle Brandt Nov 20 '09 at 14:33
The output is empty then I guess "update" is the correct answer. I will tell my sysadmin about this. Thanks! – Lucia Nov 20 '09 at 14:48
feedback

Experienced similar under Ubuntu 9.10 while it was working in Ubuntu 9.04.

Had libmagic1 and libmagic-dev installed with the following:

$ file --version
file-5.03
magic file from /etc/magic:/usr/share/misc/magic

/etc/magic has only a couple comments (in 9.10 and 9.04)
/usr/share/misc/magic is a symlink to ../file/magic

I managed to solve the problem by downgrading file and libmagic. I installed these versions from Jaunty:

  • libmagic1_4.26-2ubuntu3_amd64.deb
  • file_4.26-2ubuntu3_amd64.deb

Things seem to be working now, but I don't know if it'll cause other issues.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.