{"id":29771513,"url":"https://github.com/bauer-andreas/secure-video-specification","last_synced_at":"2026-02-08T04:33:45.512Z","repository":{"id":44683299,"uuid":"233424866","full_name":"bauer-andreas/secure-video-specification","owner":"bauer-andreas","description":"Documentation and examples of the HomeKit Secure-Video Specification","archived":false,"fork":false,"pushed_at":"2022-04-25T11:49:14.000Z","size":1275,"stargazers_count":224,"open_issues_count":1,"forks_count":15,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-07-25T20:30:59.633Z","etag":null,"topics":["hap","homekit","homekit-accessory-protocol","secure-video","secure-video-specification"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bauer-andreas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"Supereg"}},"created_at":"2020-01-12T16:45:41.000Z","updated_at":"2025-04-15T16:35:50.000Z","dependencies_parsed_at":"2022-08-30T06:30:56.600Z","dependency_job_id":null,"html_url":"https://github.com/bauer-andreas/secure-video-specification","commit_stats":null,"previous_names":["bauer-andreas/secure-video-specification","supereg/secure-video-specification"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bauer-andreas/secure-video-specification","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauer-andreas%2Fsecure-video-specification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauer-andreas%2Fsecure-video-specification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauer-andreas%2Fsecure-video-specification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauer-andreas%2Fsecure-video-specification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bauer-andreas","download_url":"https://codeload.github.com/bauer-andreas/secure-video-specification/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauer-andreas%2Fsecure-video-specification/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29220514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T03:18:47.732Z","status":"ssl_error","status_checked_at":"2026-02-08T03:15:31.985Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hap","homekit","homekit-accessory-protocol","secure-video","secure-video-specification"],"created_at":"2025-07-27T06:39:52.319Z","updated_at":"2026-02-08T04:33:45.485Z","avatar_url":"https://github.com/bauer-andreas.png","language":null,"readme":"# HomeKit Secure Video Unofficial Specification - R3\n\n## 1. Overview\n\n### Service Definitions\n\n#### Cameras\n\nHomeKit Secure-Video cameras need to expose the same services as normal cameras with the following changes: \n\n* Every `RTPStreamManagement` service must add the `Active` characteristic\n(This is used to indicate that the camera is fully turned off)\n* The required amount of `RTPStreamManagement` services was dropped from two to one.\n* The `MotionSensor` service is required (to indicate movement and thus a start and stop of a recording)\n* The `CameraOperatingMode` service is required\n* The `DataStreamManagement` service is required (to initiate HomeKit Data Stream communication)\n* The `CameraEventRecordingManagement` service is required. It needs to link to the `MotionSensor` and `DataStreamManagement` service\n\nIf `MotionSensor` or `OccupancySensor` are added, they must expose the `Active` characteristic.\n\n#### Doorbells\n\nHomeKit Secure-Video doorbells need to expose the same services as both doorbells and secure-video cameras.\n\n### Active states\n\nEvery Secure-Video enabled camera can be set to four different states: `Off`, `Detect Activity`, `Stream`\nand `Stream \u0026 Allow Recording`.  \nDepending on the state the following `Active` characteristics for the given services are set.\n\n| Camera-States            | RTPStreamManagement `Active` | CameraOperatingMode `HomeKitCameraActive` | CameraEventRecordingManagement `Active` | \n| :----------------------: | :---: | :---: | :---: |\n| Off                      | false | false | false |\n| Detect Activity          | false  | true | false |\n| Stream                   | true  | true  | false |\n| Stream \u0026 Allow Recording | true  | true  | true  |\n\n### Recording requirements\n\n* The camera needs so support basic motion detection\n* The camera needs to support encoding, buffering and transmitting of fragmented MP4 - Pretty similar to Section 3.3 \n[RFC 8216](https://tools.ietf.org/html/rfc8216#section-3.3) (HLS). The RFC refers to\n[ISO/IEC 14496-12 ISO base media file format](https://mpeg.chiariglione.org/standards/mpeg-4/iso-base-media-file-format/text-isoiec-14496-12-5th-edition).  \nHow exactly the data is transmitted can be read\nin the [HDS Packet Formats](#4-homekit-data-stream-packet-formats) section and the [Flow of events](#6-flow-of-events)\nsection.\n* Supported video codecs are: h.264, h.265 (possibly)\n* Supported audio codecs are: AAC-LC, AAC-ELD\n* Typical resolutions one might support (a camera might support more):\n    * 640x480\n    * 1024x768\n    * 1280x960\n    * 1600x1200\n    * 2048x1536\n    * 640x360\n    * 1280x720 (Mandatory)\n    * 1920x1080 (Mandatory, default at 24 or 30 fps)\n    * 3840x2160\n* Frame rates:\n    * 15 fps (Mandatory)\n    * 24 fps\n    * 30 fps (One of 24 fps or 30 fps is mandatory)\n\n\n## 2. Services\n\n### 2.1 CameraOperatingMode\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 0000021A-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.service.camera-operating-mode |\n| Required Characteristics  | [3.2 EventSnapshotActive](#32-eventsnapshotsactive) \u003cbr\u003e [3.3 HomeKitCameraActive](#33-homekitcameraactive) \u003cbr\u003e [3.6 PeriodicSnapshotsActive](#36-periodicsnapshotsactive) |\n| Optional Characteristics  | [3.4 ManuallyDisabled](#34-manuallydisabled) \u003cbr\u003e [3.5 NightVision](#35-nightvision) \u003cbr\u003e [3.12 ThirdPartyCameraActive](#312-thirdpartycameraactive) \u003cbr\u003e [3.1 CameraOperatingModeIndicator](#31-cameraoperatingmodeindicator) \u003cbr\u003e [3.13 Diagonal Field of View](#313-diagonalfieldofview) |\n\n### 2.2 CameraEventRecordingManagement\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000204-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.service.camera-recording-management |\n| Required Characteristics  | Active \u003cbr\u003e [3.8 SupportedCameraRecordingConfiguration](#38-supportedcamerarecordingconfiguration) \u003cbr\u003e [3.9 SupportedVideoRecordingConfiguration](#39-supportedvideorecordingconfiguration) \u003cbr\u003e [3.10 SupportedAudioRecordingConfiguration](#310-supportedaudiorecordingconfiguration) \u003cbr\u003e [3.11 SelectedCameraRecordingConfiguration](#311-selectedcamerarecordingconfiguration) \u003cbr\u003e [3.7 RecordingAudioActive](#37-recordingaudioactive) |\n\n## 3. Characteristics\n\n### 3.1 CameraOperatingModeIndicator\n\nThis characteristic indicates if the camera LED, which shows the current state of the camera (see [states](#active-states)),\nshould be turned on. Controlled by \"Camera status light\" setting in the Home App.\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 0000021D-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.camera-operating-mode-indicator |\n| Permissions               | Paired Read, Paired Write, Notify, Timed Write |\n| Format                    | bool |\n| Valid Values              | 0 - \"Hardware LED is disabled\" \u003cbr\u003e 1 - \"Hardware LED is enabled\" |\n\n### 3.2 EventSnapshotsActive\n\nThis characteristic indicates if the option _\"Camera Settings\" -\u003e Notifications -\u003e \"Allow Snapshots in Notifications\"_\nis turned on. If this option is turned on, a notification from this camera sent to anyone in this home, will include\na snapshot of the motion or activity.\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000223-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.event-snapshots-active |\n| Permissions               | Paired Read, Paired Write, Notify, Timed Write |\n| Format                    | bool |\n| Valid Values              | 0 - \"Snapshots in notifications are turned off\" \u003cbr\u003e 1 - \"Snapshots in notifications are turned on\" |\n\n### 3.3 HomeKitCameraActive\n\nThis characteristic indicates if the camera should detect activity (Unsure if activity just means motion detection or \nalso button presses for doorbell accessories).\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 0000021B-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.homekit-camera-active |\n| Permissions               | Paired Read, Paired Write, Notify, Timed Write |\n| Format                    | bool |\n| Valid Values              | 0 - \"Activity detection should not be enabled\" \u003cbr\u003e 1 - \"Activity detection should be enabled\" |\n\n### 3.4 ManuallyDisabled\n\nThis characteristic indicates if the camera was manually turned off, for example using a physical switch on the camera.\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000227-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.manually-disabled |\n| Permissions               | Paired Read, Notify |\n| Format                    | bool |\n| Valid Values              | 0 - \"Camera is not manually disabled\" \u003cbr\u003e 1 - \"Camera was manually disabled\" |\n\n### 3.5 NightVision\n\n_This characteristic is already present in the current HAP spec_\nThis characteristic indicates if automatic night vision should be turned on.\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 0000011B-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.night-vision |\n| Permissions               | Paired Read, Paired Write, Notify |\n| Format                    | bool |\n| Valid Values              | 0 - \"Disable night-vision mode\" \u003cbr\u003e 1 - \"Enable night-vision mode\" |\n\n### 3.6 PeriodicSnapshotsActive\n\nExact behaviour unclear. Seems to be always set to `true` regardless of anyone viewing periodic snapshots or not.\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000225-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.periodic-snapshots-active |\n| Permissions               | Paired Read, Paired Write, Notify, Timed Write |\n| Format                    | bool |\n\n### 3.7 RecordingAudioActive\n\nThis characteristic indicates if recordings should include audio.\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000226-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.recording-audio-active |\n| Permissions               | Paired Read, Paired Write, Notify, Timed Write |\n| Format                    | uint8 |\n| Valid Values              | 0 - \"Audio should not be included in recordings\" \u003cbr\u003e 1 - \"Audio recording is active\" |\n\n### 3.8 SupportedCameraRecordingConfiguration\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000205-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.supported-camera-recording-configuration |\n| Permissions               | Paired Read, Notify |\n| Format                    | tlv8 |\n\nA read request on this characteristic returns the following structure:\n\n##### Supported Camera Recording Configuration:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Prebuffer length | 4 | Size of the prebuffer in milliseconds.\u003cbr\u003eIt must be at least 4000ms.\u003cbr\u003e(typical encountered values: 4000ms, 8000ms) |\n| 2 | Event Trigger Options | 8 | Bitmask of trigger types: \u003cbr\u003e  0x01 - Motion \u003cbr\u003e 0x02 - Doorbell |\n| 3 | Media Container Configurations | N | List of supported media container configurations. \u003cbr\u003eMost cameras out there do only expose one entry. |\n\n##### Media Container Configuration:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Media Container Type | 1 | Container types: \u003cbr\u003e 0 - Fragmented MP4 |\n| 2 | Media Container Parameters | N | Media container parameters |\n\n##### Media Container Parameters:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Fragment Length | 4 | Length of one mp4 fragment in milliseconds\u003cbr\u003e(typically 4000ms) |\n\n### 3.9 SupportedVideoRecordingConfiguration\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000206-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.supported-video-recording-configuration |\n| Permissions               | Paired Read, Notify |\n| Format                    | tlv8 |\n\nThe value of this characteristic is a TLV8-encoded list of supported video codecs:\n\n##### Supported Video Recording Configuration:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Codec Configuration | N | Codec information and the configurations supported for the codec\u003cbr\u003e There is one TLV of this type per supported codec |\n\n##### Video Codec Configuration:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Codec | 1 | Type of video codec:\u003cbr\u003e0 - H.264 \u003cbr\u003e1 - H-265 |\n| 2 | Video Codec Parameters | N | Video Codec specific parameters |\n| 3 | Video Attributes | N | Video Attributes supported for the codec (tlv list) |\n\nVideo Codec Configuration TLV contains exact one tlv of 'Video Codec Parameters' and one entry of\n'Video Attributes' per supported resolution/frame rate combination. \n\n##### Video Codec Parameters:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | ProfileID | 1 | List of supported H.264 profiles (tlv list is separated by empty tlvs): \u003cbr\u003e0 - Baseline Profile \u003cbr\u003e1 - Main Profile \u003cbr\u003e2 - High Profile |\n| 2 | Level | 1 | List of supported H.264 levels (tlv list is separated by empty tlvs): \u003cbr\u003e0 - 3.1 \u003cbr\u003e1 - 3.2 \u003cbr\u003e2 - 4 |\n| 3 | Bitrate | 4 | Only present in the Selected Camera Recording Configuration request: \u003cbr\u003eSelected video bitrate. Typically, secure video requests 2000kbps when face recognition is enabled, and 800kbps otherwise.   |\n| 4 | iFrame_Interval | 4 | Only present in the Selected Camera Recording Configuration request: \u003cbr\u003eSelected key frame interval in milliseconds. Typically 4000ms. Seems to be the same value as the fragment length. So every mp4 fragment MUST begin with a keyframe |\n\n##### Video Codec Attributes:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Image width | 2 | Image width in pixels |\n| 2 | Image height | 2 | Image height in pixels |\n| 3 | Frame rate | 1 | Maximum frame rate |\n\n### 3.10 SupportedAudioRecordingConfiguration\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000207-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.supported-audio-recording-configuration |\n| Permissions               | Paired Read, Notify |\n| Format                    | tlv8 |\n\nThe value of this characteristic is a TLV8-encoded list of supported audio codecs:\n\n##### Supported Audio Recording Configuration:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Codec Configuration | N | Codec information and the configurations supported for the codec\u003cbr\u003e There is one TLV of this type per supported codec |\n\n##### Audio Codec Configuration:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Codec | 1 | Type of audio codec:\u003cbr\u003e0 - AAC-LC \u003cbr\u003e1 - AAC-ELD |\n| 2 | Audio Codec Parameters | N | Video Codec specific parameters |\n\n##### Audio Codec Parameters:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Channels | 1 | Count of audio channels |\n| 2 | Bitrate Modes | 1 | List (probably empty tlv separated?) of supported audio bitrate modes: \u003cbr\u003e0 - Variable \u003cbr\u003e1 - Constant |\n| 3 | Sample rates | 1 | List (probably empty tlv separated?) of supported sample rates: \u003cbr\u003e0 - 8 kHz \u003cbr\u003e1 - 16 kHz \u003cbr\u003e2 - 24 kHz \u003cbr\u003e3 - 32 kHz \u003cbr\u003e4 - 44.1 kHz \u003cbr\u003e5 - 48 kHz|\n| 4 | Max Audio Bitrate | 4 | Only present in the Selected Camera Recording Configuration request: \u003cbr\u003emaximum selected audio bitrate |\n\n### 3.11 SelectedCameraRecordingConfiguration\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000209-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.selected-camera-recording-configuration |\n| Permissions               | Paired Read, Paired Write, Notify |\n| Format                    | tlv8 |\n\nThe structure of the write value looks like the following:\n\n##### Selected Camera Recording Configuration:\n\n| Type | Name | Format | Description |\n| --- | --- | --- | --- |\n| 1 | Selected General Configuration | N | The selected [recording configuration](#supported-camera-recording-configuration) |\n| 2 | Selected Video Configuration | N | The selected [video recording configuration](#supported-video-recording-configuration) |\n| 3 | Selected Audio Configuration | N | The selected [audio recording configuration](#supported-audio-recording-configuration) |\n\n### 3.12 ThirdPartyCameraActive\n\n_Usage and behaviour of this characteristic is currently pretty unclear._\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 0000021C-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.third-party-camera-active |\n| Permissions               | Paired Read, Notify |\n| Format                    | bool |\n\n### 3.13 DiagonalFieldOfView\n\n| Property                  | Value                                |\n| ------------------------- | ------------------------------------ |\n| UUID                      | 00000224-0000-1000-8000-0026BB765291 |\n| Type                      | public.hap.characteristics.diagonal-fov |\n| Permissions               | Paired Read, Notify |\n| Format                    | float |\n| Minimum Value             | 0 |\n| Maximum Value             | 360 |\n| Unit                      | arcdegrees |\n\n## 4. HomeKit Data Stream Packet Formats\n### 4.1 Start\n\nWhen the camera detects motion it will send a hap event for the characteristic as usual.\nAfter that, one of the connected Home Hubs will send an open request.\n\nThe header should use `dataSend` as the protocol and `open` as the topic.  \nThe **request** has the following message fields:\n\n| Key | Type | Description |\n| --- | ---- | ----------- |\n| target | string | `home hub` - to signify the direction of the send |\n| type | string | `ipcamera.recording` - the type of the stream |\n| streamId | int | used to identify this stream; chosen by the home hub |\n\nThe **response** has the following message fields:\n\n| Key | Type | Description |\n| --- | ---- | ----------- |\n| status | int | Indicates if stream could be opened. Available codes are unknown: \u003cbr\u003e 0 - Success |\n\n### 4.2 Binary Data\n\nThe header should use `dataSend` as the protocol and `data` as the topic.\nThe **event** has the following message fields:\n\n| Key | Type | Description |\n| --- | ---- | ----------- |\n| streamId | int | Same identifier used in the dataSend.open |\n| packets | array | Array of dictionaries. Usually length = 1 |\n\nA packet dictionary looks like the following:\n\n| Key | Type | Description |\n| --- | ---- | ----------- |\n| data | bytes | Packet data |\n| metadata | dictionary | Metadata for the packet |\n\nMetadata for recording chunks is defined as:\n\n| Key | Type | Description |\n| --- | ---- | ----------- |\n| dataType | string | `mediaInitialization` - for the first event message which contains mp4 initializing `ftyp` and `moof` boxes \u003cbr\u003e `mediaFragment` - for all other packets which contains fragmented mp4 segments |\n| dataSequenceNumber | int | Starting by `1` (with the mediaInitialization packet) and incrementing for every mp4 segment |\n| dataChunkSequenceNumber | int | Starting by `1`; enumerates every data chunk of a mp4 segment (if a mp4 segment is to big it can be split in multiple packets using this chunk number) |\n| isLastDataChunk | boolean | `true` when the data chunk is the last for the current sequence/mp4 segment |\n\n### 4.3 Close\n\nThis event closes the stream and is sent by the home hub once the motion sensor is set back to \"No motion detected\"\n(It seems that the home hub still waits for the last mp4 segment to be sent).  \nThe header should use `dataSend` as the protocol and `close` as the topic.\n\nThe **event** has the following message fields:\n\n| Key | Type | Description |\n| --- | ---- | ----------- |\n| streamId | int | Same identifier used in the dataSend.open |\n| reason | int | Example reasons: \u003cbr\u003e 0 - Normal - Normal Close \u003cbr\u003e 1 - Not Allowed - Home hub will not allow the Accessory to send this transfer \u003cbr\u003e 2 - Busy - Home hub cannot accept this transfer right now \u003cbr\u003e 3 - Cancelled - Accessory will not finish the transfer \u003cbr\u003e 4 - Unsupported - Home hub does not support this stream type \u003cbr\u003e 5 - Unexpected Failure - Some other protocol error occurred and the stream has failed \u003cbr\u003e 6 - Timeout - Accessory could not start the session |\n\nThe accessory can also send this event message to indicate that the session errored unexpectedly and should be aborted.\n\n## 5. Image Snapshots\n\nThe POST body of the `POST /resource` request received a new optional property `reason` with number type.\n\nWith the `reason` property a controller indicates the reason for a snapshot request:\n* `0`: Request is the result of a periodic snapshot request.\n* `1`: Request is the result of an event snapshot (e.g. to display image for a motion event).\n\nIf the accessory has [PeriodicSnapshotsActive](#36-periodicsnapshotsactive) turned off, any snapshot request without \na `reason` property or the `reason` property set to `0` must be rejected.\n\nIf the accessory has [EventSnapshotsActive](#32-eventsnapshotsactive) turned off, any snapshot request without\na `reason` property or the `reason` property set to `1` must be rejected.\n\n\nWhen rejecting a snapshot request the accessory must return `HTTP 207 Multi-Status` and\na HAP Status code of `-70401` (`INSUFFICIENT_PRIVILEGES`; if it was rejected due to the missing `reason` property)\nor `-70412` (`NOT_ALLOWED_IN_CURRENT_STATE`, if the `reason` doesn't match the current set rules).\n\n## 6. Flow of events\n\nIn this section I will give a brief overlook on how an activity will be recorded using secure-video.\n\n* The secure-video camera gets paired.\n* The user sets the current [camera state](#active-states) to `Stream \u0026 Allow Recording`\n* The configuration of the camera will be set up:\n    * The accessory will receive a write request on the\n      [SelectedCameraRecordingConfiguration](#311-selectedcamerarecordingconfiguration) characteristic\n        * Important settings like the `prebuffer length` are configured\n    * The `Active` characteristic of the [CameraEventRecordingManagement](#22-cameraeventrecordingmanagement) service will be\n        set to true (and all other active characteristics getting updated according to the [camera state](#active-states))\n* If the camera is set to detect motion it will continuously check the video stream for any movement as usual.\nIf recording is enabled, the camera will fill the pre buffer with mp4 fragments according to the First-In-Last-Out principle.\n* When the motion service reports activity, all available Home Hubs will open an HomeKit Data Stream Connection to the accessory\n* If the camera detects motion (analogous for doorbell button presses) if will set the `Motion Detected` characteristic\nof the `Motion Sensor` to true\n    * After that, a home hub will initiate a bulk send session over HDS and sends a [`dataSend` `start` request](#41-start)\n    with a new streamId.\n    * The camera will now send a [mediaInitialization](#42-binary-data) `dataSend` `data` event with the below listed metadata.\n    The mp4 data contains a `ftyp` and `moov` box.\n        * `dataSequenceNumber`: 1\n        * `dataChunkSequenceNumber`: 1\n        * `isLastDataChunk`: true\n    * After that the actual mp4 fragments are getting sent using [mediaFragment](#42-binary-data) `dataSend` `data` events.\n    The mp4 data contains a `moof` and a `mdata` box and must start with a keyframe.\n    The accessory will begin immediately by sending the fragments currently contained in the prebuffer (typically 2x4 seconds in length).\n    After that the accessory will send any newly recorded mp4 fragments (typically 4s in length) when they become available\n    (any fragment will be sent, where the recording was started while motion was still detected).  \n    Every mp4 fragment gets a new incrementally assigned `dataSequenceNumber` (starting by 2 for the first segment in the preBuffer).\n    If the size of one mp4 fragment is too big, it can be split into multiple chunks. Then every chunk is enumerated\n    by the `dataChunkSequenceNumber`, while the last chunk must always be marked with `isLastDataChunk` equal to true.\n    Current cameras seems to use a **maximum chunk size of 262,144 bytes** (or 0x40000 bytes).\n* The HomeKit Home Hub receiving the mp4 fragments will analyze every mp4 fragment for moving objects, recognize faces, and decide,\naccording to the configured motion settings, if a given fragment will be flagged for motion or not.\nThe Home Hub will then assemble a recording from the flagged mp4 fragments and save it in iCloud. \niCloud will then tell iPhones, iPads, HomePods and AppleTV to notify the user based on their notification settings.  \n* When motion stops the accessory will set the `Motion Detected` characteristic  of the `Motion Sensor` to false.\nThe camera will still send out the last mp4 fragment which is currently recorded (remember: typically fixed 4s fragment length).\nAfter a short time the Home Hub will send a [`dataSend` `close` event](#43-close) to indicate that the given \ntransmission for the `streamId` is closed.\n\nExample fmp4 files of a transmitted recording can be found in the [examples](./examples) directory.\nAdditionally, a full writeup of the transmitted HomeKit Data Stream payloads for the given example can be found \n[here](./examples/README.md).\n","funding_links":["https://github.com/sponsors/Supereg"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbauer-andreas%2Fsecure-video-specification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbauer-andreas%2Fsecure-video-specification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbauer-andreas%2Fsecure-video-specification/lists"}