简体   繁体   English

NodeJs - Fluent-FFMPEG 找不到 FFMPEG

[英]NodeJs - Fluent-FFMPEG cannot find FFMPEG

Situation:情况:

Run mp3-to-video with fluent-ffmpeg and ffmpeg on windows and nodejs.在 windows 和 nodejs 上使用 fluent-ffmpeg 和 ffmpeg 运行 mp3-to-video。 command used to startup server: nodemon server.js When starting up, it executes mp3-to-video function.用于启动服务器的命令: nodemon server.js 启动时执行mp3-to-video功能。 Then calls fluent-ffmpeg and i debugged it down to the line where fluent-ffmpeg cannot find my ffmpeg package.然后调用 fluent-ffmpeg 并将其调试到 fluent-ffmpeg 找不到我的 ffmpeg 包的行。 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\\包含 FFMPEG_PATH,包含 PATH,以及所有不同的目录,如 ffmpeg\\ 和 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".您可以安装此节点模块“ffmpeg-installer/ffmpeg”。 You can find it here: https://www.npmjs.com/package/@ffmpeg-installer/ffmpeg你可以在这里找到它: https : //www.npmjs.com/package/@ffmpeg-installer/ffmpeg

It will install ffmpeg on your system and node should be able to use it immediately.它将在您的系统上安装 ffmpeg,节点应该能够立即使用它。

Hope this answer helps you and other people :-)希望这个答案能帮助你和其他人:-)

EvilBurrito saved the day on this one. EvilBurrito 挽救了这一天。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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