Repository navigation
Conversation
|
Lo he probado y he podido exportar mis cámaras en HEVC, pero encuentro ciertos problemas por ejemplo el audio algunos si los da y muy mal con un sonido horrible y hay otras que no las da del todo, debería de tener el audio máximo de 24bits que pide apple con aac, y otra cosita que faltan integraciones como Google Nest, Ezviz, entre otros modelos, muestre la calidad real de la cámara si lo tengo en h264 u h265 antes de exportar y las entidades se puedan también exportar junto con la cámara a HomeKit ya sea que tenga luz, sirena entre otros que admita Apple con HAP. |
|
Thanks for the contribution @seydx. I'm also in the middle of a comprehensive rework for HAP-NodeJS to support the new capabilities. Will be good to compare notes as it evolves. Speaking for the Homebridge team...this is likely going to be a methodical process...we're not going to flip the switch here on the new camera capabilities. Just to set people's expectations. There's some forward-planning that's needed from an API perspective for both HAP-NodeJS and Homebridge and we're taking it a step at a time. I write and maintain homebridge-unifi-protect and several other plugins. I've been working through this for a good portion of the summer and testing the capabilities out. Appreciate of the work you've done and look forward to seeing where we're making different choices. |
|
H264 cameras that are 2k cannot take advantage of level 5 since it does not allow it yet only level 4 to 1080p, I have several cameras in H264 camera.ui and the audio does not work it makes a buzzing noise, there is no configuration to change the audio to AAC-ELD or Opus since not even the cameras in H264 and H265 with HKSV3, I get real audio and it is a problem some mute and others with buzz, I have the transmission in HomeKit without audio because they do not work in camera.ui |
|
Just for your information, I'll be pushing my work on CMAF in the next few days. Apple’s current compatibility guide is very incomplete, and I’m in touch with them about it Uploading via CMAF is currently working, and the clips are now visible in Apple Home via this path. However, they can’t be played yet. As soon as that works, I’ll push my work, and then the spec will be complete so you can compare for your rework |
|
@seydx Appreciate it...looking forward to seeing it and look forward to seeing where things can potentially come together. Across our two plugins, we've got a pretty good audience for this capability. I'm expecting to bring the pieces together over the next few weeks. I also expect that some of the bugs/quirks are going to get worked out for iOS 27.2 or thereabouts and will help amp this up a bit. You're a braver soul than I to show your WIP as we move along. 😄 |
|
@seydx @hjdhjd Hey all! I wanted to let you know that I will be uploading to my personal forks for HAP-NodeJS, node-arlo, and homebridge-arlo hopefully later this afternoon/evening. I have taken seydx's work which has been fantastic along with my own work and I have finally gotten a fully functioning HKSV3 model from end to end, Local MultiTieredRTP Streaming, Remote WebRTC Streaming, and CMAF Recording. Two-Way Audio works on both streaming types, although there is an Apple Bug that I have reported that if you use the All Cameras Switcher in the Home App on a Remote WebRTC Streaming and switch between two cameras, you lose two-way audio capabilities until you close the stream and re-open it fresh. The talk button just isn't there until you re-open it. Recordings work for uploading and playback, I had some work that I did for handling the playback in getting the keys and encryption handling correct but I got it and everything looks like it works for me. I'll edit this post and like the repositories and their respective branches as well when I get everything up and confirmed on my end. |
|
I'm glad it helped you and that you solved the CMAF issue! I'll take a closer look at it once you're done :) I'm still waiting here for the official response from Apple, since I haven't looked into that part about the keys and playback any further. As soon as the response comes in, I'll update this PR too, and you can compare your work to it :) |
|
Looking forward to reviewing it as well @ZeliardM - my own work should be pulling most of this all together into something cohesive. I'm expecting a busy November and December to land it all. |
# Conflicts: # src/lib/Accessory.spec.ts # src/lib/Accessory.ts # src/lib/Characteristic.ts # src/lib/Service.ts # src/lib/camera/RecordingManagement.ts # src/lib/camera/index.ts # src/lib/controller/index.ts # src/lib/definitions/CharacteristicDefinitions.spec.ts # src/lib/definitions/ServiceDefinitions.spec.ts # src/lib/definitions/ServiceDefinitions.ts # src/lib/definitions/generator-configuration.ts
Coverage Report for CI Build 41714830934Coverage increased (+0.6%) to 78.896%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
|
Thanks for this branch. I used your CMAFIngest/CMAFTracks to get HKSV3 recordings uploading and playing in Apple Home (tvOS 27 hub). Notes from testing against Apple's ingest, in case they help the "visible but not playable" problem:
Happy to share the uploader code if it helps. |
|
I'm still waiting for Apple's response... The last message I received from Apple was:
:) |
|
Update: encrypted uploads work now too. Clips play in Home with audio and video, show the right date, and Home's face recognition runs on them. So it may be worth pinging Apple back. What made the encrypted path play, on top of the single muxed "video" rendition from my last comment:
Timing and pre-motion:
The code is on top of your secure-video branch: https://github.com/erikpendragon/HAP-NodeJS/tree/hksv3-muxed-upload |
…udio durations so clips play
|
@seydx - I appreciate the enthusiasm you've brought to this from the start...it's been good to see others digging into it in the open. A quick update for everyone following along here...our work on this has landed. #1154 merged into
I've been working through the protocol for the past couple of months - testing against real hubs and building this out a piece at a time. Along the way I've folded a lot of the hard parts into HAP-NodeJS itself to make life simpler for camera plugin developers. The library now runs every viewing session at home and from away, keeps the recent video, and encrypts and uploads each recording. A plugin describes its camera, hands the library a video stream for each quality it offers, and reports motion. You should be able to get a camera up and running in a single evening. Two guides came out of that work:
If you'd like to see it running in a real plugin, homebridge-unifi-protect 8.5.0 is a working live example. On Homebridge This is a beta...we'd welcome testing and feedback, especially from those of you who've been deep in this. Please open an issue for anything you find. Thanks to everyone here for the work and the notes along the way. I'm going to leave this PR open for a few days before closing it, and again, thank you all for your contributions to the community and please enjoy the fruits of many sleepless nights of mine. 😄 |
|
Great news =) Section 8 of your guide says nothing moves a clip's place in the timeline. In my tests one thing does: Without it, Home dated my clips to about the upload command, roughly 10 seconds after the clip's first frame (camera OSD 20:46:55, Home 20:47:05). With it, start and end in Home match the camera's OSD to the second (OSD 21:29:39 to 21:29:55, Home 21:29:39 to 21:29:55), so the lead-up before the motion sits at the right time too. The value is base64 of a JSON object that seals the clip's start under the clip's content key:
@erikpendragon saw the same earlier in this thread: without One more thing on key IDs: the low 14 bits are a ratchet count. K(n+1) = HKDF-SHA256(K(n), empty salt, info "HomeKit 1.0 Ratchet", 32 bytes), and the content key is derived from K(n). A clip at count 1 (key ID ending in Have you tried the timestamp on your side? |
|
I pushed the encryption to
Unlike yours it seals the init segment too. Clips play either way. PS: Enjoy the fruits of many sleepless nights of mine too :D |
|
Great adds...will incorporate into the next beta @seydx 😄 Hope you enjoy the streamlined interface into HAP-NodeJS. |
|
@hjdhjd congratulations on #1154 landing, and thanks for the two guides. They make the new surface easy to follow. Like @seydx, I'd been building the same camera surface on my own fork to get my Arlo cameras onto iOS 27. I've pushed it in case it's useful to compare: ZeliardM/HAP-NodeJS It divides the work differently from yours. A separate The one thing I'd ask you to consider is recording on demand. Arlo cameras are cloud cameras, and some of them run on battery. Their video comes through Arlo's cloud, and only while something asks for it. Keeping a stream open around the clock isn't practical: it would drain the battery models and hold a cloud stream open for every camera. So my plugin never holds one. In my fork the camera's stream starts when motion is reported, or when the hub opens its recording stream, with no prebuffer, and Home accepts and plays those clips. As far as I can read 2.4.0-beta.2, the recorder holds the recorded tier whenever recording is allowed and the camera is in service ( A smaller one, from reading the code and not tested against a hub: the opening media playlist declares And +1 to @seydx on |
|
@ZeliardM thank you, and thanks for the kind words on the guides. Recording on demand. You're reading the code correctly. Today the recorder keeps the recorded tier running whenever recording is allowed, because it serves the hub from the camera buffer with the lead-up already in hand. That's a good default for local cameras...I agree it's not a good approach for the cloud-based pull you're doing. It's coming shortly...it's on my list, but I wanted to hash out the first case and get it out there...yours will come very shortly and it's my intention to have it in there for 2.4.0. 😄
|
|
Awesome! Yea, I can see that. And I appreciate all your work on this. This is huge and a great undertaking and I really can't wait to iron it all out with my new Arlo plugin. Great, yeah, I'm still going through everything in your documents and notes along with all of my code and my notes to see if there's anything else we could help each other with as well. I am going to start pulling this into my plugin to test and see how it's working. May leave recording off until the on-demand is ready though, lol |
|
@hjdhjd as promised, here's what else came out of going through the guide against my own notes. Some is from my cameras, some from reading Apple's iOS 27 binaries. Each rests on one test or one static read, so take them as leads. A second sensor. Home ignoring it looks like an Apple feature flag. HomeKitDaemon builds a camera's sensor list only behind Motion zones. Saving, editing and then clearing a zone in Home sent nothing to the accessory: no Camera Zones write and no zone Active write (iOS 27.0.1, tvOS 27). "No Response" after a view from away. Users will see a camera's tile read No Response for about half a minute after closing a remote view. It's the phone: it takes a snapshot through the stream that's closing, that snapshot never completes, and every snapshot for the camera then waits out a 30-second timeout ( Talkback from away. Two Apple-side issues users will hit, reported as FB24990010 and FB24990140:
The configuration number on legacy cameras. 2.4 now hashes the modern capability and tier values into the configuration number, which is great. The legacy stream configuration values still aren't hashed, so a legacy camera whose advertised resolutions change isn't re-read by a paired controller until it's re-paired. |
|
@ZeliardM thanks for sharing, it mirrors my own appreciate your Apple outreach. Target duration and the date line. Both are in Recording on demand. I measured the wait. A hub gives a camera about 15 or so seconds after it opens a recording to deliver the first fragment, then closes the stream with a timeout. Only a media fragment counts. The initialization segment by itself doesn't. A fragment has to be whole before it can leave, which leaves a camera that starts cold about 10-11 seconds to its first picture with four-second fragments. A clip with no premotion video was kept and played like any other. It's all in the protocol guide now, and it gives the option real room to work with...stay tuned, you should be able to do what you want in short order, pending a couple of more tests on my end. A second sensor. Same here: one view and no selector. I haven't confirmed the reason myself, and the guide will keep saying what I see rather than why. Motion zones. I'd seen that too. Zones are an area I haven't dug into further and set aside as lower priority, which is why the guide lists them as untested. "No Response" after a view from away, and talkback from away. Thanks for filing those. The missing chirp is the Home app's own, and nothing in HKSV3 or the library bears on it. I'll watch for the other two here. On the reoffer, agreed, and the library already behaves that way: a viewer's talk follows the viewer's key and the voice that arrives, not the reoffer. The configuration number on legacy cameras. You're right. The legacy stream configuration values aren't part of the hash, and that predates 2.4. It's a reasonable point and I've noted it for an upcoming beta. |
|
I haven't tried 2.4 yet, I will in the next days. Until Apple's docs are updated, here is what Apple's engineers told me in my feedback thread, quoted so you can point to it. Most of it is in your guide by now. These parts aren't, or read differently: CMAF session number
That's Apple's answer to your untested point on re-pairing: 1 at pairing. I haven't checked it on a hub.
Your hub cut at 300 s by itself. Apple puts the cut on the camera, so a camera shouldn't count on the hub's Stop. Key ratchet
That's the low 14 bits of the key ID from my earlier comment. Count 0 and count 1 both play for me, but Apple expects the camera to advance it on a timer and hasn't said which. Encryption and the clip date
They also said Matter hasn't published the end-to-end encryption spec yet. Specs it builds on
User-Agent
The ingest doesn't check these today, as you found, but that's the rule. Playlist and track names Apple's sample multivariant playlist for a 2K camera in 16:9:
Your guide found other names accepted too, and your appendix has Smaller ones
|
iOS 27 comes with a new set of camera services. Apple calls them "secure video", the hub logs call it HKSV3. This PR adds the definitions for them plus a
SecureVideoControllerthat bundles them behind typed delegates, in the same shape asCameraController.The implementation follows Apple's HomeKit Secure Video Open Source Compatibility Guide for iOS 27, plus a fair amount of iOS and tvOS sysdiagnoses where the guide stops. I used Claude a lot for that part, digging through homed and avconferenced logs, comparing sessions, and turning what the hub actually does into code. The findings below all come from real traffic against a real hub, not from guessing.
What the new path looks like
A secure video accessory has one sensor description (
CameraCapabilities), a global operating mode, motion zones, a multi-tier RTP stream management for local viewing, a WebRTC stream management for remote viewing, and the same HDS recording management the classic HKSV uses. Local viewing is plain SRTP like before, just negotiated through tiers instead of the old start/reconfigure dance. Remote viewing is WebRTC through Apple's relay, with SFrame end-to-end encryption on top of DTLS-SRTP. Recording still goes over HDS bulk send, the hub just analyses it differently.Optional on top of that: CMAF accessory direct upload (buffer, key and client certificate management) where the camera uploads the clip itself instead of streaming it to the hub (see below).
With this path an HEVC camera runs natively end to end. The multi-tier RTP stream for local viewing is the camera's own HEVC, the WebRTC stream for remote viewing is the same HEVC packetized for the relay, and recording is the HEVC stream remuxed to fMP4.
Tested
Note
VCVideoFeatureListStringHelper defaultPayload: featureListStrings is emptyandNo matched feature list string for payload: Apple's H.264 receive path expects a negotiated feature list string (FaceTime heritage), HEVC doesn't need one. Nothing in the SDP or fmtp on the accessory side changes that. So I route H.264 cameras to the classicCameraController, that path is H.264 only in the other direction.CameraRTPStreamManagementon the same accessory don't mix, Home shows "No Response". It's one path or the other per accessory.hvc1sample entry, withhev1the hub aborts after the third fragment. The hub also expects aprftbox in front of eachmoof, otherwise homed crashes while reading the fragment date.WebRTCUpdateSessionare per stream (HKDF with the SSRC as salt before the RFC 9605 derivation, same as the camera's own sender key).Not working yet: CMAF direct upload
The provisioning half is verified against the hub: camera key, signed client certificate, publishing point token, buffer activity and upload commands all arrive as described. The upload itself doesn't. Every PUT to the publishing point (
cloudkit-video-service) returns 400 with an empty body, before authentication kicks in (no client certificate, a self-signed one, other session ids, other bodies, other headers, all 400; other paths 404; GET 401). The hub never talks to that endpoint itself, it only creates the CloudKit clip record, so there's nothing to compare against without a trace of a real HKSV3 camera. The code stays in because the delegate is optional and off unless a consumer wires it, but I wanted to be upfront that this part is unverified. If maintainers would rather see it split out, I can do that.How I test this
I develop and run this in camera.ui, which uses hap-nodejs directly. The HomeKit plugin there carries the WebRTC side (werift), the SFrame crypto, the RTP framing and the media pipeline, and picks the controller by codec: HEVC cameras get the secure video controller, H.264 cameras stay on the classic one.
How you can test
Install camera.ui (https://docs.cameraui.com/install/), add a camera with an HEVC main stream, install the HomeKit plugin from the in-app plugin store and enable HomeKit for that camera. The plugin shows a setup code, add it in Home, then it's the same flow as in the video: live view locally, live view remotely, talk. For recording the hub needs motion events, so the camera needs a motion source in camera.ui, either the built-in detection or a plugin that delivers the camera's own motion events (ONVIF for example). H.264 cameras stay on the classic HKSV path, so to see the new services you need HEVC, or the "Force legacy path" toggle in the camera settings to compare both on the same camera.
hksv3new_1.mp4