Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: read ECONNRESET #1

Open
numman opened this issue Mar 10, 2020 · 3 comments
Open

Error: read ECONNRESET #1

numman opened this issue Mar 10, 2020 · 3 comments

Comments

@numman
Copy link

numman commented Mar 10, 2020

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!
@tarrencev
Copy link

Facing a similar issue. Did you manage to figure anything out?

@numman
Copy link
Author

numman commented Mar 25, 2020

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!

@wnabil
Copy link

wnabil commented Dec 2, 2021

@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

Repository owner deleted a comment from adewalee-bot Feb 23, 2024
Repository owner deleted a comment from adewalee-bot Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants