Snapshop from a video stream

I am using a template node for streaming video. This stream is from a esp32 CAM and is working fine with a good fps rate; so I don't want to change this.
code:

/style
img src="http://192.168.x.x" width="200px"

Is there a way to grab a picture from this stream and save it? I tried a lot of solutiotions, but after 2 days (and nights) I still haven't found the right way. Sometimes I had something working, but than my fps rate gets too low. I hope that someone had the same problem with the right solution and want to share it.

Thanks in advantage

Hi Ino,
Do you want to take a snapshot in your browser, and store it on the pc where your browser is showing your dashboard? Or do you want to take a snapshot in your Node-RED flow, and store it on the device where your Node-RED flow is running?
Bart

If I remember correctly, those ESP32 cams serve a motion JPEG stream. So saving the "image" in the browser won't work, as it tries so save the stream indefinitely.

I have been using this approach for my Motion based webcams, serving MJPEG as well.

Basically it uses ffmpeg via an exec node. It captures exactly one frame (a single jpeg) that is sent via stdout back to Node-RED.

Hello Bart,

Thanks for the reply!

I want to take a snapshot in my Node-RED flow and store it on the device where the Node_RED flow is running; a Raspberry Pi. I tried some of your nodes and the most interesting is multipart- stream-decoder, but the fps rate is significant decreasing when I use this node. For my application this is not prefarable because I want to make a snapshot in an occurring suddenly, situation and look back later.

FYI I will use it onboard of a (sailing) vessel and past year I had a discussion (and damage) caused by an accident with another ship.

Kind regards, Ino

Ah, I wasn't aware of that.
It is written in Javascript so I will never be able to get the same performance as e.g. ffmpeg. But I have been optimizing the code over and over again, so I had hoped that it would be at least usable... Especially since the ESP32 cam seems sends the Content-Lenght (i.e. the length of the image byte buffer) withing the stream: then my node just can copy entire images, without having to search for boundaries between images (which should be very fast).

Perhaps this is a bit off-topic, but what do you mean with "fps is decreasing significant"? I always put an node-red-contrib-msg-speed node in my flow when I want to measure the fps ...
Since I only use my own multipart decoder node for decoding mjpeg, I have no experience with other nodes. In that case you might have a look at the proposal from @kuema above...

Sorry to hear from your boat accident. But beside that, it is always nice to hear in which use case our contributions are being used :wink:

@BartButenaers, @kuema

Bart, to avoid misunderstandings, your multipart stream decoder works great and I already used it. In this case I try to get the highest fps rate to get a smooth 'flow' on my screen. Maybe I have overlooked something in your decoder and I have to try it again. In my case I got a slow refreshing view, but maybe its an EPS32 cam problem. I alsowill try the proposal of kuema.
In any case thanks for your contribution!

@kuema Thanks for your reply. I will install the required software and the flow. I will inform you about the results.

Kind regards,

Ino

Ok, then I have misunderstood your issue ...
How do you send the images to your dashboard: do you push the images to your dashboard? Because that can slow down due to the current setup of the socket.io websocket channel, when you push too much data through it. Cannot determine how you do it, because the template code snippet that you have shared seems to be only a part of it?
But perhaps that is not the issue, so the ffmpeg solution from Matthias might already solve everything ...

Unfortunately, I can't get it fixed;even the ffmpeg solution is not working. I am using the given code in the template node and it works fine for a video stream. So my next step will be doing something completely different and after a while pick it up again and try to export the image to a payload and than.....

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.