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

Requested output format 'singlejpeg' is not a suitable output format #87

Open clck-dr opened 1 year ago

clck-dr commented 1 year ago

Hej,

I got an error from ffmpeg. It seams that ffmpeg no longer supports singlejpeg output format. I refactored to image2 and everything works fine. Could you check and fix this issue?

Here is my implementation.

app.get("/*", (req, res) => {
  if (req.params[0].includes("thumbnails")) {
    const file = path.resolve(__dirname, "content", req.params["0"].slice(11));
    genThumbnail(file, res, "320x?", {
      path: ffmpeg.path,
      //args: ["-f","image2"]
    })
      .then((res) => console.log(res))
      .catch((err) => console.error(err));
  } else {
    res.sendFile(path.resolve(__dirname, "content", req.params["0"]));
  }
});

I also tried to override ffmpeg args with config.args but that crashes.

Thank you in advance. Daniel