WebRTC icon indicating copy to clipboard operation
WebRTC copied to clipboard

Save picture from camera

Open szamq opened this issue 3 years ago • 11 comments

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.

szamq avatar May 07 '21 08:05 szamq

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

Gferretta avatar May 07 '21 15:05 Gferretta

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.

Papadoma avatar May 13 '21 09:05 Papadoma

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.

spriggsy avatar Jun 30 '21 09:06 spriggsy

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...

ImLovinIt avatar Aug 23 '21 08:08 ImLovinIt

Saving pictures and videos - is a good idea.

wowgamr avatar Sep 23 '21 19:09 wowgamr

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?

amitkeret avatar Oct 14 '21 12:10 amitkeret

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 avatar Oct 14 '21 13:10 Papadoma

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

Papadoma avatar Oct 14 '21 13:10 Papadoma

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.

Rustymage avatar Jan 11 '22 15:01 Rustymage

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

Bastiencc avatar Jul 13 '22 08:07 Bastiencc

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

AlexxIT avatar Aug 21 '22 11:08 AlexxIT

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.

Beer17HWAM avatar Jan 06 '23 14:01 Beer17HWAM

  • http://localhost:1984/api/frame.mp4?src=camera1 if your stream with H264/H265 codec
  • http://localhost:1984/api/frame.jpeg?src=camera1 if your stream with MJPEG codec

AlexxIT avatar Jan 06 '23 16:01 AlexxIT

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.

Beer17HWAM avatar Jan 06 '23 16:01 Beer17HWAM

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

AlexxIT avatar Jan 06 '23 17:01 AlexxIT

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 avatar Jan 06 '23 18:01 Beer17HWAM

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. :-(

Beer17HWAM avatar Jan 08 '23 10:01 Beer17HWAM

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

AlexxIT avatar Jan 08 '23 20:01 AlexxIT

"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 avatar Jan 09 '23 09:01 Beer17HWAM

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 avatar Jan 09 '23 09:01 Beer17HWAM

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.

Beer17HWAM avatar Jan 09 '23 10:01 Beer17HWAM

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

  • Telegram integration can use the link to the file to post it to Telegram
  • Telegram cloud can convert mp4 file without audio to image automatically
  • Eufy Doorbell doesn't provide stream fulltime

AlexxIT avatar Jan 09 '23 13:01 AlexxIT

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

Beer17HWAM avatar Jan 12 '23 09:01 Beer17HWAM

Well. Check examples for instant snapshots:

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

AlexxIT avatar Jan 15 '23 07:01 AlexxIT

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:

  • Start streaming
  • Grab piece of stream: ffmpeg -y -i rtsp://192.168.1.8:8554/T8210P0020330C10 -c copy -map 0 -t 6 ffmpeg-snapshot.mp4
  • Send mp4 to Telegram
  • Repeat this as long there is motion and keep it running for a half a minute or so when motion stops.

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.

Beer17HWAM avatar Jan 15 '23 08:01 Beer17HWAM

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.

AlexxIT avatar Jan 15 '23 09:01 AlexxIT

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.

Beer17HWAM avatar Jan 15 '23 10:01 Beer17HWAM

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

AlexxIT avatar Jan 15 '23 11:01 AlexxIT