6

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?

ARods
  • 441
  • 2
  • 5
  • 13

1 Answers1

1

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.

Raptor
  • 53,206
  • 45
  • 230
  • 366
  • Thanks for your reply. I'm using paperclip ruby gem for one my product, Before we're using version 5.0.0, but no issues were reported by paperclip gem with the same mp4 video with mime-type as application/octet-stream. Now we've updated the gem version to 6.0.0. Now It's reported issues on the mime-type (mismatch - video/mp4 should be for mp4 file). This is the exact issue. – ARods Jun 27 '18 at 10:23
  • Read [this](https://stackoverflow.com/questions/40953122/rails-paperclip-not-validating-content-type-application-octet-stream?rq=1) – Raptor Jun 29 '18 at 03:46
  • 1
    For anyone wondering how to convert it, use this command with ffmpeg: `ffmpeg -i broken.mp4 -pix_fmt yuv420p -crf 18 good.mp4` – crazynx Nov 08 '20 at 21:09
  • @crazynx it depends on case by case. Your command does not necessarily work on all scenarios. – Raptor Nov 09 '20 at 01:53
  • @Raptor Oh okay, interesting to know. I still hope it helps somebody out though! – crazynx Nov 11 '20 at 09:09
  • i have recorded audio from safari using media recorder api and it give me file in octate-stream mime type so i have saved it as a .mp3 and when i try to convert it to actual mp3 file using ffmpeg it is converting only 1 second. – dhruvin vaghasiya Jun 13 '23 at 07:41