gozoinks / homebridge-camera-ffmpeg-ufv

UniFi Video plugin for Homebridge
https://www.npmjs.com/package/homebridge-camera-ffmpeg-ufv
Other
75 stars 20 forks source link

Error: spawn ffmpeg ENOENT #46

Open kgrammatis opened 4 years ago

kgrammatis commented 4 years ago

Hi! Thank you for this wonderful plugin. I just tried installing it the cameras show up!

However, whenever I try to access a stream, homebridge crashes and reboots. The error is as follows: Error: spawn ffmpeg ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) at onErrorNT (internal/child_process.js:456:16) at processTicksAndRejections (internal/process/task_queues.js:81:21)

It seems this means that ffmpeg hasn't been found, but I've installed it per your instructions: npm install -g ffmpeg

I can also confirm that ffmpeg exists in the npm/node_modules/ffmpeg directory.

I'm running node.js on a windows 10 machine. Perhaps there's some issue there? Please advise. Thank you!!

kgrammatis commented 4 years ago

I think I'm getting closer...

  1. installing ffmpeg on Windows 10 is a little more detailed than just adding the package on a linux machine. Here's a good how to: https://windowsloop.com/install-ffmpeg-windows-10/

  2. It seems that even though I've made the correct path to ffmpeg by creating an environmental variable (I can test this by typing ffmpeg in a command prompt and it works) the plugin still can't find ffmpeg.

  3. It seems this an an (old ) issue in the original fork of homebridge-camera-ffmpeg. You can read about that here: https://github.com/KhaosT/homebridge-camera-ffmpeg/issues/160

  4. homebridge-camera-ffmpeg fixed this by adding a variable called VideoProcessor which would direct the plugin to the location of ffmpeg. Users could put the variable in their config file like this:

"videoProcessor": "\ffmpeg.exe"

  1. After looking through homebridge-camera-ffmpeg-ufv codebase it seems that the VideoProcessor variable has been removed so I can't point directly to where ffmpeg is anymore.

  2. I'm not a coder by any stretch of the imagination however, and my knowledge (unfortunately) ends here. Can we add VideoProcessor back into this fork so I can manually point to where ffmpeg is located on a windows machine?

kgrammatis commented 4 years ago

...not a coder but managed to cross reference all the instances of 'VideoProcessor' in homebridge-camera-ffmpeg and add them back into the UFV version. Pain in the ass, but it ACTUALLY WORKED. Now how do I make a pull request? ...gonna have to google that one as well.

So in conclusion:

  1. Download ffmpeg.exe and drop it in your C:\ directory
  2. Use a version of homebridge-camera-ffmpeg-ufv that includes the 'VideoProcessor' variable.
  3. add "videoProcessor": "C:\ffmpeg.exe", to your config file.

...now how to get my audio streams to work hmmm.

drcjcarr commented 4 years ago

@kgrammatis Can you upload the new JS file that you made by pulling the old VideoProcessor function in? I'm not a coder either and not sure all the things I need to pull. I brought over all 6 areas that I could see and made a few changes but its crashing my homebridge, so keep having to revert back to original. Thank you!