无法使用流畅的ffmpeg转换文件 [英] Unable to convert files with fluent-ffmpeg
问题描述
我使用 npm安装fluent-ffmpeg安装fluent-ffmpeg
并验证了它在节点模块中的存在。没有错误,如果我将它包含在服务器中 var ffmpeg = require('fluent-ffmpeg');
但是当我使用它来转换目录中的.gif
文件到 .mp4
中会引发错误:错误:找不到ffmpeg
I installed fluent-ffmpeg with npm install fluent-ffmpeg
and verified its present in the node-modules. There is no error if I include it in the server var ffmpeg = require('fluent-ffmpeg');
But when I use it to convert a .gif
file in the directory to .mp4
it throws an error : Error: Cannot find ffmpeg
我的代码:
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var ffmpeg = require('fluent-ffmpeg');
var proc = new ffmpeg({ source: '/uploads/myfile.gif' })
.usingPreset('podcast')
.saveToFile('/uploads/mynewfile.mp4', function(stdout, stderr) {
console.log('file has been converted succesfully');
});
我做错了什么?我想将 .gif
转换为 .mp4
What am I doing wrong? I want to convert the .gif
to .mp4
推荐答案
错误是node-fluent找不到ffmpeg,使用哪个
获取ffmpeg的路径,并添加此行:
The error is that node-fluent can't find ffmpeg, use which
to get the path of ffmpeg, and add this line:
ffmpeg.setFfmpegPath('Path\\to\\ffmpeg');
这篇关于无法使用流畅的ffmpeg转换文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!