Home > Enterprise >  ffmpeg module saving not working after compression
ffmpeg module saving not working after compression

Time:08-28

I'm just trying to save an mp4 to a different mp4 (before I even start playing around with the different compression settings). What exactly is going wrong here?

const ffmpeg = require('ffmpeg');

try {
    var process = new ffmpeg('./original.mp4');
    process.then(function (video) {
        video
        .save('./new.mp4', function (error, file) {
            if (!error) {
                console.log('Video file: '   file);
            } else {
                console.log(error)
            }
        });
    }, function (err) {
        console.log('Error: '   err);
    });
} catch (e) {
    console.log(e.code);
    console.log(e.msg);
}

I get the following error:

Error: Command failed: ffmpeg -i ./original.mp4  ./new.mp4
/bin/sh: ffmpeg: command not found

    at ChildProcess.exithandler (child_process.js:390:12)
    at ChildProcess.emit (events.js:400:28)
    at maybeClose (internal/child_process.js:1055:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {
  killed: false,
  code: 127,
  signal: null,
  cmd: 'ffmpeg -i ./original.mp4  ./new.mp4'
}

CodePudding user response:

It seems that the library you're using tries to call an ffmpeg executable but cannot find it.

  • Related