fluent-ffmpeg-multistream
fluent-ffmpeg-multistream copied to clipboard
Error: read ECONNRESET
Hi! Firstly thank you so much for making this module!
I was looking everywhere for a way to accomplish this but found nothing.
I'm trying to pass an S3 object Buffer through the StreamInput Method.
Before passing the Buffer I convert it to a readable stream by the following:
function bufferToStream(binary) {
return new Readable({
read() {
this.push(binary);
this.push(null);
}
});
}```
Here is the error I am receiving:
```events.js:174
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at Pipe.onStreamRead (internal/stream_base_commons.js:111:27)
Emitted 'error' event at:
at errorOrDestroy (internal/streams/destroy.js:107:12)
at Socket.onerror (_stream_readable.js:733:7)
at Socket.emit (events.js:198:13)
at Socket.EventEmitter.emit (domain.js:448:20)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
Here is my fluent-ffmpeg command:
let command = Ffmpeg();
command.input(StreamInput(video).url);
command.input(StreamInput(image).url);
command
.complexFilter([
{
filter: 'overlay',
options: {
enable: `between(t,${options.timestamp},${options.duration + options.timestamp})`
},
inputs: '[0:v] [1:v]',
outputs: 'video'
}
])
.outputOptions([
'-c:a copy'
])
.on('progress', function(progress) {
logger.info('Processing: ' + progress.percent + '% done @ ' + progress.currentFps + ' fps');
})
.on('end', function() {
logger.info('file has been converted successfully');
resolve('Success');
})
.on('error', function(err) {
logger.error('an error happened: ' + err.message);
reject(err);
})
.save('./s3file.mp4');
});```
The video file is an mp4 that's 24 seconds and 4mb in size. The image is a basic jpeg.
is it possible if you could help me on this? It would be very much appreciated!
Facing a similar issue. Did you manage to figure anything out?
Yes, well the solution is different from what you might expect!
Nodejs can only pass one stream to ffmpeg through piping through stdin.
Although I figured how to pass a stream as an input (you make is a readableStream), I could only do so for one input. So after some research, I came up with the idea to pass signed s3 URLs as the inputs to ffmpeg and it will itself create system level streams not affecting node!
I hope that helps, let me know if you have any other question!
@numman Can you please share your solution too as I'm having the same issue as well and could not understand what is the exact issue here