bropat / eufy-security-client

This shared library allows to control Eufy security devices by connecting to the Eufy cloud servers and local/remote stations over p2p.
MIT License
467 stars 67 forks source link

Station livestream is dark and doesn't use IR nightvision #21

Closed schliemann closed 2 years ago

schliemann commented 3 years ago

Bug Using the station livestream returns a stream which is rather dark and doesn't make use of the IR night vision

To Reproduce
Steps to reproduce the behavior:

  1. Receive videostream from https://github.com/bropat/eufy-security-client/blob/d8c394f2148e66fb9aabbfeee7692a37ec66ce5b/src/http/station.ts#L402-L404
  2. Make snapshot with ffmpeg https://github.com/schliemann/homebridge-eufy-security-control/blob/F-Realtime_Snapshot/src/streamingDelegate.ts#L330-L374
  3. Compare darkness and nightvision with cloud livestream

Expected behavior
Station livestream makes use of IR night vision and is comparable in colour to cloud livestream.

Screenshots & Logfiles
Snapshot from station livestream: StationLiveStream

Snapshot from eufy app EufyApp

Video shows cloud livestream and then a very dark snapshot. The livestream uses IR night vision the stream from the station doesn't:

https://user-images.githubusercontent.com/10818044/124093016-bcd4ba80-da57-11eb-922e-a0665c10962c.mp4

bropat commented 3 years ago

@schliemann

Hi,

the video I get from the station is untouched, there is no post-processing done like probably with the "Eufy Cloud". I think it has nothing to do with the IR Night Vision. You can easily edit the RAW stream you get with ffmpeg through filters (brightness, contrast etc.).

schliemann commented 3 years ago

I believe you are correct. The night vision mode does indeed kick in. However it is still extremely difficult to make anything from the stream when it is enabled. I'm not an expert, but I don't see how filters in ffmpeg can fix this.

Eufy cloud Eufy cloud

Station stream with ffmpeg filter eq=brightness=0.1:saturation=2

Night vision enabled 817BBB60-76AD-474B-9113-50411E2A58CF

Night vision disabled 379C1805-5957-466D-A507-A8FC1D8A5ADF

bropat commented 3 years ago

@schliemann I have already tested the livestream extensively with my Eufycam 2 some time ago and had no problem with night vision on or off. Therefore, I can not understand your image "night vision enabled".

schliemann commented 3 years ago

@bropat The device I'm using in this test is T8210_Video Doorbell 2K. When I write that night vision is enabled it is because it can be set in the device settings:

image

The stream is most of the day a bit dark. But when night vision kicks in at around 9 pm UTC the stream goes more or less black.

I'll gladly share the doorbell with you through guest access.

bropat commented 3 years ago

@schliemann I will get back to you in about 2 weeks

bropat commented 3 years ago

@schliemann

I just tested it with my ioBroker adapter, which also uses eufy-security-client, and the video is fine:

image

The problem must lie somewhere else, not with the library eufy-security-client

schliemann commented 3 years ago

@bropat Interesting. Your ioBroker works slightly different, since you use fluentffmpeg and save files to the disk. Can you see anything that looks completely off here?

https://github.com/schliemann/homebridge-eufy-security-control/blob/F-Realtime_Snapshot/src/streamingDelegate.ts#L199-L378

I use ffmpeg-for-homebridge - not sure if this could be a problem. The rtsp stream looks normal when using it however.

bropat commented 3 years ago

@schliemann Have you tried removing these?

Apart from the filter parameters, I don't see any difference.

schliemann commented 2 years ago

@bropat I finally figured out why my snapshots didn't utilize night vision. Apparently it is not present in the first frame(s) of a started livestream. When I added seeking (-ss) of half a second the night vision is turned on.

https://user-images.githubusercontent.com/10818044/151251932-4d4707f9-3de1-432a-bc32-d6cf3869ffcb.mp4