homebridge-camera-ffmpeg-ufv
homebridge-camera-ffmpeg-ufv copied to clipboard
Live Streaming
Was hoping this supports live stream. It streams in the Unifi Video iOS app so I know streaming is active. I get an error when you click on the camera thumbnail it generates when you open home app for live streaming. "No Response This camera is not responding". I found out that the homebridge service is crashing when I click on the video. I've included the debug log for it.
My config below.
{ "bridge": { "name": "Defconn", "username": "redacted", "port": 51826, "pin": "redacted" }, "accessories": [{ "accessory": "Onkyo", "name": "Stereo", "ip_address": "192.168.29.141", "model": "TX-NR1009", "poll_status_interval": "900", "default_input": "net", "default_volume": "10", "max_volume": "35", "map_volume_100": true }], "platforms": [{ "platform": "SmartThings", "name": "SmartThings", "app_url": "https://graph-na04-useast2.api.smartthings.com:443/api/smartapps/installations/", "app_id": "f29b1c0e-36bf-4502-9fbd-2decbfffc571", "access_token": "redacted", "polling_seconds": 3600, "update_method": "direct", "direct_ip": "192.168.29.137", "direct_port": 8000, "api_seconds": 30 }, { "platform": "camera-ffmpeg-ufv", "name": "UniFi Video", "nvrs": [{ "apiHost": "192.168.29.172", "apiPort": 7443, "apiProtocol": "https", "apiKey": "redacted" }] } ] }
Any output at the time the crash? Anything reporting ENOENT?
I didn't find anything reporting ENOENT. I didn't receive any output on the home app but I suspecting your referring to output logging on the homekit side. I attached everything from the logs that I saw in the file above but nothing that gives me any inclenation as to whats going on. Would you have any recomendations for where or what logs to look at on the NVR? I checked the /var/log/unifi-video folder and read through those logs. Didn't find anything that would really even align with the timeline of the outbound request. I'm guessing there is a way to turn on debug logging on the NVR to maybe capture more data. Next stop is to maybe try wireshark but I have a feeling I'm not going to sniff out much considering its on ssl.
I have tried opening the stream via quicktime thats in the logs via with http:// and https:// and RTSP:// with the following url from the logs for the stream. 192.168.29.167:7447/5a5d8b324f0cfa9a9b8b4435_0?apiKey=W5Jha9rfZzzcY9SHolNXHd98DBk0UC69
It give me an error that the 5a5d8b324f0cfa9a9b8b4435_0 could not be opened. I'm not sure since this is all hashed if your decrypting the url that is sent to get the stream for viewing or if that should load. From what I've read online if the camera is in standalone mode you can stream the RTSP video feed using quicktime but since this has API credentials and is being streamed from the NVR I'm sure its a different ball game .
Im having the same issue. Here's the debug output at the time, which is reliably reproducible when I try to open a camera on iOS:
StreamController Write SelectedStreamConfiguration +0ms -rtsp_transport http -re -i rtsp://172.27.7.23:7447/578098e1e4b0680ca0eebfec_1?apiKey=xxxxx -threads 0 -vcodec libx264 -an -pix_fmt yuv420p -r 15 -f rawvideo -tune zerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params jFjU3BqKL6xVtTWPFwCiq8lgZiVWdJQFDxhdCMRO srtp://172.16.200.176:49995?rtcpport=49995&localrtcpport=49995&pkt_size=1378 EventedHTTPServer [::ffff:172.16.200.176] Sending HTTP event '1.22' with data: {"characteristics":[{"aid":1,"iid":22,"value":"AQEB"}]} +6ms EventedHTTPServer [::ffff:172.16.200.174] Sending HTTP event '1.22' with data: {"characteristics":[{"aid":1,"iid":22,"value":"AQEB"}]} +1ms EventedHTTPServer [::ffff:172.16.200.184] Sending HTTP event '1.22' with data: {"characteristics":[{"aid":1,"iid":22,"value":"AQEB"}]} +0ms EventedHTTPServer [::ffff:172.16.200.150] Sending HTTP event '1.22' with data: {"characteristics":[{"aid":1,"iid":22,"value":"AQEB"}]} +0ms EventedHTTPServer [::ffff:172.16.200.176] Sending HTTP event '1.22' with data: {"characteristics":[{"aid":1,"iid":22,"value":"AQEB"}]} +1ms EventedHTTPServer [::ffff:172.16.200.174] Sending HTTP event '1.22' with data: {"characteristics":[{"aid":1,"iid":22,"value":"AQEB"}]} +0ms EventedHTTPServer [::ffff:172.16.200.184] Sending HTTP event '1.22' with data: {"characteristics":[{"aid":1,"iid":22,"value":"AQEB"}]} +1ms EventedHTTPServer [::ffff:172.16.200.150] Sending HTTP event '1.22' with data: {"characteristics":[{"aid":1,"iid":22,"value":"AQEB"}]} +0ms events.js:112 throw er; // Unhandled 'error' event ^
Error: spawn ffmpeg ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19) at onErrorNT (internal/child_process.js:379:16) at process._tickCallback (internal/process/next_tick.js:114:19)
My config is attached below, too.
{ "bridge": { "name": "Homebridge", "username": "xxx", "port": 51826, "pin": "xxx" },
"accessories":[{ "accessory":"DummySwitch", "name":"Dumb Switch 1", "stateful": true },{ "accessory":"OpenweathermapTemperature", "name":"Outside Temperature", "url":"http://api.openweathermap.org/data/2.5/weather?q=78753&appid=xxx"
}],
"platforms": [ {
"platform": "camera-ffmpeg-ufv", "name": "UniFi Video", "nvrs": [ { "apiHost": "172.27.7.23", "apiPort": 7443, "apiProtocol": "https", "apiKey": "xxx" } ] }
]
}
I resolved this by removing ffmpeg installed by npm,
sudo npm remove -g ffmpeg
and re-installing ffmpeg thru APT.
sudo apt-get install ffmpeg
I'm running this on Ubuntu 16.04...
I'm trying to run this in a Docker container and the image updates in the home app, however the video will not play. Any ideas?
im having this very issue. I see the thumbnails, they update, but when selecting any of my camera streams, it hangs about 30 seconds than errors with "no response, this camera is not respnding ". I tried the fix above to remove ffmpeg from npm and install via apt but it did not help.
any help on this @gozoinks ? I am running homebridge on ubuntu 16.04 LTS. I am happy to provide any info that will assist. When I select a stream in the Home app, this appears in the Homebridge logs "-rtsp_transport http -re -i rtsp://10.5.5.10:7447/5ae3b22dddf466856c275490_0?apiKey=6PG1wmYTwouig8hYYaIPqcmWHeTVJjuR -threads 0 -vcodec libx264 -an -pix_fmt yuv420p -r 15 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params UHWx2+cYmdbIYoRl86ItilJuz0irXnbVmIfi9ehz srtp://10.5.5.115:62018?rtcpport=62018&localrtcpport=62018&pkt_size=1378"
However, the stream just sits at "loading" than times out.
so, I troubleshot further and just found that my live streams work in homekit, and update to "live", if I disconnect from Wifi. On LTE they are working, which is strange because my Unifi firewall of course allows all traffic from LAN > LAN .Anyhow, I created an additional subnet, and set my wifi to use it and somehow this has worked. For example, homebridge, and my unifi controler are on the 10.5.5.x net and my Wifi was as well but that did not work, adjusting my wifi to use 10.7.7.x has made this work. I am not sure how helpful that is but of course my current setup is not ideal .
My issue can be closed. Homebridge/cameraffmpegufv began working on my 10.5.5.x LAN both remote/local. Not sure about @ryan99alero though
Did anyone come up with a solution for this while running a docker container with Ubuntu?
I'm getting the same error:
-rtsp_transport http -re -i rtsp://10.0.1.XXX:7447/5abc5fcde4b0d8bcd93af0e3_1?apiKey=QrN6k0odRShqPHPLVOwHfl5ScCioADno -threads 0 -vcodec libx264 -an -pix_fmt yuv420p -r 15 -f rawvideo -tune zerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 3277658 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params /eg98OxNVn8VIs0eoHb9tQw0hZYr8HWX58v2fkKQ srtp://10.0.1.XXX:61864?rtcpport=61864&localrtcpport=61864&pkt_size=1378 events.js:183 throw er; // Unhandled 'error' event ^
Error: spawn ffmpeg ENOENT at _errnoException (util.js:992:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19) at onErrorNT (internal/child_process.js:372:16) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)
@erfind I had it working at one point on 16.04 in Docker, but broke it while trying to add audio. It's reliant on the correct libraries being added to FFmpeg. I have audio working from my Mac, but not my Linux box. Hoping to get back to it one of these weekends.
Hi all
I have the same issue of erfind, I've installed NVR on Docker and the RTSP url is the internal IP of the Docker's network. When the homekit app tries to stream the video I have an error, because this IP address is not accessible from my wifi. There is any way to pass an FQDN from the config to rewrite the IP address on the URL?
I was asking on UBNT forums, and there is no way to change the RSTP url from the UBNT application Thanks in advance
I believe you need to use the same network across the containers that need to communicate with each other. You can use the host network to simplify things a bit. This should allow the two containers to talk to each other.
https://docs.docker.com/network/host/
@erfind I have this running in a docker container with live streaming working. I'm using this docker image for homebridge: https://github.com/oznu/docker-homebridge
You drop all files from your .homebridge
into the config folder mounted for the volume below.
Here is my docker-compose.yml
:
version: '2'
services:
homebridge:
image: oznu/homebridge:debian
restart: always
network_mode: host
environment:
- TZ=America/Indianapolis
- PGID=1000
- PUID=1000
- PACKAGES=ffmpeg
volumes:
- ./config:/homebridge
Here is my config/package.json
. You can add whatever plugins you need inside of the dependencies object.
{
"dependencies": {
"homebridge-camera-ffmpeg-ufv": "^0.7.1"
},
"name": "docker-homebridge",
"version": "1.0.0",
"main": "index.js",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": ""
}
Cool I will give it a go! Thanks!
Sent from my iPhone
On Jun 16, 2018, at 15:29, Austin Drummond [email protected] wrote:
@erfind I have this running in a docker container with live streaming working. I'm using this docker image for homebridge: https://github.com/oznu/docker-homebridge
You drop all files from your .homebridge into the config folder mounted for the volume below.
Here is my docker-compose.yml:
version: '2' services: homebridge: image: oznu/homebridge:debian restart: always network_mode: host environment: - TZ=America/Indianapolis - PGID=1000 - PUID=1000 - PACKAGES=ffmpeg volumes: - ./config:/homebridge Here is my config/package.json. You can add whatever plugins you need inside of the dependencies object.
{ "dependencies": { "homebridge-camera-ffmpeg-ufv": "^0.7.1" }, "name": "docker-homebridge", "version": "1.0.0", "main": "index.js", "devDependencies": {}, "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "author": "", "license": "ISC", "description": "" } — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
New to Home Assistant / Homebridge, currently running on hass.io...... I was never successful at "homebridge-camera-ffmpeg" or the "omx" version, but was successful at intermittent screen shots with the "ufv" version. I have the same issue that the Home app shows 10 second-old screen shots and not actual live video. Hoping for a fix!
Mine works after a lot of messing around and installing different packages. It’s been awhile and I currently don’t have the time to reverse engineer what I did to fix it. But is somebody wants to ask me to run commands or give config info I can do that. I believe it had to do with install the right packages and maybe a little to do with the camera stream url if I’m remembering correctly. I’ll check what distro I’m running.
Sent from my iPhone
On Jun 20, 2018, at 1:44 AM, danTHAman152000 [email protected] wrote:
New to Home Assistant / Homebridge, currently running on hass.io...... I was never successful at "homebridge-camera-ffmpeg" or the "omx" version, but was successful at intermittent screen shots with the "ufv" version. I have the same issue that the Home app shows 10 second-old screen shots and not actual live video. Hoping for a fix!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I'm having this same problem, everything works and Cams are discovered, but I only get a screenshot, once I click on the feed it stays Loading and just updates with the screenshot every few seconds, I never get continous streaming.
I get this message in the log:
-rtsp_transport http -re -i rtsp://192.168.15.2:7447/5ae7911ee4b0ec40d6ec480b_1?apiKey=REDACTED -threads 0 -vcodec libx264 -an -pix_fmt yuv420p -r 15 -f rawvideo -tune zerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 4875182 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params Xv2GrIRvNgdTkUlsQ9RMTuUGw5gHC1q6K7ARk5Ae srtp://192.168.15.46:57851?rtcpport=57851&localrtcpport=57851&pkt_size=1378
I imagine I could try reducing packet size to 378, but since I am using Hassio I have no idea how to modify it. Any ideas/suggestions?
I am having the exact same issue that @papacrown listed here as well.
I have ffmpeg from apt-get and I cannot view live streams from the cameras, but the screenshots update on a regular basis.
I am also having this problem any fix?
Good day. I'm using the HomeApp on my iPhone. Live stream never appears to work. I get a thumbnail then a counter counting up how many seconds ago the snapshot was taken. If I exit the view the snapshot is updated again. VLC plays my livestream fine.
Homebridge is running on MacOS (10.13.6)
{ "platform": "Camera-ffmpeg", "cameras": [ { "name": "UniFi G3 Flex", "videoConfig": { "source": "-rtsp_transport tcp -re -i rtsp://192.168.2.22:7447/5bc8fc2dec2e7891b822aff5_2", "maxStreams": 2, "maxWidth": 1280, "maxHeight": 720, "maxFPS": 30 } } ] }
Any thoughts?
@brianerdelyi
Try this:
{
"platform": "Camera-ffmpeg",
"cameras": [
{
"name": "UniFi G3 Flex",
"videoConfig": {
"source": "-rtsp_transport http -re -i rtsp://192.168.2.22:7447/5bc8fc2dec2e7891b822aff5_2",
"maxStreams": 2,
"maxWidth": 1280,
"maxHeight": 720,
"maxFPS": 30
}
}
]
}
Will do. And I'm sorry, that was supposed to be posted on the other issue log.
If that didn't work, run ffmpeg
from terminal or equivalent. It should spit out the ffmpeg configuration. Mine spits out this:
ffmpeg version 3.4.4 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.4.0 (Alpine 6.4.0)
configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-librtmp --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --enable-vaapi --enable-vdpau --enable-libopus --disable-debug
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
What does yours say?
No change using HTTP. I had previously tried it without that flag as well.
FFMPEG shows:
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
Looks like there are some differences between our two installs. I'm not sure which one is the relevant one, but it may be worth installing all options for ffmpeg. I'm assuming you're using homebrew. Try the following:
Uninstall ffmpeg:
brew uninstall ffmpeg
Reinstall ffmpeg with every option (this will take some time):
brew install ffmpeg $(brew options ffmpeg | grep -v -e '\s' | grep -e '--with-\|--HEAD' | tr '\n' ' ')
Source: https://gist.github.com/clayton/6196167#gistcomment-2710005
hmmm. it did take some time. still no change. I'm restarting homebridge as well. It's just the live stream isn't working. Constantly has loading but no updates.