How can i live stream on my dashboard?

Hi guys, what kind of nodes or new modules should i use? . I want to stream from a pi camera connected in my rpi. Im working with node red in my personal computer w10, and i want to send the images to my node red using mqtt or other stuff. What should i do?

Hi Pablo,
You might have a look at this. I 'think' you need option 4.
Bart

1 Like

Hi Bard, i have just send images from my script in python using mqtt, i converted the captured image into an array and sent it to the topic. But now, how can i show the image on the dashboard?

Here is the flow I use to display MQTT images on my Node-RED dashboard.
This is what it looks like;

Here is the flow;

[{"id":"ec36a139.98c918","type":"mqtt in","z":"a5dc5c12.f1a1a","name":"","topic":"RainRadar","qos":"2","datatype":"auto","broker":"","x":870,"y":520,"wires":[["936e58e7.0e1a7"]]},{"id":"936e58e7.0e1a7","type":"base64","z":"a5dc5c12.f1a1a","name":"","action":"","property":"payload","x":1040,"y":520,"wires":[["f221d617.4c46a"]]},{"id":"f221d617.4c46a","type":"template","z":"a5dc5c12.f1a1a","name":"Image in","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img src=\"data:image/png;base64,{{payload}}\"style=\"width=\"569\" height=\"197\"\"/>","output":"str","x":1200,"y":520,"wires":[["b2f83f0e.fcdb08"]]},{"id":"b2f83f0e.fcdb08","type":"ui_template","z":"a5dc5c12.f1a1a","group":"d9e398d4.2dc738","name":"Rain Radar Image","order":8,"width":"15","height":"15","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1410,"y":520,"wires":[[]]},{"id":"d9e398d4.2dc738","type":"ui_group","z":"","name":"groov RIO","tab":"539bd85f.f4a988","order":1,"disp":true,"width":"26","collapse":false},{"id":"539bd85f.f4a988","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

Option 4 for the win.

1 Like

Ok, i have just copied it. How do you send the array using python to the mqtt?. What i do is capture an image and processed it to an array.

This is a Node-RED forum, not a Python forum. Use Google to find out how to write the Python code to send data to MQTT.
Once you have your data sent to your topic, use the code listed above to put the array back to a string or perhaps a buffer. Look at using the built in 'Join' node to do that. Feed the output of that into the flow.

Hi sir, i wrote the code and it is working, but the refresh is low.

what size is the image you are sending?

You are unlikely to get 25fps. the pi is not super fast, sending an image over MQTT will introduce delays then there is the a websocket -> dashobard!

If you need high refresh, then use something like ffmpeg for vlc to generate a stream that is html5 compatible & have your dashboard template point at your stream. (or use something like jwplayer.js)

PS, it may also be your stream is slow - use VLC on the Pc to check the framerate of the stream.

Uf i wish but i dont know what ffmpeg is and dont know how to stream in vlc + template to my stream to appear on my dashboard ;(

https://www.raspberrypi.org/forums/viewtopic.php?t=184515

https://raspberry-projects.com/pi/pi-hardware/raspberry-pi-camera/streaming-video-using-vlc-player

tonnes and tonnes of threads on the internet on these topics.

If you can get streaming working, displaying a compatible stream in dashboard will be relatively simple. eg https://ipcamtalk.com/threads/how-to-use-vlc-to-transcode-ip-video-to-an-html5-compatible-format.1371/

I would use mjpg-streamer on the Pi to stream it from the Pi. Then you can look at in a browser, or in an iframe in the dashboard for example.

Where can i find how to install and use mjpg?

Assuming you mean mjpg-streamer then I suggest try your favourite search engine. It is either that or I spend time looking in my notes to find it, which actually I wouldn't do if I wanted it again myself. I would search for it. I imagine if you google for something like
streaming with mjpg-streamer on a pi
then it will find useful stuff.

2 Likes