homebridge-eufy-security / plugin

Homebridge plugin to control certain Eufy Security devices
Apache License 2.0
165 stars 24 forks source link

[Bug]: Video stream freezes 1-2sec for a brief second after start of every HKSV recording #218

Closed streets97f closed 11 months ago

streets97f commented 1 year ago

What happened?

Dual Wired Doorbell: Every video recording made by HKSV has a momentary freeze for about 1-2 seconds right at the beginning. The recording usually plays fine (sometime a little choppy) after the initial freeze, but I end up missing the important action that happened during those few secs. Sometimes I only get the first few seconds of the event and the recording just terminates in the middle of the event. Homekit is not liking the current stream apparently. I have tried changing various plugin settings: the snapshot options, changing the snapshot refresh interval, changing a few setting in the advanced ffmpeg encoding section (render audio and video together). Tried changing settings in the Eufy app: streaming quality, video encoding format (high doesn't work at all with plugin/homekit), notification content types. Eufy combine 2 cameras into 1 video stream that looks like a 4:3 split view size format or a more tradition 16:4 type video size with a picture in picture. I've tried both formats and it still freezes. Nothing seems to fix this issue.

I have a strong wifi network and an Asus wifi 6 router that is about 10-20 ft away. I'm currently just copying the stream since homekit accepts the doorbell stream as-is and it's fast to load up. Maybe I need to render ffmpeg with specific settings, but I don't know where to start. I have debug logs with the ffmpeg debug on.

Device Type

Doorbell (Supported)

Plugin Version

beta (Best Effort)

HomeBridge Version

v1.4.x (Supported)

NodeJS Version

v16 (Supported)

Operating System

Ubuntu 18.04+ (Supported)

Relevant log output

no specific error that I can identify

config

{
    "username": "*****",
    "password": "*****",
    "country": "US",
    "deviceName": "Eufy Security",
    "cameras": [
        {
            "serialNumber": "T8203P1122290007",
            "rtsp": false,
            "enableCamera": true,
            "videoConfig": {
                "audio": true,
                "debug": true,
                "vcodec": "copy",
                "useSeparateProcesses": true
            },
            "talkback": true,
            "hsv": true,
            "snapshotHandlingMethod": 3,
            "refreshSnapshotIntervalMinutes": 5,
            "unbridge": true
        }
    ],
    "platform": "EufySecurity",
    "ignoreStations": [
        "T8203P1122290007"
    ],
    "ignoreDevices": [],
    "cleanCache": true,
    "preferLocalConnection": true,
    "CameraMaxLivestreamDuration": 240,
    "experimentalMode": true,
    "enableDetailedLogging": true
}
github-actions[bot] commented 1 year ago

Did you check this Common Issues pages ?

thieren commented 1 year ago

Hi @streets97f

Just to be clear: the freeze happens only in the recordings, right? If you stream normally there is no such thing? And to be clear about what 'freeze' means: You get a still image and after 1-2 seconds the recording jumps ahead, or do you get a still image and the recording continues after the short delay? So is something clearly missing between the image and the rest of the video, or does it just begin with a still image (say a person) and this person just starts to move after 1-2 seconds?

The doorbell dual does not need a Homebase, right? So it's directly connected to the wifi?

streets97f commented 1 year ago

It appears to happen only in the recordings. This doesn't happen when opening up a live stream. When opening up the recording I immediately get a normal video for about 1 sec. Then the video freezes, I see a still image for about 1-2 sec and then the video jumps forward and continues playing. The recording viewed in the Eufy app is normal..I assume because this recording is from the internal ssd card.

The dual doorbell is directly connected to the wifi without a homebase.

thieren commented 1 year ago

Can you share a bit more about your system specs?

Would it be possible for you to try a different system? At the moment I am running the plugin on a windows homebridge system and utilising the Cisco h264 libopenh264 with pretty good results on an intel 8100 cpu.

streets97f commented 1 year ago

I'm running HB along side home assistant in a docker on a ODROID-N2+ with 4GB RAM, 128gb eMMC. Home assistant really isn't running anything (few simple automations and some lights). I have low CPU load around 4-6%. The Eufy plugin is set yo copy and not currently transcoding. when streaming video or recording CPU load may go up to 35%. How do I load/set the lipopenh265 codec, because inputting "lipopenh265" in vcodec just produces an error. I don't currently have a more powerful system to test on.

thieren commented 1 year ago

The libopen codec is only available on windows systems as far as I know. From a quick google search I also don't think that hardware encoding is a possibility on the odroid, that we could use here.

Have you already updated to the latest beta.10? There are now separate video settings introduced for HKSV. So if you used copy before this might now be reversed to the default settings.

But nevertheless I'd like you to try default settings vs. copy preset. Is there a substantial difference regarding the freeze?

streets97f commented 1 year ago

Yes I'm using beta 10.

I tried using the default in the separate HKSV setting and streaming settings. I also tried combinations of copy preset and default settings between HKSV and streaming setting. The HKSV recording quality was worse. Very jittery, freezing and jumping throughout the whole recording not just the beginning. CPU load still remains fairly low 5% and maybe 20% when streaming camera feed to iphone or when HKSV is recording.

I'm also getting some sort of memory leak and my ram is filling up to max over the course of a day or so. I have to restart homebridge to release all the memory being used, but I will make a separate issue topic for this.

github-actions[bot] commented 11 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 11 months ago

This issue was closed because it has been stalled for 5 days with no activity.