0

Trying to convert a .gif to .mp4 :

var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var ffmpeg = require('fluent-ffmpeg');  

var proc = new ffmpeg({ source: 'myfile.gif' })
  .withAspect('4:3')
  .withSize('640x480')
  .applyAutopadding(true, 'white')
  .saveToFile('myfile.avi', function(stdout, stderr) {
    console.log('file has been converted succesfully');
  });

app.listen(3000, function() {  
    console.log("Server Running on 3000");
});

Getting the same error on Windows 10 and Ubuntu 14 : Error: Cannot find ffmpeg.

What is wrong with the code? Please help.

Somename
  • 3,376
  • 16
  • 42
  • 84
  • I would guess that your module `fluent-ffmpeg` is not installed properly. Report of the same error here: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/442 and https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/531 and http://stackoverflow.com/questions/32817661/error-cannot-find-ffmpeg-on-google-cloud-compute-engine-debian-wheezy-7-8-ma. All those are discussing issues with an ffmpeg executable not being in the path, but you can read them yourself for more detail. Not likely we can debug it from here. – jfriend00 Apr 03 '17 at 22:59
  • 2 of the above paths are for ffmpeg installed on the system and not through `npm`. I went thru all of them but cant figure out the issue still. Locally installed ffmpeg works fine. Its only the node module thats not working. How do i troubleshoot that ? Please help. – Somename Apr 03 '17 at 23:37
  • There is no error when I'm defining it `var ffmpeg = require('fluent-ffmpeg');` errors only when I call `var proc = ` – Somename Apr 03 '17 at 23:39
  • Included the path in system env vars and now able to find it. Getting a different error now : `ENOENTspawn C:\ffmpeg\bin\ffmpeg.exe` `at exports._errnoException (util.js:1022:11)` – Somename Apr 04 '17 at 05:18
  • There are a lot of helpful posts if you search for ENONTspawn. Here's one: http://stackoverflow.com/questions/27688804/how-do-i-debug-error-spawn-enoent-on-node-js – jfriend00 Apr 04 '17 at 05:24
  • Been thru that post. Nothing helpful for Windows env. I am doing the conversion thru Node script and really confused on how to go about it. Please help. – Somename Apr 04 '17 at 05:26
  • Some posts suggest to use exec over spawn but we dont specify anything in the ffmpeg command. – Somename Apr 04 '17 at 05:27

0 Answers0