Closed nicgraner closed 4 years ago
Progress has been made! after watching a video over HOOBS camera FFMPEG, the video poster mentioned changing the vcodec from h264 to "vcodec": "copy"
, and this worked! we have reliable video feeds from all cameras other than one thats being stubborn and not wanting to show up. Im going to test notifications next, but it seems like we made a huge leap forward today!
@nicgraner Good to hear you got it working. I'll try with the copy as well and see if it's useful to mention this in the documentation.
Did you get the notifications working?
Notifications seem to be hit or miss, haven't really been able to pinpoint an exact trigger to make it work consistently, maybe just need to lower the score or something, and audio seems to be broken when I use copy, not sure why. final settings to achieve streamed video is here;
{
"platform": "Unifi-Protect-Camera-Motion",
"name": "Unifi protect cameras & motion sensors",
"unifi": {
"controller": "https://10.11.12.10:7443",
"controller_rtsp": "rtsp://10.11.12.10:7447",
"username": "",
"password": "",
"motion_interval": 5000,
"motion_repeat_interval": 30000,
"motion_score": 50,
"enhanced_motion": false,
"enhanced_motion_score": 50,
"enhanced_classes": [
"Person - or any other COCO classes, look in src/coco/classes.ts"
],
"debug": true,
"save_snapshot": true
},
"driveUpload": false,
"videoConfig": {
"vcodec": "copy",
"audio": true,
"acodec": "libopus",
"maxStreams": 1,
"maxWidth": 1280,
"maxHeight": 720,
"maxFPS": 30,
"mapvideo": "0:1",
"mapaudio": "0:0",
"maxBitrate": 1500,
"packetSize": 1376,
"debug": true,
"additionalCommandline": "-protocol_whitelist https,crypto,srtp,rtp,udp,tcp"
},
"plugin_map": {
"plugin_name": "homebridge-unifi-protect-camera-motion"
}
}
however youll notice that even with the audio codec set manually, I still don't get audio. Not sure whats causing that.
https://github.com/markus-perl/ffmpeg-build-script using this FFmpeg build script I was able to build FFMPEG and use this config to get everything working:
{
"platform": "Unifi-Protect-Camera-Motion",
"name": "Unifi protect cameras & motion sensors",
"unifi": {
"controller": "https://10.11.12.149:7443",
"controller_rtsp": "rtsp://10.11.12.149:7447",
"username": "",
"password": "",
"motion_interval": 5000,
"motion_repeat_interval": 30000,
"motion_score": 35,
"enhanced_motion": false,
"enhanced_motion_score": 35,
"enhanced_classes": [
"Person - or any other COCO classes, look in src/coco/classes.ts"
],
"debug": true,
"save_snapshot": true
},
"driveUpload": false,
"videoConfig": {
"vcodec": "h264",
"audio": true,
"maxStreams": 2,
"maxWidth": 1280,
"maxHeight": 720,
"maxFPS": 30,
"mapvideo": "0:1",
"mapaudio": "0:0",
"maxBitrate": 1500,
"packetSize": 752,
"debug": "true"
},
"plugin_map": {
"plugin_name": "homebridge-unifi-protect-camera-motion"
}
gonna keep tweaking to see if I can improve, but now im just working on fine tuning the notifications, Tensorflow seems to error out saying its using more than 10% of ram, so I disabled the motion event stuff for now
Figured we had strayed too far off the topic of "it wont install" to warrant a new issue thread. Thanks again for your continued help :)
I've been troubleshooting for a few hours now and have gotten to the point where the software doesn't exit with FFMPEG errors, but on the iPhone or iPad (tried with iPhone X, 11, and iPad Pro 11" as well as iPad 7th generation) the video stream only changes frames every 8 seconds. Almost as if it's grabbing the anonymous snaps or something lol. I attached logs from opening the stream then killing it as soon as it showed live, because otherwise the logs don't go back far enough. At the beginning you can see the error in:
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
however this occurs thousands of times at the beginning it seems. I'm not sure where to look for errors here as im not well versed in ffmpeg, and my googling doesn't really do much since im not sure what to look for.
the config I have for the plugin is as follows: