Streaming video from uv4l to Blynk using nodered

Personally, Iā€™d find it easier if you asked your question directly in this forum rather than linking to a question that youā€™ve asked elsewhere, but maybe thatā€™s just me being lazy and not wanting to click on external links.

First of all, you need to forget the fact that youā€™re using Node-Red as far as the video widget is concerned. The video stream (when youā€™re able to generate one) will go from the video source direct to the Blynk app - not via Node-Red (and I donā€™t think it even goes via the Blynk server).

If you search THIS forum for information about using the video streaming widget using the RPI camera as a data source then youā€™ll get some pointers.
You basically need to find a way of generating a data source thatā€™s compatible with the video stream widget and point the widget at that URL.

Iā€™ve done this successfully using a CCTV camera that generates an RTSP stream, in a project where everything else Blynk related is handled via Node-Red (when using the iOS version of the app).

Pete.

1 Like

@PeteKnight, thanks. Iā€™m using uv4l streaming video

##################################

raspicam driver options

##################################
encoding = mjpeg
width = 640
height = 480
framerate = 15

when I type in my browser http://192.168.0.20:8080/stream I can see the streaming video. I have tried lower resolution and lower frame rate. In blynk Video widget I put the same URL address, but I am getting only ā€œerrorā€

Is it incompatible with Blynk Video Stream widget?

solved it, after searching found a solution here Blynk-video streaming with RPI camera by using uv4l . The correct url is in my case http://192.168.0.20:8080/stream/video.mjpeg

1 Like

@PeteKnight, do you have a lag of about 3s on local server and about 5s on cloud server with video streaming like i experience? When streaming on local network without Blynk server it is smooth and fast, no (visible) lag.

Correct, it is just the App picking up what the phone can access via itā€™s network connection.

Yes, there will be variable lagā€¦ Blynk is not a dedicated video viewing App, so much other stuff happening in background.

I only use the cloud server, but the lag should be the same as the data isnā€™t going via the server.
My lag was around 1 second, but Iā€™d guess it depends on your network, device RSSI, video resolution, RPI processor speed and available memory, Android/iOS device speed/RSSI, and whether you made a sacrifice to the Blynk gods today :zap:

Pete.

@Gunner, @PeteKnight, no good for my application. Is there at least a way to get a video/screen capture on Blynk or another way to stream video on global Internet?

Iā€™m not really clear what youā€™re asking here.

Yes, there are lots of ways to stream video to the internet. Iā€™ve never tried any, as itā€™s not a requirement that Iā€™ve ever had. Products like iSpy have all sorts of bells and whistles, but Iā€™d suspect that something which creates an RTSP video steam and a viewer on the other end - with the appropriate ports opened in any firewall you may encounter along the way - should do it. Obviously this will be outside of Blynk - or at best in a Blynk Webpage Button widget.

Iā€™m not sure that youā€™ll eliminate lag that way though. If anything, once you start pushing data across the internet speeds are likely to slow dramatically compared to viewing the same data across your home network.

Maybe if you explain a bit more about what it is youā€™re trying to achieve we might come up with an ā€˜outside of the boxā€™ idea.

Pete.

@PeteKnight, thanks. I will take a snapshot from camera and will try to send it as a picture. My goal is to be able to access remotely from anywhere in the world things in my garden (monitoring and control) and the short real time video would be nice, but for now I will stay with a snapshot (hopefully it will work).
Cheers
Jan

Look at using the Image Widget as referenced in this recent topic.

Iā€™m struggling as well for now. I am able to take a snapshot from Raspicam and have a file snapshot.jpeg. How to send it to Blynk server?

Okay, I think I was a bit confused by the fact that I said:

and you replied:

I thought you were looking for zero lag, but I think now youā€™re saying that itā€™s the implied fact that this only works when your RPI and phone are attached to the same network that wonā€™t work for you.
In that case, have you tried port forwarding and a DDNS service?

Youā€™d probably need to create you mjpeg stream on a different port to 8080 - maybe 8081 - then sert up a rule in your router where request for data on port 8081 are re-directed to http://192.168.0.20:8081

Pointing your video widget to [your public IP address]:8081/stream/video.mjpeg should then work when you use 3G data on your phone rather than connecting to your Wi-Fi network.
If it does, then go ahead and set-up a DDNS service such as NoIP.com (assuming you donā€™t have a static public IP address) and change your video widget so you replace your public IP with the DDNS IP (and set-up an update client to keep the DDNS service updated when your public IP changes).

Pete.

@PeteKnight, thanks for your comprehensive explanation. Currently Iā€™m investigating different possible option. After spending some time, I realized that sending a snapshot with Blynk doesnā€™t seem to be easy. I can take a snapshot on my RPi, but have no idea how to send it to Blynk server. Has anyone done it?

The image widget is very new and was in beta for a while. Some forum users have been pushing it to the limites, with mixed success, and there have been some improvements to the functionality along the way.

The widget is primarily used for ā€˜doing what it says on the tinā€™ and displaying images. These might be a series of animations that show the state of a garage door being raised or lowered, or a simple on/off indicator.

You can programmatically specify the image url and keep updating this, so you can display differently named snapshot images to show the latest image from your series of snapshots.

There are a couple of threads about the experimentation that users have been doing, but be aware that the widget functionality changed several times during these discussions, based on issues identified and ideas that were suggested.

Personally, I donā€™t think itā€™s the best soloutuon for your particular situation, but if you search out the image widget threads and read them, then think it sounds like something youā€™d like to try then by all means give it a go.

Bear in mind that if youā€™re using the cloud servers then the server needs to be able to ā€˜seeā€™ the image, so it will have to be in a public ally accessible location.

Pete.

@PeteKnight, can the image url be itā€™s location on RPi filesystem or should it be a network resource (html server)?

It can be. I use this program on my RPi to ā€œserveā€ the images, which are stored in their own folder in my Blynk folder on my RPi, just to keep it all together for backup purposes.

https://docs.python.org/2/library/simplehttpserver.html

If you want it accessible outside of your network then that is simple port forwarding in your router.

@Gunner, thanks. I did it with nodered following the instruction from here https://cookbook.nodered.org/http/serve-a-local-file .I see the snapshot in Blynk, but it doesnā€™t refresh. When I make another snapshot the image URL shows it, but the one in Blynk stays not updated, even if I stop and restart Blynk on my iPhone.

Even if log out or terminate blynk it remembers the old image, even if I delete it and enter URL again. How to fix it?

Reread that last topic I referenced, that user alternated between two image placeholders.