Unable to convert files with fluent-ffmpeg

不问归期 提交于 2019-12-11 07:18:25

问题


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

My code :

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');
  });

What am I doing wrong? I want to convert the .gif to .mp4


回答1:


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');


来源:https://stackoverflow.com/questions/43176748/unable-to-convert-files-with-fluent-ffmpeg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!