Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We're using the file utility on linux to determine the file MIME type (and this information we subsequently use), which seems to be failing on some m4v files, but not on others.

Running                                     Shows
/usr/bin/file sample_iPod.m4v               sample_iPod.m4v: ISO Media
/usr/bin/file -i -b sample_iPod.m4v         (NOTHING)

This particular file was from Apple's site:

The ones for which it does work shows:

/usr/bin/file agsample.m4v                  agsample.m4v: ISO Media, MPEG v4 system, version 2
/usr/bin/file -i -b agsample.m4v            video/mp4

It appears that the ones where it works are actually MPEG 4 encoded files renamed as m4v, but how can I determine file type otherwise if not through /usr/bin/file?

share|improve this question

Look at apple`s donwload page closely: H.264 is the file-type for sample_iPod.

The file command propably does not know about that file-type, but you can add that type to the file command if you can describe the format with a proper regex. Read The Fine Manual: man magic.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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