Camera snapshot strange issue

I have set up a generic camera configured with rtsp stream url. The camera works fine when viewed in lovelace but when i call the snapshot service, instead of saving the realtime image, an image from earlier time is saved. i dont know how this happens. This earlier time can be hours back or minutes back from calling snapshot service.

Sometimes if we call the service again, it will save the realtime image.

Why is this happening? Any solutions.

I have notice the same issue. Same camera with two automations.

The first one make a snapshot and the second makes a video. They both run same time. The snapshot is an image of a previous time/date while the video is current.

Did you found any solutions for this?

somehow it solved itself. Maybe new updates.

I am in the latest version and last night the problem is still there. Its very strange actually. Sometimes it works but most of the times it does not not. It almost always gives me snapshot of the previous time it was requested to take snapshot.

For example if I run the snapshot at 9:00pm it will save a snapshot of the previous time it was run, say 8:50pm. If I run it again at 9:05pm it will save a snapshot of the 9:00pm time (the time it was last run)

If I run again next morning, say 10:15am it will give me a snapshot of the 9:05pm last night and so on.

I also note that the filename of the snapshot it actually updating correctly. For example when I run it at 10:15 am and gives me a snapshot of the 9:05pm the file is actually saved/change on the 10:15am. So the automation does run when is requested and the snapshot is saved but what is saved is an older version of it.

My code to take snapshot is very simple. I only do this:

service: camera.snapshot
data:
  filename: /media/camera/camera_1.png
target:
  entity_id: camera.192_168_1_190

Maybe someone can see something I do not and can shed some more light on this

Check out this:

This is so annoying, hopefully they fix it. Make a comment there may increase the popularity, hopefully get enough attention for them to fix this.

I discovered I can use the custom component WebRTC (AlexxIT) to take snapshots of my RTSP feeds instead of the camera.snapshot. The component runs a go2rtc server on my home assistant installation which is used to pull frame grabs from the RTSP stream.

http://home_assistant_ip:1984/api/frame.mp4?src=camera_name

I use this URL in my telegram notifications, it doesn’t work with the mobile application notifications.

i have been trying this for a while but i can´t get snapshots. Reading about it i have to rename src=camera_name with the name of go2rtc stream but i don´t know whats is that stream name. In my go2rtc the stream name is the url (rtsp://admin:pass+@ip:port/Streaming/Channels/101).

Is it right?

Can you show me a real URL example?

Update:

An error appears after get the service:

Can’t send file with kwargs: {‘url’: 'http://home_assistant_ip:1984/api/frame.mp4?src=camera_name

Thanks a lot

You won’t be grabbing the frame from the camera, rather from the go2rtc service running on home assistant. The IP in the URL is the IP of my home assistant and the go2rtc service is running on port 1984. You can test it by just pasting the URL into your browser.

My YAML is:

service: notify.tony_telegram
data:
  message: ""
  data:
    photo:
      caption: Front yard {{now().strftime("%H:%M:%S")}}
      url: http://100.0.0.100:1984/api/frame.mp4?src=front_yard

Ok, i understand.

But according your example where do you get the camera name (front yard)??? Then you put in the src= as front_yard.

In my go2rtc web the name of the streams is showed as the complete url; for example rtsp://user.pass@ip… not as a name like you.

Do you understand me?

Thanks

I forgot the whole sequence, maybe you need to add the cameras to go2rtc manually as well:
navigate to “http://100.0.0.100:1984” click on STREAMS from top menu to see the configured cameras where you can obtain the link. If there are no streams, click on ADD to add each camera to go2rtc

Screenshot 2023-12-26 123923

For some reason I added front_yard twice with different names, you do not need to do that.