-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Streaming Legacy Mode #1253
Comments
Just to add, there is no any way to enable Streaming Legacy Mode in Ring app 5.61.0 on iOS |
I don’t have this option, too :( |
same |
1 similar comment
same |
Based on my understanding the option is only available on platforms where HEVC is potentially not supported. For Apple products, the Ring app requires a minimum iOS version of 14 I believe, which only supports hardware that has HEVC support, so there's no real reason for them to provide a toggle for the iOS version of the Ring app. However, for Android, Ring supports back to at least Android 9, and that version runs on some pretty low-end devices that definitely don't have the capability to support HEVC. I've also read things that imply that if you use a web browser that doesn't support HEVC (like Firefox or even most Chrome builds) that it will give you an option to switch to legacy mode for those cameras that won't work. As none of my cameras have been HEVC enabled, I can't research this. If someone has a camera that is not too sensitive, and is willing to share it for a day or two, I'd love to investigate what options might be possible. For example, maybe we can just call the same API that Andriod uses to set the legacy video mode, or maybe there some way to "negotiate down" which just isn't working with the current code, but without having a camera that supports HEVC, I haven't been able to dig deeper. If anyone is willing to share a camera with me via the Ring app, feel free to reach out to me directly, my contact info is the same username as here at Gmail. |
If you are uncomfortable sharing your camera (understandable), and still want to help with this issue, it would be interesting to know if visiting the Ring dashboard in Firefox will still successfully start a live stream with these cameras, or if it will prompt for reverting to legacy video mode. If it does either of these, it would be useful to use the Firefox web development tools to capture a network trace for review. Again, feel free to reach out to me using the same username at Gmail if you do this and are willing to share the captured data from the development tools. |
The Toggle for "Legacy Mode" ist not available anymore. Was on the phone with the RING Support this morning. This Toggle is off the table for now. Is there any Chance to to handle H265 or HEVC in Homebridge? |
@hhunger2404 It's certainly not going to be available on an old Ring app version. What version of the Ring app did you test? As far as I know that last version of the Ring app that supported anything lower than Andriod 9, was 3.49.0 which was released in early 2022, a year before Rng started rolling out HEVC. And I believe even that version required Andriod 6. My guess is you would need at least an Ring app version 3.56.0, or something around there. Regardless, did streaming actually work for that camera with the old version of the app? That would be interesting to know is it would imply that there is a method to still negotiate H.264. Also, did you see my post above? Anything you can do there (share a camera, verify and provide traces from firefox, so any old versions of ring app that still work with those camers, etc) would be useful. |
After a factory reset of the cam and re-installing the camera the live streaming works fine. |
@niqbert I have a tendency to believe that's a temporary workaround at best. Based on what I can tell, Ring is slow rolling HEVC to all supported camera models, roughly in order of registration. Resetting and re-registering the camera might move you back to the end of the line, but my guess is it will come back at some point. I'm seeing more and more users of ring-mqtt who's cameras have been switched to HEVC mode so we'd be better off to research the problem and figure out how to deal with it. |
Hi, this are not working for me yet. I have try'd to reset the cam more then 3 times. no change. |
I sent an email to offer to try and help out. Thanks for looking into this! |
Thanks to @tscanlin for sharing his camera I did some poking and thought I would at least document what I discovered. Don't really have a solution yet, but it might help @dgreif figure out something eventually.
|
Thanks for all the investigation @tsightler! I've been traveling over the past few weeks and haven't had a chance to look into this, so I really appreciate you blazing the trail! I'd love to understand the web streaming method better, especially if it currently supports H.264. Otherwise, it might be worth figuring out the API endpoints for turning on Legacy Mode and simply calling those automatically before trying to stream. In either case, I completely agree that we want to avoid transcoding video if at all possible. We do transcode audio today, but it's levels of magnitude more intensive to transcode video. I'm also traveling next week so won't be able to dig into this any time soon, but look forward to hearing what you find! |
I agree in general, but my attempts to do this have failed so far, and the option doesn't seem to exist in the Ring app anymore and Ring has pulled down the KB article about it. I believe that Legacy mode was only a temporary workaround while they addressed various issues with HEVC compatibility. As far as I can tell all iPhone/iPad devices supported by the Ring app support HEVC and the vast majority of Andriod devices as well. Once they fixed the issues with screenshots and compatibiltiy with devices like Echos, I'm guessing they pulled the Legacy mode feature as it appeared to be intended as a stop-gap when they were first rolling out if customers had issues, which they did for sure. Even if we were able to figure it out, my concern is that it might be a short term fix as devices like Car Cam appear to be HEVC only, although they still use H.264 when playing in the browser. I actually wonder if Ring may be simply transcoding on the fly at the media server when people view an HEVC enabled camera in a browser. So far, the only way I've been able to get H.264 is via the SimpleWebRtcSession(), and it seems to work, but perhaps not with Ring Edge. I did test with ffmpeg transcoding using ultrafast profile and it works, but on a 10 year old Intel box it uses ~40% of the CPU, and on a RPi4b it's closer to 85%, for a single stream. Not ideal for sure. For my use case, which is different from Homekit case for sure, I tried to see what would happen if I just passed through H.265 without transcoding it to see what compatibility would look like. Chrome and Edge play back H.265 HLS streams of course it's HLS so the delay is not great (3-5 seconds). It seems for now only Safari supports H.265 via native WebRTC, which is how most of my users play back streams. I could not get Chrome or Edge to play back a WebRTC stream that used H.265, only Safari and other video players. That would be a real problem for my use case. I'm thinking that using SimpleWebRtcSession is going to be the best option, but I'm still struggling with it a little bit. |
Continuing to dig and try to learn as much as possible while @tscanlin has allowed me to have access to his camera I've found a few things.
For a while I thought the best short-term option was going to be #3, just set the camera to legacy mode, however, something interesting happened this week, Ring changed the way they stream for web browsers! I have HAR files from last week where the Ring web dashboard was using the simple HTTPS based WebRTC API, but then, this week, suddenly it has changed and it is using the same websocket based API as Ring Andriod app, just authenticating in a slightly different way. Overall this is not particularly interesting except, when the API is used with this slightly different authentication, it suddenly does allow negotiating down to H.264 for WebRTC! How it works:
The UUID doesn't appear to matter, just has to exist, my gut says it is similar to X-Sig-Client-ID used for header authentication in the current ring-edge-connection.ts code. Token is of course the ticket acquired. Another important thing is that the headers must include a User-Agent, I haven't found that it matter much what it is, but I just used the generic Firefox user agent for now so my code for connecting to the websocket looks like this:
And, as noted above, I had to add @dgreif My gut says Ring is attempting to standardize their four different streaming APIs (1 SIP, 3 WebRTC) down to this single API using this 4.0 protocol, since it appears that the latest version of the Andriod app and the latest web dashboard now use this very same API, just authenticated slightly differently. I'm thinking it might be time to standardize on this API for all cameras as well, no need for three different API methods in ring-client-api, but I'll let you decide. |
@dgreif I know you said you are travelling, and I'm also travelling the rest of this week, but I wanted to provide some working reference, in case you eventually get a chance to look at this. In ring-mqtt I don't use the streaming code in ring-client-api directly, rather I've copied it, converted it to native Javascript, stripped out some things ring-mqtt doesn't really need, and implemented some custom logging which makes it a little easier for me to tell what is happening when streams fail. However, the overall code is still pretty much the same as in ring-client-api, so I've modified up a working version here that might provide a guideline of the changes: https://github.com/tsightler/ring-mqtt/blob/dev/lib/streaming/webrtc-connection.js This basically replaces the existing webrtc-connection code with the code from ring-edge-connection, but with the modifications I outlined above. The actual call to get a ticket is in camera.js, but I think that's straightforward. My gut says you'd just modify createStreamingConnection() to call the ticket API instead of the live_call API and then pass that ticket to WebrtcConnection. Honestly, I'll probably merge webrtc-connection.js and streaming-connection-base.js together as I don't think it's really needed if there's not two separate code paths. I've tested this with a bunch of cameras, and I'm tempted to just push it out and see what happens, but I have not tested it with Ring Edge devices because I don't have access to one at the moment, however, my gut says it would work. When I get back next week I can try to put together a PR for ring-client-api, but for now, I've got a working solution for ring-mqtt and I'll probably try to recruit some users to test. If you wanted to do something "safer" we could check for Ring Edge and HEVC mode and only use the new method in those cases, while continuing to use the existing method for all other cameras, but my testing indicates that this new API works fine for all cameras. I'll leave that up to you. |
I’m willing to test. |
I know y'all have been investigating this for a while, and I'm also happy to test. I just want to add that I got official confirmation from Ring that Legacy Mode is no longer supported/extant and they won't be bringing it back. How annoying. |
@SamTheGeek I just posted last week that it seems legacy mode is still available, I even found the API required to switch it. The only way I've found to enable it via Ring official methods is to use Firefox, login to Ring web dashboard, go to a camera and trry to view a recorded video. It won't work because Firefox has no support for H.265 and it will prompt you to enable Legacy mode. Regardless, we know what needs to be done, I've already pushed the fixes out to ring-mqtt users a week ago with no reported negative side effects, I just need to find time to put together a patch for ring-cleint-api and ring-homebridge. Just don't have that time right now. |
@tsightler even on Firefox today (on a Mac, mind) it isn't prompting to enable legacy mode. So something must have changed. I suspect it isn't a coincidence that all the 'seamless' user experience stuff landed at the same time as the rollout accelerated. |
@SamTheGeek How are they playing back recorded events from HEVC cameras on Firefox? The reason it was still offered there when I tested it last week is because the Web UI simply passed the S3 tokenized link to the recording directly to the browser and had the browser play it, which works for most browsers, but not for Firefox. It's difficult for me to see how they would solve this without transcoding on the fly. which is what they appear to do for the live stream. Maybe Firefox on Mac can use the OS support for HEVC or are they using some other method to play back these recordings? Would be interesting to know because just lat week Firefox still prompted for legacy mode for me. No idea what the "seamless' user experience stuff is referring to, perhaps you can clue me in there. |
Was there ever a resolution to this? This is my exact problem and I cannot find any answers. |
Hello, I tried Firefox and Windows to bring the camera back into legacy mode. The popup no longer appeared. Any ideas? |
@tomtaz01 When you played back an event in Firefox from a camera with HEVC, did it work? |
On another note, I have submitted a PR for updating ring-client-api to the new streaming API which works with these cameras, so progress is being made. |
Yes |
Interesting, I wish I could see how they were doing that, would provide more clues into options available. Completely different than just two weeks ago I guess but I gave up access to the camera a user had graciously shared with me. I guess at this point it doesn't matter, the code to work with this is available, just have to wait for it to be reviewed since it is somewhat of a high risk change. |
@tsightler When I stream on firefox, live or recorded, it just automatically provides an H.264 stream, they must be transcoding on the fly. I thought maybe FF on MacOS had HEVC support but even on a PC it plays back fine. I booted into Windows for you! |
@SamTheGeek I'm just super curious how they are playing back HEVC recording on Firefox. I already know they are transcoding on the fly for live stream via WebRTC as that's the method the patches I've submitted are using as well, but the way they were playing back recordings was by simply using the browsers ability to play back files via HTTP and were playing back files directly from S3, which just wouldn't work for Firefox. I'm not sure how they could transcode on the fly in this case, but perhaps they've implemented some other method. A HAR file from Firefox dev tools of the process would be interesting to understand how exactly they've implemented this. |
@tsightler I'll fire up the PC tonight and record. |
Thanks @SamTheGeek. The reason I'm personally interested in this is because I've already implemented support for live streaming from HEVC cameras in ring-mqtt, but ring-mqtt also supports playback of recorded streams (called event streams in ring-mqtt). For HEVC cameras I'm having to do local transcoding of recordings to get reliable playback across a wide range of devices, but if Ring has some API that allows playback of recordings on the fly, that would be a huge win. For those following this thread for HEVC support in ring-homebridge, a new beta version, 12.0.0-beta.0, has been released with the new streaming API implemented so any testing results from that version would be appreciated. |
I tried the beta version, but when I try to stream a camera I got an error: [homebridge-ring] RangeError: offset is out of bounds |
I am starting to see errors in home bridge when trying to access live videos in the Apple Home App as well. [08/08/2023, 11:25:08] [Ring] connectionStateChange: closed |
Unsure if these are related? I just restarted the homebridge server. [08/08/2023, 14:51:25] [Ring] 404 from endpoint https://api.ring.com/clients_api/doorbots/43352214/subscribe |
This comment was marked as outdated.
This comment was marked as outdated.
I have the beta installed in hoobs now. I am still see the same issues when trying to open live view with the cameras. |
I'm also getting the
|
Let's track the |
Hoobs beta here as well and seeing the error as well: The write handler for the characteristic 'Selected RTP Stream Configuration' on the accessory didn't respond at all!. Please check that you properly call the callback! Get the legacy error and link if using any other version |
@SamTheGeek Thanks for the HAR file, unfortunately it wasn't enough for me to figure out what was going on. It looked like it was a live view, not an event recording. Regardless, it's OK, I think what I'm doing with ring-mqtt is good enough for now. Thanks again for the help! For anyone else following this thread. Please make sure you install the latest beta which should address the rangeError (not related to HEVC, just bad timing with a bug in another package). We believe the current beta should fix that issue and allow testing for HEVC users to proceed. |
This comment was marked as outdated.
This comment was marked as outdated.
@tsightler As promised, a HAR file of streaming a previous recording (from earlier today). I've killed the other link. |
With the new beta it works!!! Thank you! |
it still does not work for me. |
try to restart the bridge |
For folks finding this thread: This is the right place only for issues in the logs like |
Hoobs 12.0.0-beta 2 with a bridge restart still gives errors.
Hoobs 4.3.0 As a test, I setup and installed Homebridge on a Pi, installed 12.0.0-beta 2 and didn't get any errors when streaming. Raspbian GNU/Linux Bullseye (11) Maybe this is a Hoobs issue? |
Works for me on the new beta as well! |
All streaming should (include cameras with HEVC) should now work with v12. Huge thank you to @tsightler for all your hard work switching us over to the new streaming API, and to everyone who contributed ideas and feedback here. If you have issues on v12, please open a new issue. |
Streaming Issue
Hey, I need to switch cameras to the Legacy Mode. However, this article https://github.com/dgreif/ring/wiki/Streaming-Legacy-Mode sends to the Ring support page, which has broken images, so it's impossible to know how to enable it.
Could someone share the steps required and update your Wiki to reflect the proper steps?
N
Proposed Solution
Unknown
Environment
Homebridge
What operating system are you on?
Linux
Relevant log output
No response
Honesty Time
The text was updated successfully, but these errors were encountered: