I'm using the fluent-ffmpeg
npm module
I've POSTed a video from my client, and am using new stream.Readable
to "read" the video Buffer.
ffmpeg is converting and saving the file, and everything seems beautiful, but the "end" event never fires.
My code is as follows:
const videoStream = new stream.Readable({
read: function (n) {
this.push(myVideoBuffer);
}
});
ffmpeg(videoStream)
.on('progress', e => console.log(e))
.on('end', () => {
console.log('ended')
videoStream.destroy();
})
.on('error', e => console.error(e))
.save(`${process.cwd()}/media/videos/${Date.now()}.mp4`);
I get a log on every progress event, and it does save the video, but the "end" event's callback never gets called.
I assume this is a bug, since everything else works just fine.