AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.54k stars 183 forks source link

Save picture from camera #55

Closed szamq closed 1 year ago

szamq commented 3 years ago

Hi, great addon works great in real time. Would it be possible to have the snapshot from the camera? It would be useful for sending these pictures as notifications to the phone. Right now I use standard camera image from the camera which are delayed like 10 seconds.

Gferretta commented 3 years ago

Or exist any form to save the live streaming in NAS, i.e.?

Papadoma commented 3 years ago

Not sure if that's a needed functionality for this plugin Personally, Im using something like the MotionEye or more recently the Frigate NVR This is more for serving the stream, not doing stuff with it.

spriggsy commented 3 years ago

This is a great idea, Im using this with the Amcrest doorbell and this is the only way ive found to get no delay video. A no delay snapshot would be awsome.

ImLovinIt commented 3 years ago

This is what I'm trying to achieve as well. Has anyone found a solution yet?

Just to spark some ideas, I was thinking of capturing a screenshot and sending it to my phone. However, the screenshot function (thru remote admin & REST api) on Fully Kiosk Browser can't capture video content unfortunately...

wowgamr commented 3 years ago

Saving pictures and videos - is a good idea.

amitkeret commented 3 years ago

Personally, Im using something like the MotionEye or more recently the Frigate NVR

Can you explain how you workaround the delay? For me, at least, there is a significant delay between the stream displayed by WebRTC and by MotionEye. That means if I try to capture a snapshot of an event (that I see on the WebRTC stream), the produced snapshot will be of a delayed point in time since it's captured from MotionEye's camera entity.

How did you manage to workaround this?

Papadoma commented 3 years ago

Personally, Im using something like the MotionEye or more recently the Frigate NVR

Can you explain how you workaround the delay? For me, at least, there is a significant delay between the stream displayed by WebRTC and by MotionEye. That means if I try to capture a snapshot of an event (that I see on the WebRTC stream), the produced snapshot will be of a delayed point in time since it's captured from MotionEye's camera entity.

How did you manage to workaround this?

With Frigate NVR, all processing is done at 5fps with minimal inference time (around 50ms) if you're using a Coral TPU As soon as you have an event (e.g. person detected), you can set an automation that uses the camera.snapshot service to grab a snap and then you can send this via notification to your phone Is this fast enough?

Papadoma commented 3 years ago

Not only that but NVR can immediately capture a snapshot if you want to do so upon detection, i.e. without other conditions.

Rustymage commented 2 years ago

I'd love this feature. I use a Wyze v3 as a doorbell and rtsp is too slow for snapshots and webrtc doesn't allow it.

I can't get hold of a coral TPU so I can't use frigate either.

Bastiencc commented 2 years ago

+1 would be great to have an equivalent of camera.snapshot but with this stream

AlexxIT commented 2 years ago

Check my new project. It can get snapshot in MP4 (single frame) and RAW formats. MP4 can be send to Telegram as GIF picture. RAW can be transoded to JPEG via ffmpeg, but I recommend using MP4.

https://github.com/AlexxIT/go2rtc

Beer17HWAM commented 1 year ago

I just installed the WebRTC v3.0-beta.3 in Home Assistant and it's working great with the Eufy Doorbell and the conversion with the aler9/rtsp-simple-server. I also want to send snapshots to Telegram. I saw you included this feature in the v3.0. How can I make a snapshot with Home Assistant or Node-red if the eufy-security-ws and eufy_security_addon are doing there streaming job? I can see the stream in Home Assistant.

AlexxIT commented 1 year ago
Beer17HWAM commented 1 year ago

Thanks for the quick answer. I do not have go2rtc, I have WebRTC v3.0-beta.3 up-and-running. Is it working with WebRTC v3.0-beta.3 too? I have Home Assistant in a docker on a Raspberry Pi4. I am confused now because of port 1984.

I opened the link in Chrome and I get the player but no image. Maybe the camera name at the end is wrong?? My ha entity is camera.deurbel.

AlexxIT commented 1 year ago

Have you read docs? If you running WebRTC v3, you already have go2rtc.

PS. Just open go2rtc Web UI to check what streams you have

Beer17HWAM commented 1 year ago

Okay, that's clear. I see the stream for my Eufy Doorbell in the web ui. And I can play it on my Android smartphone in chrome, the MP4 one. Now I want to get one frame and save it as a picture. How can I do that? I have Node-red and can use http get or post, etc. Or can I do it with Home Assistant?

Beer17HWAM commented 1 year ago

Check my new project. It can get snapshot in MP4 (single frame) and RAW formats. MP4 can be send to Telegram as GIF picture. RAW can be transoded to JPEG via ffmpeg, but I recommend using MP4.

https://github.com/AlexxIT/go2rtc

I really can't find how to save one frame. :-(

AlexxIT commented 1 year ago

If example links works for you - you need to search answer at Hass community. Because Hass automations not related to this component.

Beer17HWAM commented 1 year ago

"Module: MP4

Provides several features:

MSE stream (fMP4 over WebSocket)

Camera snapshots in MP4 format (single frame), can be sent to Telegram" <<<

This is your own documentation. You don't have an example? Not related to Home assistant. Anyone else who can point me in the right direction to get a snapshot from a stream??

Beer17HWAM commented 1 year ago

This is the stream info:

[
  {
    "media:0": "video, sendonly, 96 H265/90000",
    "receive": 68362281,
    "remote_addr": "192.168.1.8:8554",
    "send": 0,
    "track:0": "96 H265/90000, sinks=1",
    "type": "RTSP client producer",
    "url": "rtsp://192.168.1.8:8554/T8210P0020330C10/",
    "user_agent": "go2rtc/0.1-rc.6"
  },
  {
    "remote_addr": "[::1]:34570",
    "send": 67991178,
    "type": "MP4 server consumer",
    "user_agent": "HomeAssistant/2022.12.9 aiohttp/3.8.1 Python/3.10"
  }
]

Only question: how can I save a snapshot?

Beer17HWAM commented 1 year ago

Is it one of the following links?

http://192.168.1.8:1984/api/frame.mp4?src=rtsp://192.168.1.8:8554/T8210P0020330C10/

http://192.168.1.8:1984/api/frame.jpeg?src=rtsp://192.168.1.8:8554/T8210P0020330C10/

Chome isn't displaying a snapshot. How can I save a snapshot file?

Sorry for keep asking questions.

AlexxIT commented 1 year ago

You right. I don't have example. As I know:

Beer17HWAM commented 1 year ago

I have all the information now. You can close this item.

AlexxIT commented 1 year ago

Well. Check examples for instant snapshots:

https://github.com/AlexxIT/go2rtc/wiki/Snapshot-to-Telegram

Beer17HWAM commented 1 year ago

See my post https://github.com/fuatakgun/eufy_security/discussions/685

I start the Eufy Doorbell Stream and grab a part of the stream. I grab directly from the rtsp Eufy stream, not the go2rtc stream. It's working fine but indeed ffmpeg is slow to start, you miss the first seconds. But it works, you can send a few seconds to Telegram. I have it up and running now:

It works great. I tried to Grab one jpg frame but that is not working because the first part is indeed not "full". It will be a distorted jpg because of the delay of a keyframe. The mp4 is perfect. I grab 6 seconds.

I hope you can do something with this now. Good luck.

AlexxIT commented 1 year ago

Why I need to do something with this, if you have problems not with my integrations. If your camera gives out a keyframe with a delay, there's nothing you can do about it.

Beer17HWAM commented 1 year ago

It was not directly for you. Just in general. People with a Eufy doorbell for example. A lot of people are trying to get a picture for sending to Telegram because of the changes Eufy did due to the security and the cloud thumbnail. The eufy-security-ws module is part of the solution for Home Assistant. People are searching the internet to find a solution. I just want to help readers.

AlexxIT commented 1 year ago

I received the SoloCam E40 today. I think the logic of operation there is similar to doorbell. Maybe I'll find time to work on closer integration. https://us.eufy.com/products/t813112