[英]NodeJS: Set path to FFMPEG binaries for module Fluent-FFMPEG
我正在构建一个使用模块node-fluent-ffmpeg的应用程序。 https://github.com/schaermu/node-fluent-ffmpeg
我正在尝试将ffmpeg二进制文件与我的应用程序一起打包。 我想这样做(特别是在Windows上),用户不必手动安装FFMPEG。
可悲的是,我尝试的一切都会导致错误。 我尝试过以下方法:
ffmpeg.setFfmpegPath : Gives an error saying setFfmpegPath is not a method
和:
proc.setFfmpegPath : Gives a createproces error.
看来我做错了什么。 有人可以指出我的错误。 非常感谢。
我修理它! 我不知道我必须在路径中包含二进制文件。 所以我做了这样的事情:
if(os.platform() === 'win32'){
var ffmpegPath = './bin/ffmpeg/ffmpeg.exe'
}else{
var ffmpegPath = './bin/ffmpeg/ffmpeg'
}
proc = new ffmpeg({ source: movieUrl, nolog: true, timeout: FFMPEG_TIMEOUT })
proc.setFfmpegPath(ffmpegPath)
proc.addOptions(opts)
proc.writeToStream(response, function(return_code, error){
在我的情况下,我已经下载了npm i -S ffmpeg-binaries~然后我将process.env.FFMPEG_PATH设置为'./node_modules/ffmpeg-binaries/bin/ffmpeg.exe'。 这对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.