node.js - 错误 : "Cannot Find FFMPEG" on Google Cloud Compute Engine Debian Wheezy 7. 8 托管实例,即使它已安装

标签 node.js ffmpeg debian google-compute-engine

我编写了一个使用 fluent-ffmpeg 的 Node.JS 应用程序。模块为上传到平台的视频加水印。我将代码推送到我的 Google Cloud Compute Engine 项目,每次我得到 Error : Cannot Find FFMPEG .创建实例后,我通过 ssh 进入实例并运行这些命令来安装 FFMPEG在实际测试代码之前。我不确定是什么导致了错误,因为在此之后我肯定 FFMPEG已安装。

sudo apt-get update
sudo apt-get install -y ffmpeg
export FFMPEG_PATH="/usr/bin/ffmpeg"
export FFPROBE_PATH="/usr/bin/ffprobe"

下面是我的 FFMPEG 代码
function generate_thumbnail(name, path){
  logging.info("Generating Thumbnail");
  ffmpeg(path)
   .setFfmpegPath('/usr/bin/ffmpeg') 
   .setFfprobePath('/usr/bin/ffprobe')
   .on('end', function() {
        upload_thumbnail(name);
        logging.info("Thumbnail Generated and uploaded");
        return;
    })
  .on('error', function(err, stdout, stderr) {
        logging.info('ERROR: ' + err.message);
        logging.info('STDERR:' + stderr);
  })
  .on('start', function(commandLine) {
       logging.info(commandLine);
  })
  .screenshots({
    count: 1,
    filename: name + '_thumbnail.png',
    folder: 'public/images/thumbnails/'
  });
}

最佳答案

可以执行/usr/bin/ffmpeg从外壳验证它是否是正确的路径?

您也可以使用 setFfmpegPath 手动设置 FFMPEG 二进制文件的路径。方法。

关于node.js - 错误 : "Cannot Find FFMPEG" on Google Cloud Compute Engine Debian Wheezy 7. 8 托管实例,即使它已安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32817661/

相关文章:

Perl 命令更改文件 EOL 并以相同名称保存文件

node.js - 尽管绑定(bind)了 ip,但在本地网络中无法访问 MongoDB 服务器

video - 如何连接具有不同属性的ffmpeg中的视频?

Android ffmpeg 在第二次运行时失败

Debian 8 上的 Python numba/llvmlite - 我无法构建 llvmlite

linux - cppcms - 共享库 - Linux

windows - cygwin 中的 Node 解释器 KO?

javascript - 无法使用 node.js 运行 appjs 示例应用程序

python - 刷新链接到nodeJS的python文件

video - 在ffmpeg中设置cpu线程