Code Guru
Code Guru

Reputation: 15598

cannot find ffmpeg in videoshow in nodejs

I want to create video from image files. So I have installed videoshow module. And configured the same as per the documentaion.

var videoOptions = {
  fps: 25,
  loop: 5, // seconds 
  transition: true,
  transitionDuration: 1, // seconds 
  videoBitrate: 1024,
  videoCodec: 'libx264',
  size: '640x?',
  audioBitrate: '128k',
  audioChannels: 2,
  format: 'mp4',
  pixelFormat: 'yuv420p'
}

var images = [
  "D:/PROJECTS/Video/storage/1.jpg",
  "D:/PROJECTS/Video/storage/2.jpg"
];

app.get("/video", function () {
  videoshow(images, videoOptions)
    // .audio('song.mp3')
    .save('video.mp4')
    .on('start', function (command) {
      console.log('ffmpeg process started:', command)
    })
    .on('error', function (err, stdout, stderr) {
      console.error('Error:', err)
      console.error('ffmpeg stderr:', stderr)
    })
    .on('end', function (output) {
      console.error('Video created in:', output)
    })
});

But When I run it shows the error on server

Error: Error: Cannot find ffmpeg
    at D:\PROJECTS\Video\node_modules\videoshow\node_modules\fluent-ffmpeg\lib\processor.js:136:22
    at D:\PROJECTS\Video\node_modules\videoshow\node_modules\fluent-ffmpeg\lib\capabilities.js:123:9
    at D:\PROJECTS\Video\node_modules\videoshow\node_modules\async\dist\async.js:473:16
    at next (D:\PROJECTS\Video\node_modules\videoshow\node_modules\async\dist\async.js:5315:29)
    at D:\PROJECTS\Video\node_modules\videoshow\node_modules\async\dist\async.js:958:16
    at D:\PROJECTS\Video\node_modules\videoshow\node_modules\fluent-ffmpeg\lib\capabilities.js:116:11
    at D:\PROJECTS\Video\node_modules\videoshow\node_modules\fluent-ffmpeg\lib\utils.js:223:16
    at F (D:\PROJECTS\Video\node_modules\videoshow\node_modules\which\which.js:68:16)
    at E (D:\PROJECTS\Video\node_modules\videoshow\node_modules\which\which.js:80:29)
    at D:\PROJECTS\Video\node_modules\videoshow\node_modules\which\which.js:89:16

Then I installed ffmpeg using

npm install ffmpeg --save

but not worked. So I tried installing at the global level using

npm install ffmpeg -g

Even installing on my window machine and setting the path of its bin folder in environment variables did not work?

What could be the issue?

Upvotes: 1

Views: 4234

Answers (2)

Himanshu
Himanshu

Reputation: 89

npm i videoshow Just use this command

Upvotes: 1

Code Guru
Code Guru

Reputation: 15598

Actually, I need to instal the ffmpeg in my system and set it to the environment path variable.

And you don't need to install in nodejs.

Upvotes: 2

Related Questions