Node.js的MP4流编码和解码器:mp4-stream
Node.js的MP4流编码和解码器:mp4-stream。
npm install mp4-stream
用法
var mp4 = require('mp4-stream') var fs = require('fs') var decode = mp4.decode() fs.createReadStream('video.mp4') .pipe(decode) .on('atom', function (atom) { console.log('found atom (' + atom.type + ') at ' + atom.offset + ' (' + atom.length + ')') if (atom.container) { console.log('atom has child atoms (will be emitted next)') } if (atom.stream) { console.log('atom has stream data (consume stream to continue)') atom.stream.resume() } })
All atoms have a type thats a 4 char string with a type name.
API
var stream = mp4.decode()
Create a new decoder.
The decoder is a a writable stream you should write a mp4 file to. The stream will emitatomwhen a new atom is found.
var stream = mp4.encode()
Create a new encoder.
Currently not implemented
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!