1.0.2 • Published 4 years ago

get-video-mime v1.0.2

Weekly downloads
1
License
MIT
Repository
gitlab
Last release
4 years ago

get-video-mime

When trying to use Media Source Extensions you often need to know the full MIME type for the video that you are working with. I wasn't able to find any easy solutions, so I put this together.

Usage

Just run this command and pass it any number of video files.

$ npm i -g get-video-mime
$ get-video-mime video-file.mp4

OR

$ npx get-video-mime video-file.mp4 another-file.mp4

This should yield output like this:

[22:28:37] Getting MIME for 1 file(s)...
[22:28:38] MIME for video-file.mp4 detected as: video/mp4; codecs="hev1.1.6.L120.90,mp4a.6b"; profiles="isom,iso2,mp41"
[22:28:38] Finished processing all files.

You can then use this string in your JS code like this:

const mediaSource = new MediaSource;
mediaSource.isTypeSupported('video/mp4; codecs="hev1.1.6.L120.90,mp4a.6b"; profiles="isom,iso2,mp41"');

Inspiration

This technique was based largely on this article. And, of course, this is just at thin wrapper around mp4box.js which does all of the heavy lifting.

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago