Question

I am building a application that uses the module node-fluent-ffmpeg. https://github.com/schaermu/node-fluent-ffmpeg

And I'm trying to package the ffmpeg binaries along with my application. I want to do this so (especially on Windows) the user does not have to install FFMPEG manually.

Sadly everything I've tried results in errors. I've tried the following:

  ffmpeg.setFfmpegPath   : Gives an error saying setFfmpegPath is not a method

and:

  proc.setFfmpegPath    : Gives a createproces error.

It seems I'm doing something wrong. Could someone point out my mistake. Thanks a lot.

Was it helpful?

Solution

I fix it! I did not know I had to include the binary itself in the path. So I made something like this:

  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){

OTHER TIPS

In my case I have downloaded the npm i -S ffmpeg-binaries~ and after that I just set the process.env.FFMPEG_PATH to './node_modules/ffmpeg-binaries/bin/ffmpeg.exe'. This worked for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top