0x5e / homebridge-tuya-platform

Make homebridge-tuya-platform great again.
MIT License
222 stars 67 forks source link

Allow custom path for ffmpeg #152

Open virology2407 opened 1 year ago

virology2407 commented 1 year ago

The plugin seems to have a fixed path to ffmpeg for camera streams, which causes them to fail whenever ffmpeg is installed somewhere other than the expected directory.

From log: [@0x5e/homebridge-tuya-platform] [xxxxx] FFmpeg process creation failed: spawn ffmpeg ENOENT xxxxx

my ffmpeg binary is in /opt/local/bin and works fine with other plugins such as Homebridge Camera FFmpeg.

Would it be possible to allow users to specify where their ffmpeg binaries are? If not, where does the plugin expect to find ffmpeg?

Thanks for your support!

0x5e commented 1 year ago

Can you provide logs with debug mode on? then we can see the whole failed command. I think first we need to know why the failure happends, if it can be fixed, there's no need to custom ffmpeg path.

ErrorErrorError commented 1 year ago

The plugin seems to have a fixed path to ffmpeg for camera streams, which causes them to fail whenever ffmpeg is installed somewhere other than the expected directory.

From log: [@0x5e/homebridge-tuya-platform] [xxxxx] FFmpeg process creation failed: spawn ffmpeg ENOENT xxxxx

my ffmpeg binary is in /opt/local/bin and works fine with other plugins such as Homebridge Camera FFmpeg.

Would it be possible to allow users to specify where their ffmpeg binaries are? If not, where does the plugin expect to find ffmpeg?

Thanks for your support!

@virology2407

This plugin does not use the system installed ffmpeg, unless if it cannot download the ffmpeg within the plugin. It includes its own ffmpeg binary but I am not sure why it's not finding it. It should fallback to the system's ffmpeg, assuming that it's in the user's PATH.

What operating system do you use??

virology2407 commented 1 year ago

Hey all, sorry for the delay.

Here's the debug output:

[12/17/2022, 10:07:40 PM] [@0x5e/homebridge-tuya-platform] [xxxxx] Stream command: ffmpeg -hide_banner -loglevel verbose -i rtsps://id:password@aws-tractor2.tuyaus.com:443/v1/proxy/echo_show/token -an -sn -dn -r 30 -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -f rawvideo -preset ultrafast -tune zerolatency -b:v 299k -payload_type 99 -ssrc 8929345 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params token srtp://ipaddress:49743?rtcpport=49743&pkt_size=1316 -vn -sn -dn -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -ac 1 -payload_type 110 -ssrc 5547413 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params token srtp://ipaddress:59644?rtcpport=59644&pkt_size=188 -progress pipe:1 xxxxx true
[12/17/2022, 10:07:40 PM] [@0x5e/homebridge-tuya-platform] [xxxxx] FFmpeg process creation failed: spawn ffmpeg ENOENT xxxxx
[12/17/2022, 10:07:40 PM] [@0x5e/homebridge-tuya-platform] [xxxxx] Stopped video stream. xxxxx

@ErrorErrorError - I'm on macOS 10.13.6. With the information you shared about how the plugin looks for ffmpeg, I symlinked ffmpeg to /usr/bin. I installed ffmpeg with macports, which defaults to /opt/local/bin instead. That fixed the ENOENT error, but I was met with a new one: FFmpeg exited with code: 1 and signal: null (Error) xxxxx

This however seems to be a me problem, as entering the ffmpeg command the plugin is making directly into the Terminal also errors out.

0x5e commented 1 year ago

After symlink, can you try copy the commands from log Stream command: xxx and running manually, there maybe more output.

And do you have the latest camera firmware? My camera didn't work but after upgrade, stream succeed.