samemory / homebridge-eufy-security

Work in progress
Apache License 2.0
97 stars 14 forks source link

One problem remains to be solved #367

Closed karesake closed 2 years ago

karesake commented 2 years ago

One problem remains to be solved

Now that the video live stream is working on Apple devices, there is still a problem on Apple TV and Apple Watch that needs to be solved.

The stream always starts with cameras - except for the doorbell - only on the second attempt.

The first time the stream loads and the camera shows "No Response". Directly after that, if you start the stream again, it loads immediately. And it doesn't matter whether you start the stream on your iPhone, iPad, Apple Watch, AppleTV or Mac. On the first try: no answer and immediately after that it works...

This is the only problem regarding the live stream that still needs to be solved. Because especially on the Apple TV it's not fun otherwise.

@lenoxys do you have an idea?

I don't think it has anything to do with the resolution or the stream in general anymore. I think the fault must be somewhere else.

I also don't think it has anything to do with waking up the camera. If I keep the stream running permanently on the mac, for example, the stream on the iPhone only starts on the second attempt...

What we should do on the way to a perfect plugin

✔ More than 300 seconds streaming time What we should definitely take out is the 300 seconds maximum streaming time. Either 30 minutes or Unlimited. Otherwise the stream will stop after 3 minutes on the ATV.

✔ See that the stream loads on the first try.


EDIT 22/03/21

OK. I think (and hope) it's solved.

I will make a pull request if everything runs smoothly for a few days.

github-actions[bot] commented 2 years ago

Did you check this Road Map pages ?

r33ce15 commented 2 years ago

Interested to try this I so far have had eufy settings to low compression and smart display mode and then using copy function in ffmpeg and it's been working smoothly get snapshots and live stream loading fast but every now and then stops working in both eufy app and home but this could be network related have to see how goes but this interesting find!

spextec commented 2 years ago

@karesake

Thank you very much for being so committed to ensuring that streaming works well. I installed your fork and the cameras work perfectly. I also hope that it stays that way. The stream starts in less than 4 seconds and always on the first attempt.

It's great that someone here attaches a lot of importance to the stream. Thank you!

schliemann commented 2 years ago

@karesake Great work. When would it make sense to make a PR. I can see you are making a lot of commits.

karesake commented 2 years ago

@schliemann I don't know how i can create a pull request. I have to deal with that a little more. And yes, since I'm actually the only one using my fork, there are many changes.

But at the current stage, I can say that the stream works without any problems - on all devices.

(1) I removed the local live stream. That has anyway only effects on the bell. With the latest Eufy Client, the camera stream builds up just as easily (and faster). The doorbell stream now also works on the AppleTV.

(2) Even if the bell rings, the live image will be displayed within 3 seconds.

(3) Furthermore, the stream is renewed automatically. For example, if HomeKit shows "No Response" on the first try ... especially on the Apple TV ... the stream automatically reconnects, almost without interruption.

(4) The codec no longer has to be set to copy.

But I'll make the pull request once I've tested the whole thing for a few days and it's running smoothly.

lenoxys commented 2 years ago

Thanks men. Let me know if you are not able to push a PR. I will do it on my side and credit your awesome work.

karesake commented 2 years ago

Let's have a look. If I can't do it that way, feel free to use everything and create it yourself.

I'm still working on a lot. I'll let you know when the time comes.

BTW: Apple Watch Stream is working 😁

A9-DF1-BC8-D2-EA-47-C7-9151-A77306-AB52-A8 4716588-D-60-B9-4-A84-9-A55-3-F5-B3-F8-EE28-C

karesake commented 2 years ago

I think I am currently at a point to offer my version of the measurements. The version is primarily aimed at a fast and reliable stream on all Apple devices.

@lenoxys @schliemann

I don't know what to do with a pull request. You can simply take the data on my fork and create one yourself. Please test it yourself beforehand. My doorbells and non-HomeKit cameras all work perfectly.

• Snapshots are created quickly and automatically renewed after about a minute. • The stream works on all Apple devices. • The stream will be built up for me within 3 seconds • The Vcodes does not have to be set to Copy. • FFMPEG Debug does not need to be activated.

schliemann commented 2 years ago

@karesake @lenoxys We should maybe create a new feature branch and PR it in there first so we can do a quick smoke test before merging it to beta.

fullphat commented 2 years ago

I think I am currently at a point to offer my version of the measurements. The version is primarily aimed at a fast and reliable stream on all Apple devices.

@lenoxys @schliemann

I don't know what to do with a pull request. You can simply take the data on my fork and create one yourself. Please test it yourself beforehand. My doorbells and non-HomeKit cameras all work perfectly.

• Snapshots are created quickly and automatically renewed after about a minute. • The stream works on all Apple devices. • The stream will be built up for me within 3 seconds • The Vcodes does not have to be set to Copy. • FFMPEG Debug does not need to be activated.

Does the above apply to all cameras, or just to the doorbell cam range?

lenoxys commented 2 years ago

Before going master I'd like to allow people to custom per camera. But we'll use @karesake default value for those who don't know what to put on it.

lenoxys commented 2 years ago

@karesake @lenoxys We should maybe create a new feature branch and PR it in there first so we can do a quick smoke test before merging it to beta.

I suggest to use the beta branch since we will use it as default value, no ?

karesake commented 2 years ago

However, making the whole thing adaptable to individual cameras is of no use, since HomeKit always uses the same thing.

iPhone, iPad: 1280x720, 30FPS, 299KB/S Apple TV, iPad Pro Landscape: 1920x1080, 30FPS, 802KB/S

If you want to make it customizable, it would be interesting if the RTSP can be used as the source.

I'm excited to see what's coming.

lenoxys commented 2 years ago

ok just implemented the code. needs to be documented

karesake commented 2 years ago

Can we put in the RTSP Stream now ?

I currently have no access to my Homebridge to test :(

lenoxys commented 2 years ago

this new beta broke some settings which was global and now per camera such as enableButton, motionButton, codec and ffmpegdebug.

No I have not worked on RTSP this is a tricky one since some camera doesn't support it.

lenoxys commented 2 years ago

need to add yours change as well. I like the approach but I'm not sure is a good idea to provide conf per platform I think per camera is enough and if you change some it will apply whatever the platform is. (mainly use I think for debug)

jjr3211 commented 2 years ago

Updated to the new beta and it looks like it broke my doorbell camera?

karesake commented 2 years ago

Updated to the new beta and it looks like it broke my doorbell camera?

Confirm that. Doorbell and author Cameras not not working anymore. And I don't see any setting options for this either. Went back to my Version and everything is fine.

lenoxys commented 2 years ago

looks like

        config.encoderOptions = config.encoderOptions || '-ultrafast -fastdecode';

was the issue revert back to

        config.encoderOptions = config.encoderOptions ??= '-preset ultrafast -tune zerolatency';

check the new beta

option has to be written down on config json here is an example :

        {
            "username": "xxxxxxxx",
            "password": "xxxxxxxx",
            "enableDetailedLogging": 1,
            "enableCamera": true,
            "CameraMaxLivestreamDuration": 30,
            "pollingIntervalMinutes": 30,
            "ignoreStations": [],
            "ignoreDevices": [],
            "hkHome": 1,
            "hkAway": 0,
            "hkNight": 3,
            "hkOff": 63,
            "country": "FR",
            "cameras": [
                {
                    "serialNumber": "T8400Pxxxxxxxxxxxxx",
                    "videoConfig": {
                        "vcodec": "copy"
                    },
                    "enableButton": false,
                    "unbridge": true
                },
                {
                    "serialNumber": "T8114Pxxxxxxxxxxxxx",
                    "videoConfig": {
                        "debug": true
                    },
                    "enableButton": false,
                    "motionButton": false,
                    "unbridge": true
                }
            ],
            "platform": "EufySecurity"
        }
lenoxys commented 2 years ago

Manage to add RTSP look at the latest beta (need to enable RTSP stream first on Eufy App)

        {
            "username": "xxxxxxxx",
            "password": "xxxxxxxx",
            "enableDetailedLogging": 1,
            "enableCamera": true,
            "CameraMaxLivestreamDuration": 30,
            "pollingIntervalMinutes": 30,
            "ignoreStations": [],
            "ignoreDevices": [],
            "hkHome": 1,
            "hkAway": 0,
            "hkNight": 3,
            "hkOff": 63,
            "country": "FR",
            "cameras": [
                {
                    "serialNumber": "T8400Pxxxxxxxxxxxxx",
                    "videoConfig": {
                        "vcodec": "copy"
                    },
                    "enableButton": false,
                    "unbridge": true
                },
                {
                    "serialNumber": "T8114Pxxxxxxxxxxxxx",
                    "videoConfig": {
                        "debug": true
                    },
                    "enableButton": false,
                    "motionButton": false,
                    "unbridge": true,
                    "rtsp": true
                }
            ],
            "platform": "EufySecurity"
        }
lenoxys commented 2 years ago

image Working on the config...

karesake commented 2 years ago

That looks great.

I already have the following in another post

"Unfortunately, RTSP doesn't really work. As with Camera UI, the stream is no longer accessible after a few minutes"

Without RTSP

As before, the camera needs two attempts to establish the stream. He breaks the first time

The funny thing is, if I turn off motion detection in the Eufy app, it works. I think it has something to do with that.

I also get these messages:

[homebridge-eufy-security] This plugin slows down Homebridge. The write handler for the characteristic 'Selected RTP Stream Configuration' on the accessory 'Überwachung Garage 34BD' didn't respond at all!. Please check that you properly call the callback! See https://git.io/JtMGR for more info.

and

Überwachung Garage (FloodLight Cam 2 pro) handleMotionDetectedGet Wrong return value

lenoxys commented 2 years ago

That looks great.

I already have the following in another post

"Unfortunately, RTSP doesn't really work. As with Camera UI, the stream is no longer accessible after a few minutes"

For that point, we won't make much than a plugin which have the best dev ¯\_(ツ)_/¯

Without RTSP

As before, the camera needs two attempts to establish the stream. He breaks the first time

The funny thing is, if I turn off motion detection in the Eufy app, it works. I think it has something to do with that.

Good catch !

I also get these messages:

[homebridge-eufy-security] This plugin slows down Homebridge. The write handler for the characteristic 'Selected RTP Stream Configuration' on the accessory 'Überwachung Garage 34BD' didn't respond at all!. Please check that you properly call the callback! See https://git.io/JtMGR for more info.

and

Überwachung Garage (FloodLight Cam 2 pro) handleMotionDetectedGet Wrong return value

let's create another thread to keep it clear for each issue your facing. Need to organise because it's really hard to follow with generic title

github-actions[bot] commented 2 years ago

We do not accept issue on this repo. Please submit your issue on this repo : https://github.com/homebridge-eufy-security/plugin/issues, thanks. If you have any questions, please feel free to contact us.