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

ffmpeg Issue #74

Closed pratibha05sharma09 closed 3 years ago

pratibha05sharma09 commented 3 years ago

Describe the bug I am getting error ffmpeg: not found

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

const simple-thumbnail = require('simple-thumbnail')

// Do stuff that breaks things!


    .then(() => console.log('done!'))
    .catch(err => console.error(err))
```js

**Expected behavior**
An image will produce will name path.png but getting error  ffmpeg: not found. I also installed `ffmpeg-static` module.

**Environment (please complete the following information):**
 - OS: [e.g. Linux x64]
 - Version (ffmpeg): [e.g. 4.0.2]
 - Linking: [e.g. Static]

**Additional context**
Add any other context about the problem here.
philipjscott commented 3 years ago

You need to pass in path in the options:

const ffmpeg = require('ffmpeg-static')
const genThumbnail = require('simple-thumbnail')

async function download () {
  await genThumbnail('https://www.w3schools.com/Html/mov_bbb.webm', 'bunny.webm', '150x?', {
    path: ffmpeg.path
  })

  console.log('Done!')
}

download()
philipjscott commented 3 years ago

Let me know if that works for you!

pratibha05sharma09 commented 3 years ago

Let me know if that works for you!

Hello @ScottyFillups , Thanks for your response. I tried the solution provided by you. `const ffmpeg = require('ffmpeg-static') const genThumbnail = require('simple-thumbnail')

async function download () { await genThumbnail('https://www.w3schools.com/Html/mov_bbb.webm', 'bunny.webm', '150x?', { path: ffmpeg.path })

console.log('Done!') }

download()`

But still getting the error ffmpeg: not found . To implement this functionality, I have to install the ffmpeg on my server with command sudo apt-get install ffmpeg. Please let me know, to do this without installing it on the server.

philipjscott commented 3 years ago

Ah! It seems that the ffmpeg-static changed. https://www.npmjs.com/package/ffmpeg-static

This code should work:

const ffmpegPath = require('ffmpeg-static')
const genThumbnail = require('simple-thumbnail')

async function download () {
  await genThumbnail('https://www.w3schools.com/Html/mov_bbb.webm', 'bunny.webm', '150x?', {
    path: ffmpegPath
  })
}

download().then(() => console.log('done'))
philipjscott commented 3 years ago

Let me know if that works!

pratibha05sharma09 commented 3 years ago

@ScottyFillups Thanks for your response. Yes the above code is working fine.