@nangu/mp4-scan
v1.0.4
Published
Web utility to scan MP4 files and check support for progressive playback
Downloads
187
Maintainers
Readme
@nangu/mp4-scan
Utility to scan an mp4 file and check whether it supports progressive download and playback or not.
It downloads the first 1kB of the MP4 file using a Range request and looks for MP4 moov
box header atom in there. If moov
atom is present, the MP4 can be played back progressively.
Intended for web environment. Not tested in node.js environment.
import { supportsProgressiveDownload } from '@nangu/mp4-scan'
const result = await supportsProgressiveDownload('https://cdn.myweb.com/myvideo.mp4')
// result === true or false
Known issues:
- extended box size is not supported (this should be present only in videos larger than 4GB)
Sources of inspiration:
- https://agama.tv/demystifying-the-mp4-container-format/
- https://bitmovin.com/fun-with-container-formats-2/
- https://github.com/uupaa/MP4Parser.js/tree/79e90b21b903da591bd59e0e2e727567af8953d3
- http://mp4ra.org/#/atoms
- https://sanjeev-pandey.medium.com/understanding-the-mpeg-4-moov-atom-pseudo-streaming-in-mp4-93935e1b9e9a
- https://rigor.com/blog/optimizing-mp4-video-for-fast-streaming/
Changelog
1.0.4
- patch: Added TypeScript typings
1.0.3
- patch: Added TypeScript typings
1.0.2
- patch: Added TypeScript typings
1.0.1
- patch: Made NPM package public
1.0.0
- major: Added functions
supportsProgressiveDownload
andparseMp4Boxes