This module offers Encoder
and Decoder
stream classes for working with FLV
media files.
Install through npm:
$ npm install flv
var fs = require('fs');
var flv = require('flv');
// create a readable stream to some FLV file
var file = fs.createReadStream('GtzZP3CsK4g.flv');
var decoder = new flv.Decoder();
decoder.on('metadata', function (name, data) {
// "name" is a String, "data" is an Object/Array
console.error('"metadata" event %j %j', name, data);
});
decoder.on('audio', function (audio) {
// "audio" is a Readable stream of audio data
// the type of audio data depends on the FLV file, could be AAC, MP3, etc.
audio.pipe(fs.createWriteStream('output.mp3'));
});
decoder.on('video', function (video) {
// "video" is a Readable stream of video data
// the type of video data depends on the FLV file, could be H.263, On2 VP6, etc.
video.pipe(fs.createWriteStream('output.h263'));
});
// pipe the FLV file to the Decoder instance
file.pipe(decoder);
Coming soon!