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() } })</pre>
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 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!