Why some of the MP4 file's mime-type are application/octet-stream instead of video/mp4?

ARods picture ARods · Jun 27, 2018 · Viewed 7.7k times · Source

Why some of the MP4 file's mime-type are application/octet-stream instead of video/mp4?

I've checked with file command in terminal (CLI)

user@anto:~/Videos/VTB$ file --mime-type -b GDPR.mp4 
video/mp4
user@anto:~/Videos/VTB$ file --mime-type -b Test-vid1.mp4 
application/octet-stream
user@anto:~/Videos/VTB$ file --mime-type -b SampleVideoLarge.mov 
video/quicktime
user@anto:~/Videos/VTB$ file --mime-type -b SampleVideo21.mp4 
video/mp4
user@anto:~/Videos/VTB$ file --mime-type -b VTBSample-new.mp4 
application/octet-stream.

Can anyone tell me the reason? How to handle this mime-type. Is the video file with application/octet-stream is a correct mp4 file or wrong one?

Answer

Raptor picture Raptor · Jun 27, 2018

It's still a correct MIME type for MP4. By saying "correct", it can be played without problems in most cases (using player software, playing with <video> tag in HTML, etc).

Some web servers do not configure the MIME type to serve the officially documented MIME type, video/mp4, thus the MIME type will be set to application/octet-stream by the web server, which is a generic MIME type for binary file downloads.

For example, to handle the application/octet-stream MP4 in HTML, you can specify MIME type in the <source> tag:

<video>
  <source src="video.mp4" type="video/mp4" />
</video>

Hope it helps.


UPDATE:

If you are really concerned about these application/octet-stream videos, you can re-render them using programs like ffmpeg to force the updated video file to be video/mp4 MIME type.