seydx / homebridge-camera-ui

Homebridge plugin for RTSP Cameras with HSV, motion detection support, Image Rekognition, Web UI to manage/watch streams and WebApp support
MIT License
647 stars 92 forks source link

FFmpeg recording process exited with error! (null) since 5.0.12 #398

Closed iuliusmaximilian closed 2 years ago

iuliusmaximilian commented 2 years ago

Since 5.0.12 update I receive a lot of FFmpeg recording process exited with error! (null) for multiple cams. My last proper recordings are from this Sunday 3 pm CET everything later was not recorded because of this error for all cams:

[24.1.2022, 07:17:19] [CameraUI] camera.ui v5.0.14 is listening on port 8081 (http)
[24.1.2022, 07:17:32] [CameraUI] VIDEOANALYSIS: New message: Data: [{"zone":"region0","percent":7.012152671813965,"sensitivity":94,"dwell":60,"forceClose":3}] - Motion: detected - Camera: CAM-02
[24.1.2022, 07:17:32] [CameraUI] CAM-02: Motion ON
[24.1.2022, 07:17:33] [CameraUI] CAM-02: FFmpeg recording process exited with error! (null)
[24.1.2022, 07:17:40] [CameraUI] CAM-02: Closing recording process
[HDS ::ffff:10.0.1.87] Recording download stream 1 is still awaiting generator although stream was closed 10s ago! This is a programming mistake by the camera implementation which prevents freeing up resources.
[24.1.2022, 07:17:52] [CameraUI] CAM-02: Motion OFF - Motion handler timeout.

My config is

                {
                    "name": "CAM-02",
                    "manufacturer": "Reolink",
                    "model": "RLC-810A",
                    "serialNumber": "CAM-02",
                    "motion": true,
                    "doorbell": false,
                    "switches": true,
                    "motionTimeout": 20,
                    "unbridge": true,
                    "hsv": true,
                    "prebuffering": true,
                    "forcePrebuffering": false,
                    "prebufferLength": 4,
                    "videoConfig": {
                        "source": "-i rtmp://XXX/bcs/channel0_ext.bcs?channel=0&stream=2&user=XXX&password=XXX -map 0 -an -dn -flags -global_header",
                        "subSource": "-i rtmp://XXX/bcs/channel0_ext.bcs?channel=0&stream=2&user=XXX&password=XXX -map 0 -an -dn -flags -global_header",
                        "stillImageSource": "-i http://XXX/cgi-bin/api.cgi?cmd=Snap&channel=1&rs=XXX&user=XXX&password=XXX",
                        "maxStreams": 10,
                        "maxWidth": 1280,
                        "maxHeight": 720,
                        "maxFPS": 30,
                        "forceMax": false,
                        "audio": false,
                        "debug": false,
                        "vcodec": "copy"
                    },
                    "videoanalysis": {
                        "active": true
                    },
                    "smtp": {
                        "email": "CAM-02"
                    },
                    "mqtt": {}
                }
seydx commented 2 years ago

Since 5.0.1N update I receive a lot of FFmpeg recording process exited with error! (null) for multiple cams. My last proper recordings are from this Sunday 3 pm CET everything later was not recorded because of this error for all cams:

[24.1.2022, 07:17:19] [CameraUI] camera.ui v5.0.14 is listening on port 8081 (http)
[24.1.2022, 07:17:32] [CameraUI] VIDEOANALYSIS: New message: Data: [{"zone":"region0","percent":7.012152671813965,"sensitivity":94,"dwell":60,"forceClose":3}] - Motion: detected - Camera: CAM-02
[24.1.2022, 07:17:32] [CameraUI] CAM-02: Motion ON
[24.1.2022, 07:17:33] [CameraUI] CAM-02: FFmpeg recording process exited with error! (null)
[24.1.2022, 07:17:40] [CameraUI] CAM-02: Closing recording process
[HDS ::ffff:10.0.1.87] Recording download stream 1 is still awaiting generator although stream was closed 10s ago! This is a programming mistake by the camera implementation which prevents freeing up resources.
[24.1.2022, 07:17:52] [CameraUI] CAM-02: Motion OFF - Motion handler timeout.

My config is

                {
                    "name": "CAM-02",
                    "manufacturer": "Reolink",
                    "model": "RLC-810A",
                    "serialNumber": "CAM-02",
                    "motion": true,
                    "doorbell": false,
                    "switches": true,
                    "motionTimeout": 20,
                    "unbridge": true,
                    "hsv": true,
                    "prebuffering": true,
                    "forcePrebuffering": false,
                    "prebufferLength": 4,
                    "videoConfig": {
                        "source": "-i rtmp://XXX/bcs/channel0_ext.bcs?channel=0&stream=2&user=XXX&password=XXX -map 0 -an -dn -flags -global_header",
                        "subSource": "-i rtmp://XXX/bcs/channel0_ext.bcs?channel=0&stream=2&user=XXX&password=XXX -map 0 -an -dn -flags -global_header",
                        "stillImageSource": "-i http://XXX/cgi-bin/api.cgi?cmd=Snap&channel=1&rs=XXX&user=XXX&password=XXX",
                        "maxStreams": 10,
                        "maxWidth": 1280,
                        "maxHeight": 720,
                        "maxFPS": 30,
                        "forceMax": false,
                        "audio": false,
                        "debug": false,
                        "vcodec": "copy"
                    },
                    "videoanalysis": {
                        "active": true
                    },
                    "smtp": {
                        "email": "CAM-02"
                    },
                    "mqtt": {}
                }

Add "rtspTransport": "tcp" to videoConfig

iuliusmaximilian commented 2 years ago

@seydx This doesn't help for me, interestingly, it went well a long time but broke yesterday:

[24.1.2022, 09:01:56] [CameraUI] camera.ui v5.0.14 is listening on port 8081 (http)
[24.1.2022, 09:02:03] [CameraUI] CAM-02: FFmpeg prebuffer process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:03] [CameraUI] CAM-02: Prebufferring process closed
[24.1.2022, 09:02:03] [CameraUI] CAM-02: Restart prebuffer session..
[24.1.2022, 09:02:03] [CameraUI] CAM-02: Videoanalysis scheduled for restart at 4AM: 1138 minutes
[24.1.2022, 09:02:05] [CameraUI] CAM-02: FFmpeg videoanalysis process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:05] [CameraUI] CAM-02: FFmpeg videoanalysis process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:05] [CameraUI] CAM-02: Restart videoanalysis session..
[24.1.2022, 09:02:15] [CameraUI] CAM-02: FFmpeg prebuffer process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:15] [CameraUI] CAM-02: Prebufferring process closed
[24.1.2022, 09:02:15] [CameraUI] CAM-02: Restart prebuffer session..
[24.1.2022, 09:02:15] [CameraUI] CAM-02: Videoanalysis scheduled for restart at 4AM: 1138 minutes
[24.1.2022, 09:02:17] [CameraUI] CAM-02: FFmpeg videoanalysis process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:17] [CameraUI] CAM-02: FFmpeg videoanalysis process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:17] [CameraUI] CAM-02: Restart videoanalysis session..
seydx commented 2 years ago

@seydx This doesn't help for me, interestingly, it went well a long time but broke yesterday:

[24.1.2022, 09:01:56] [CameraUI] camera.ui v5.0.14 is listening on port 8081 (http)
[24.1.2022, 09:02:03] [CameraUI] CAM-02: FFmpeg prebuffer process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:03] [CameraUI] CAM-02: Prebufferring process closed
[24.1.2022, 09:02:03] [CameraUI] CAM-02: Restart prebuffer session..
[24.1.2022, 09:02:03] [CameraUI] CAM-02: Videoanalysis scheduled for restart at 4AM: 1138 minutes
[24.1.2022, 09:02:05] [CameraUI] CAM-02: FFmpeg videoanalysis process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:05] [CameraUI] CAM-02: FFmpeg videoanalysis process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:05] [CameraUI] CAM-02: Restart videoanalysis session..
[24.1.2022, 09:02:15] [CameraUI] CAM-02: FFmpeg prebuffer process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:15] [CameraUI] CAM-02: Prebufferring process closed
[24.1.2022, 09:02:15] [CameraUI] CAM-02: Restart prebuffer session..
[24.1.2022, 09:02:15] [CameraUI] CAM-02: Videoanalysis scheduled for restart at 4AM: 1138 minutes
[24.1.2022, 09:02:17] [CameraUI] CAM-02: FFmpeg videoanalysis process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:17] [CameraUI] CAM-02: FFmpeg videoanalysis process exited with error! (null) - Option rtsp_transport not found. - 
[24.1.2022, 09:02:17] [CameraUI] CAM-02: Restart videoanalysis session..

remove rtspTransport again, its not supported by the camera

Can you check if the stream still works through eg VLC ?

iuliusmaximilian commented 2 years ago

The stream works fine via VLC, no issue, no change on camera & network side, the difference is only the plugin update.

seydx commented 2 years ago

The stream works fine via VLC, no issue, no change on camera & network side, the difference is only the plugin update.

Hmm, when you downgrade again, everything works normally?

iuliusmaximilian commented 2 years ago

I tried this already: sudo npm i -g homebridge-camera-ui@5.0.11

[24.1.2022, 09:18:22] [Config] Initializing config platform...
[24.1.2022, 09:18:22] [Config] Running in Service Mode
[24.1.2022, 09:18:22] [CameraUI] Initializing CameraUI platform...
[24.1.2022, 09:18:22] TypeError: Cannot read properties of undefined (reading 'once')
    at Function.createUiLogger (file:///usr/lib/node_modules/homebridge-camera-ui/services/logger/logger.service.js:47:29)
    at new LoggerService (file:///usr/lib/node_modules/homebridge-camera-ui/node_modules/camera.ui/src/services/logger/logger.service.js:121:14)
    at new CameraUI (file:///usr/lib/node_modules/homebridge-camera-ui/node_modules/camera.ui/src/index.js:52:17)
    at new HomebridgeCameraUI (file:///usr/lib/node_modules/homebridge-camera-ui/src/platform.js:47:21)
    at /usr/lib/node_modules/homebridge/src/server.ts:440:40
    at Array.forEach (<anonymous>)
    at Server.loadPlatforms (/usr/lib/node_modules/homebridge/src/server.ts:372:27)
    at Server.start (/usr/lib/node_modules/homebridge/src/server.ts:159:29)
[24.1.2022, 09:18:22] Got SIGTERM, shutting down Homebridge...
iuliusmaximilian commented 2 years ago

I tried also this: sudo npm i -g homebridge-camera-ui@5.0.12

[24.1.2022, 09:22:50] [CameraUI] camera.ui v5.0.12 is listening on port 8081 (http)
[24.1.2022, 09:22:51] [CameraUI] VIDEOANALYSIS: New message: Data: [{"zone":"region0","percent":5.04774284362793,"sensitivity":96,"dwell":60,"forceClose":3}] - Motion: detected - Camera: CAM-02
[24.1.2022, 09:22:51] [CameraUI] CAM-02: Motion ON
[24.1.2022, 09:22:55] [CameraUI] CAM-02: FFmpeg recording process exited with error! (null)
[24.1.2022, 09:23:01] [CameraUI] CAM-02: Closing recording process
[24.1.2022, 09:23:11] [CameraUI] CAM-02: Motion OFF - Motion handler timeout.
[HDS ::ffff:10.0.1.87] Recording download stream 1 is still awaiting generator although stream was closed 10s ago! This is a programming mistake by the camera implementation which prevents freeing up resources.
seydx commented 2 years ago

@iuliusmaximilian

Is the stream running in parallel anywhere else?

iuliusmaximilian commented 2 years ago

I have an NVR from Reolink that records (still) on top 24h but this was always the case nothing changed, that's the only stream from that camera nothing else.

seydx commented 2 years ago

@iuliusmaximilian

you wrote "since 5.0.12"

is it working with eg v5.0.9 ?

iuliusmaximilian commented 2 years ago

@seydx Yes, I am sure it was working in 5.0.9.

iuliusmaximilian commented 2 years ago

@seydx see https://github.com/seydx/homebridge-camera-ui/issues/364 first it was broken and then fixed

seydx commented 2 years ago

@seydx see #364 first it was broken and then fixed

everything working now?

iuliusmaximilian commented 2 years ago

@seydx Unfortunately not and I am not able to downgrade to 5.0.9 or below to test.

seydx commented 2 years ago

@seydx Unfortunately not and I am not able to downgrade to 5.0.9 or below to test.

v5.0.15-beta.1 is online, can you give it a try pls

iuliusmaximilian commented 2 years ago

I just found the error, somehow during one of the updates the config was modified and as result the wrong native ffmpeg was used instead of the homebridge-camera-ui one. I manually added again the line that solved it for 5.0.14:

"options": {"videoProcessor": "/usr/lib/node_modules/homebridge-camera-ui/node_modules/ffmpeg-for-homebridge/ffmpeg"},