【问题标题】:Unable to convert files with fluent-ffmpeg无法使用 fluent-ffmpeg 转换文件
【发布时间】:2023-03-19 21:50:01
【问题描述】:

我用npm install fluent-ffmpeg 安装了fluent-ffmpeg,并验证了它在节点模块中的存在。如果我将它包含在服务器var ffmpeg = require('fluent-ffmpeg'); 中,则没有错误但是当我使用它将目录中的.gif 文件转换为.mp4 时,它会引发错误: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

【问题讨论】:

    标签: node.js ffmpeg fluent-ffmpeg


    【解决方案1】:

    报错是node-fluent找不到ffmpeg,使用which获取ffmpeg的路径,加上这一行:

    ffmpeg.setFfmpegPath('Path\\to\\ffmpeg');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-03
      • 2021-02-19
      • 1970-01-01
      • 2019-02-24
      • 2017-11-10
      • 2017-12-07
      • 2011-08-14
      相关资源
      最近更新 更多