简体   繁体   中英

NodeJs - Fluent-FFMPEG cannot find FFMPEG

Situation:

Run mp3-to-video with fluent-ffmpeg and ffmpeg on windows and nodejs. command used to startup server: nodemon server.js When starting up, it executes mp3-to-video function. Then calls fluent-ffmpeg and i debugged it down to the line where fluent-ffmpeg cannot find my ffmpeg package. I did add a couple of system variables. FFMPEG_PATH is included, PATH is included, and all the different directories like ffmpeg\\ and ffmpeg\\lib\\

I dont know what to do.. I get this error:

Error: Cannot findd ffmpeg
    at C:\Users\lexha\Desktop\nodejs\node_modules\fluent-ffmpeg\lib\processor.js:136:22
    at C:\Users\lexha\Desktop\nodejs\node_modules\fluent-ffmpeg\lib\capabilities.js:123:9
    at C:\Users\lexha\Desktop\nodejs\node_modules\async\dist\async.js:421:16
    at next (C:\Users\lexha\Desktop\nodejs\node_modules\async\dist\async.js:5302:29)
    at C:\Users\lexha\Desktop\nodejs\node_modules\async\dist\async.js:906:16
    at C:\Users\lexha\Desktop\nodejs\node_modules\fluent-ffmpeg\lib\capabilities.js:116:11
    at C:\Users\lexha\Desktop\nodejs\node_modules\fluent-ffmpeg\lib\utils.js:223:16
    at F (C:\Users\lexha\Desktop\nodejs\node_modules\which\which.js:68:16)
    at E (C:\Users\lexha\Desktop\nodejs\node_modules\which\which.js:80:29)
    at C:\Users\lexha\Desktop\nodejs\node_modules\which\which.js:89:16

You could perhabs install this node module "ffmpeg-installer/ffmpeg". You can find it here: https://www.npmjs.com/package/@ffmpeg-installer/ffmpeg

It will install ffmpeg on your system and node should be able to use it immediately.

Hope this answer helps you and other people :-)

EvilBurrito saved the day on this one. Just wanted to add, make sure use this require:

const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);

你可以运行npm i @ffmpeg-installer/ffmpeg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM