philipjscott / simple-thumbnail

A library that produces thumbnails from images, videos and URLs :mag_right:
https://www.npmjs.com/package/simple-thumbnail
MIT License
25 stars 14 forks source link

Getting Error: write EPIPE #83

Open tention opened 3 years ago

tention commented 3 years ago

Describe the bug Trying to generate the thumbnail using a buffer, so what i did was:

  1. Adding faststart so it works on mov and mp4 file
  2. Convert it to Readable before parsing to genThumbnail
  3. The thumbnail was generated at /tmp/test.jpg, however i'm getting following error that terminated my nodejs application.
Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:94:16)
done!
✨  Done in 12.80s.

To Reproduce Code snippet or repository link that reproduces the error:

const ffmpeg = require('ffmpeg-static');
const { faststart } = require('moov-faststart');
const genThumbnail = require('simple-thumbnail');
const { Readable } = require('stream');

          try {
            genThumbnail(Readable.from(faststart(file.buffer)), '/tmp/test.jpg', '150x?', {
              path: ffmpeg.path
            })
              .then(() => console.log('done!'))
              .catch(err => console.error(err));

          } catch (e) {
            console.log(e);
          }

Environment (please complete the following information):

Additional context Add any other context about the problem here.