npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mp4reader

v0.1.6

Published

MP4 parser, parsed according to the standard, borrows the implementation of MP4 package

Downloads

45

Readme

English | 简体中文

introduce

This is a nodejs implementation of the structure parsing package of mp4 files, borrowing the implementation method of [mp4 package] (https://www.npmjs.com/package/mp4 "mp4"), but the author stopped updating without completing all the functions, here is on his basis, refactored the code, but this package is more pure, does not reference other third-party packages, the reason for the name mp4reader, It is a tribute to the author of the mp4reader software, that gadget is very easy to use. After getting the structure, you can parse the keyframe, and you can realize the screenshot of MP4 by NodeJS.

Properties that support resolution

usage

//引入方法
var { Mp4DecoderAll } = require( 'mp4reader')

// Use asynchronous methods to resolve all supported structures 
let mp4Info = await Mp4DecodeAll('test.mp4')

console.log(mp4Info)
//Print the result object 
// -1 No parsing succeeded

//Successful results
{
  ftyp: {
    Start_offset: 0,
    Box_type: 'ftyp',
    Major_brand: 'isom',
    Minor_version: 512,
    Compatible_brands: 'isomiso2avc1mp4'
  },
  moov: {
    offset: 32,
    size: 16080,
    mvhd: {
      ctime: '1904/1/1 上午8:00:00',
      mtime: '1904/2/13 上午10:21:12',
      scale: 1000,
      duration: 13255,
      Start_offset: 40,
      Box_size: 108,
      Box_type: 'mvhd',
      version: 0,
      flags: 0
    },
    udta: -1,
    trak: [ [Object], [Object] ]
  }
}

//example 2
//Export by module
var { Mp4DecodeByModule } = require( 'mp4reader')
let mp4Info = await Mp4DecodeByModule(filename ,['hdlr','ftyp']) 
console.log(mp4Info)

//Successful results
{
  ftyp: {
    Start_offset: 0,
    Box_type: 'ftyp',
    Major_brand: 'isom',
    Minor_version: 512,
    Compatible_brands: 'isomiso2avc1mp4'
  },
  hdlr: [
    {
      Start_offset: 324,
      Box_size: 45,
      Box_type: 'hdlr',
      version: 0,
      flags: 0,
      Handler_type: 'vide',
      Name: 'VideoHandler'
    },
    {
      Start_offset: 8221,
      Box_size: 45,
      Box_type: 'hdlr',
      version: 0,
      flags: 0,
      Handler_type: 'soun',
      Name: 'SoundHandler'
    }
  ]
}

Introduction of methods

  • Mp4DecoderAll() All MP4 structure information is exported
  • Mp4DecodeFtyp() Returns MP4 structure FPap box information
  • Mp4FindMoov() Returns MOOV box information: location, dimensions
  • getFileInfoAsync Returns fs.stat class information, including file size
  • Mp4DecodeByModule(filename ,option: []) The parameters are an array of file names and box names, and optional parameters are ftyp moov mvhd trak tkhd mdia hdlr minf stbl stsd stts stss ctts stsc stsz stco For example, Mp4DecodeByModule('test.mp4', ['stsd', 'stss']), the upper and lower levels do not conflict, but the parent box will contain the lower content, such as the moov box will contain trak content

Update records

0.1.5 【fix】Module export method fix 0.1.4 【change】The main method name was changed from 'Mp4DecoderAll' to 'Mp4DecodeAll' 【add】Modular export method 'Mp4DecodeByModule' 【Optimization】Adjusted the document structure to be more reasonable

0.1.3 【Optimization】Optimized some issues