Skip to content

Recording stream fails with "Cannot read properties of undefined (reading 'length')" #1505

@EmirMertGold

Description

@EmirMertGold

Describe The Problem:

Recording streams from my Dahua camera fail immediately with a TypeError: Cannot read properties of undefined (reading 'length'). Live view and snapshots still work, but recording never starts.

To Reproduce:

  1. Add a Dahua camera to homebridge-camera-ffmpeg with recording: true and prebuffer: true.
  2. Start Homebridge and trigger a recording stream.
  3. Observe logs for .length error and stream closure.

Logs:

[14/08/2025, 15:35:39] [PluginUpdate] [Door] Recording stream request received for stream ID: 1
[HDS ::ffff:192.168.1.149] Encountered unexpected error for recording stream 1: TypeError: Cannot read properties of undefined (reading 'length')
    at CameraRecordingStream.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/camera/RecordingManagement.ts:1020:34)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:196:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:177:57)
    at fulfilled (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:167:62)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
[14/08/2025, 15:35:39] [PluginUpdate] [Door] Recording stream closed for stream ID: 1, reason: 5

Homebridge Config:

```json
{
"name": "Door",
"manufacturer": "Dahua",
"serialNumber": "4E018ECPAP95F3F",
"motion": true,
"switches": true,
"motionTimeout": 10,
"motionDoorbell": false,
"videoConfig": {
"source": "-rtsp_transport tcp -i rtsp://admin:emr02%40ozn10@192.168.1.230:554/cam/realmonitor?channel=1&subtype=0",
"maxStreams": 3,
"maxWidth": 854,
"maxHeight": 480,
"maxFPS": 10,
"maxBitrate": 500,
"forceMax": false,
"packetSize": 1024,
"audio": true,
"debug": false,
"debugReturn": false,
"recording": true,
"prebuffer": true
}
}
```

Screenshots:

Image

Environment:

  • Node.js Version: v22.18.0
  • NPM Version: 10.9.3
  • Homebridge Version: v1.11.0
  • Homebridge Camera FFmpeg Version: v4.0.1
  • Homebridge Config UI X Plugin Version: v5.4.1
  • Operating System: Debian GNU/Linux Bookworm (12)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions