-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FFMPEG streaming issues #62
Comments
My config that is working with 0.4.1 on my RBPI 4 with latest homebridge/config-ui-x and node 12.x
If not running on a RBPI replace the h264_omx with h264 |
Hi, I can't start streams (ffmpeg exit code 1), but snapshots are working fine. UniFi setup:
Hardware setup:
Software setup:
Homebridge logs with debugging on in plugin
^you can see there's one crash in there an one timeout Result in Home app (note: this is on Bug Sur beta, but same happens on iOS non-beta and macOS Catalina) ffmpeg details
|
@madrobby Maybe there is an issue when ffmpeg is installed, I'll try to get a special debug build together for the ffmpeg issues so we dan do some further digging. |
Just upgraded to v0.4.1 and restarted. Same as before: Snapshots work, but the video still doesn't stream. SetupHardware setup:
Software setup:
FFmpegClick to expand
Homebridge configClick to expand!```json { "bridge": { "name": "Homebridge BCA5", "username": "...", "manufacturer": "homebridge.io", "model": "homebridge", "port": 51061, "pin": "031-45-157" }, "accessories": [ { "name": "Occupancy Sensor", "unifi": { "controller": "https://10.0.1.3:8443", "username": "Homebridge", "password": "...", "site": "default" }, "watch": [ "...", "..." ], "mode": "any", "watchGuests": false, "interval": 10, "accessory": "UniFi Occupancy Sensor" } ], "platforms": [ { "platform": "config", "name": "Config", "theme": "dark-mode", "port": 8581, "sudo": false }, { "name": "Airmega", "platform": "Airmega", "username": "...", "password": "..." }, { "name": "UniFi Protect", "unifi": { "enhanced_classes": [ "person", "dog", "bear" ], "controller": "https://10.0.1.3:7443", "controller_rtsp": "rtsp://10.0.1.3:7447", "username": "Homebridge", "password": "...", "motion_interval": 5000, "motion_repeat_interval": 30000, "motion_score": 50, "enhanced_motion": true, "enhanced_motion_score": 50, "save_snapshot": true, "debug": true }, "videoConfig": { "maxStreams": 3, "maxWidth": 1920, "maxHeight": 1024, "maxFPS": 25, "maxBitrate": 6000, "vcodec": "h264_omx", "packetSize": 376, "audio": false, "additionalCommandline": "-protocol_whitelist https,crypto,srtp,rtp,udp" }, "platform": "UnifiProtectMotion" } ] } ```Homebridge logsClick to expand!
|
SetupHardware:
Software:
FFmpegClick to expand!
Homebridge ConfigClick to expand!{
"name": "UniFi Protect",
"unifi": {
"enhanced_classes": [
"person"
],
"controller": "https://10.0.0.1",
"controller_rtsp": "rtsp://10.0.0.1:7447",
"username": "****",
"password": "****",
"motion_interval": 5000,
"motion_repeat_interval": 30000,
"motion_score": 0,
"enhanced_motion": true,
"enhanced_motion_score": 55,
"enable_motion_trigger": true,
"save_snapshot": false,
"debug": true,
"debug_network_traffic": false
},
"googlePhotos": {
"upload_gphotos": false,
"auth_redirectUrl": "http://localhost:8080/oauth2-callback"
},
"videoConfig": {
"vcodec": "h264_omx",
"audio": true,
"maxStreams": 2,
"maxWidth": 1920,
"maxHeight": 1080,
"maxFPS": 15,
"mapvideo": "0:1",
"mapaudio": "0:0",
"maxBitrate": "3000",
"packetSize": 188,
"additionalCommandline": "-protocol_whitelist https,crypto,srtp,rtp,udp"
},
"platform": "UnifiProtectMotion"
} Homebridge LogsClick to expand!
|
Could you try with: |
@beele that's from the Homebridge startup logs. |
Ok, thats already good. |
There are currently several tickets opened on the github of the homebridge camera ffmpeg plugin regarding the same issue. https://github.com/Sunoo/homebridge-camera-ffmpeg/issues
|
@beele It's just running on eth0, the only accessory the RPi has is a PoE hat. Here's an output from -D:
|
hmm, I see: rtsp://10.0.0.1:7447/UEjbvyDxCL9gpG61: Invalid data found when processing input Garage true |
@beele that camera is a UVC G3 Flex, there are other UVC G4 Pro which also don't work. When I upgraded to |
@beele Yea, not quite sure what’s going on either, or why this type of issue seems to be spiking recently. Are you on the Homebridge Discord? A few camera plugin developers are on there and it’s a convenient way to huddle on issues that impact us all. |
@Sunoo I'll join the discord to chime in |
I'm having issues as well... Hardware:Ubuntu 20.04 Software:Docker v19.03.13-beta2, build ff3fbc9d55 FFmpeg:Click to expand!
Homebridge Config:Click to expand!
Homebridge Logs:Click to expand!
|
@beele I just received my G4 Doorbell and set it up. Without changing any config in Homebridge except for adding the doorbell ID, the video streams just fine from the doorbell. The G3 Flex's and G4 Pro's won't stream still. Edit: All the RTSP streams work fine in VLC. |
@beele I think I know why ffmpeg is getting Looking at the logs it's showing the RTSP endpoint for that camera as I thought to check after I connected another G3 Flex and it worked without any issues and has the same settings/camera fw. Maybe UniFi Protect changed the stream endpoints and they are cached? |
Here's the output with debugging info when requesting a video stream:
Noticed this warning:
|
@s1rc I've checked this and it's indeed the case, I'm working on a fix that will update the source for the snapshots/stream every time that homebridge is (re)started. |
@s1rc @madrobby
|
@beele so far so good! I've changed the RTSP stream endpoints by toggling on and off and restarting homebridge. All my cameras work now 🙇 |
@beele Still not working for me, I've tried your new beta but still getting My configs are in an earlier comment. I have debugging turned on, but I'm not seeing the types of logs that @madrobby shows above. This is what I'm seeing in my logs:
|
@beele Hope you don’t mind me posting here...I wanted to offer some insight on how to address the ffmpeg streaming issue. If you take a look at my UniFi Protect plugin, you can see how to address this one. There are a handful of unique issues to Protect streams...but the good news is that they’re pretty easy to overcome and you can get incredibly fast video streams. There are two things that you need to do...the first involves adjusting the packet size. This is likely driving a lot of the long/slow starts that people are seeing above. @Sunoo created a great starting point for camera plugins, but in doing so, he also made some of the shortcomings of Protect + ffmpeg more acute when those of us used it as a foundation. We all stand on his shoulders, and certainly my ffmpeg code is also directly based on his. The second is that you don’t need to reencode the stream. This will speed things up dramatically. Protect outputs a very clean (minus the channel swaps for audio and video) H.264 stream. In the spirit of collaboration, please feel free to crib my code from homebridge-unifi-protect2 as a starting point: This should also address #69 Finally, you might want to take a look at how I’ve approached snapshots for my plugin. I don’t rely on anonymous snapshots and instead pull it right from the camera API directly. It’s quite fast, and always sized correctly. See here for that code: As you can see, it will auto-adjust the aspect ratio as well, addressing #70. Hope this helps. You’ve created a nice plugin. Though we have different goals for our respective UniFi Protect homebridge plugins, I hope we can find opportunities to collaborate to provide a great experience to our user communities looking for UniFi Protect support for HomeKit. |
@beele latest beta and no more ffmpeg errors! I also removed ALL of my previous |
@beele Hope the pointer to my codebase helped. Good luck! |
I think most issues have been resolved by this, thx again to @hjdhjd for the helpful insights. |
@beele I’ve had some users report similar things on my plugin, but I’ve never been able to recreate it or make sense of it. Maybe the home hub just rejects the stream if it’s way larger than it’s asking for or something? That’s just a wild guess though. |
@beele I’ve never had this issue, weirdly. What’s the quality of the stream (from the Protect end) that you’re trying to stream and what’s the camera model? |
@beele Just a hunch - add the |
@hjdhjd I will continue to recommend against using the option, until someone can point me to something from FFmpeg that supports using it. Right now all I've found from them says pretty explicitly not to use them in this situation. |
@Sunoo I understand your perspective. I've got experience that says, at least in this case, it works just fine and can alleviate some of these issues. You can choose to try or not. All ffmpeg is a great tool, but it's a Swiss army knife. I'm sure you're right in some situations, perhaps even in most situations. I'm just pointing to this situation and my own experience in spending time with it on this hardware platform and works well here. |
@hjdhjd I already have the option in the code (that was producing the issue)
On LTE it requests a stream of: On WiFi it requests a stream of: The RTSP from the cameras is FHD, 15 fps, 3000kbps |
@beele Make only the lowest quality stream available and give it a go perhaps? Also...can you post the ffmpeg command that's attempted and any debug output? Let's give it a look and see what it tells us. |
With beta 3, the plugin works upon reboot and then crashes shortly after. It was working fine until I turned notifications on from my wife's iphone and macbook too. Now I get this crash and snapshots & video only work after a few minutes on a reset:
|
@janthony6 can you try with: |
@beele The snapshots still stop refreshing in beta 4. However, if I click the video, the stream works. Exiting the video gives me a refreshed snapshot for just that camera while the others may say 8 hours ago. Example: Right now I have 2 cameras that say 8 hours ago, and 1 which I viewed 18 minutes ago, shows 18 minutes ago and has not refreshed the snapshot since. |
Beta 3 and 4 are not usable. After some time, all my devices become unresponsive and I have to restart homebridge. Had to roll back to 4.2 and just not have rtsp working. |
@janthony6 Ok, can you provide some logging from when it stops working. I've never had the plugin cause all other devices to report "no response". Are you using Unifi OS or legacy controller? @JJJ When the snapshots streams stop working do you see the same "no response" on all other devices behaviour? |
@beele It's not an instant unresponsiveness of everything. Typically snapshots stop working first. Then if I go in there and turn off a bunch of lights, everything shuts stop responding. I'm off beta now. |
@janthony6 Can you give an indication of the timescale in which this occurs (minutes/hours/days) Edit: |
@beele will give beta5 a try now. I had just installed beta4 again and it stopped responding in 1 hour. |
@beele yes, I am seeing the same thing. Will try beta 5 now. |
@beele same issue on beta 5. after about an hour, no more snapshots come in. all the other devices work unless i interact with a few of them. Then it will all go unresponsive. From the time that the snapshot stop working, if I hard close my home app and reopen, all my devices show unresponsive. |
Hmmm, I don't see that same behaviour. My system keeps running for days on end without issues (beta 3/4). Does your system use Unifi OS? Is there anything in the logs? |
@beele i'm not seeing any of the issues reported with the beta builds. They have resolved the issues i was seeing, RTSP feeds are now working on 4.3 beta 5 no issue. |
@BadgerBadgerAndFox I see the same thing, I have had beta 5 running for two weeks without issue. |
Yes.
Will do! |
Hi there @beele , my config that is working with 0.4.2 on my RBPI 3 with latest HOOBS version 3.2.6/node 12.16.3. What could be the possible reason for this error? |
@alezanott Can you try with the latest beta: |
@beele have tried but nothing changed :-( |
@beele looks like the issue with the snapshots stopping after a period of time is UnifiOS related, i have updated my CK2+ to the UnifiOS beta and am now seeing this issue. UniFi Cloud Key Firmware 2.0.19 Debugging is enabled, will try and grab them when i see the issue. |
Describe the bug
This is a global ticket for all FFMPEG issues like streams not starting etc.
Specifications
Respond to this ticket if you are having issues with streams not working.
Include:
Logging
Enable the debug option of the plugin and attach the FULL log of homebridge to the ticket.
Be sure to omit any sensitive data like usernames/password/tokens/urls
NOTE:
All other tickets regarding FFMPEG streaming issues will be closed!
The text was updated successfully, but these errors were encountered: