我编写了一个使用 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/