Display camera in dashboard

Hi,
I have one Reolink RLC-510wa wifi and after reading this post ..

I download the flow of @BartButenaers
and set this string:
...
ffmpeg -rtsp_transport tcp -i "rtsp://192.168.1.16:554/user=xxxx_password=xxxx_channel=0_stream=1.sdp?real_stream" -filter:v fps=fps=5 -f image2pipe pipe:1
...
(user and pwd are the correct ones of course)
but don't works.

Can you help me?

What's means rc:1 (yellow)?

It means the command in the exec node has failed. Check what is on the other two outputs of the node for more information. Set the debug nodes to show Complete Message and you should find some error information.

1 Like

When ffmpeg is piping out jpeg buffer, it will be broken into chunks if it is bigger than your system's piping chunk size limitation. Either reduce the size output of the jpeg so that it is a small enough to fit in a single chunk or catch all of the buffer chunks and reassemble them into a complete jpeg after ffmpeg spits them out.

scaling jpeg size:
https://trac.ffmpeg.org/wiki/Scaling

reassemble the chunks:
The option for catch the chunks and reassembling them can be done by installing node-red-contrib-pipe2jpeg and placing that node in between the exec node and image preview node.

1 Like

Well, it has improved but I have not the image, but speedy flash ....

I have installed node-red-contrib-pipe2jpeg ....

and I have change the command insert this string:

ffmpeg -rtsp_transport tcp -f rtsp -i rtsp://admin:xxxxx@192.168.1.16:554/h264Preview_01_main -f image2pipe pipe:1

because this command:

ffmpeg -rtsp_transport tcp -i "rtsp://192.168.1.16:554/user=admin_password=xxxxxx_channel=0_stream=1.sdp?real_stream" -filter:v fps=fps=5 -f image2pipe pipe:1

or this command:

ffmpeg -rtsp_transport tcp -i "rtsp://192.168.1.16:554/user=admin_password=xxxxx_channel=0_stream=0.sdp?real_stream" -filter:v fps=fps=5 -f image2pipe pipe:1 pipe2jpeg

don't works and the error is:

Server returned 401 Unauthorized (authorization failed)

but I don't understand why ....

(my platform is pc i3 - kubuntu 20.04)

Any ideas ?

It means what it says... The camera doesn't like either the credentials or the method of sending them.

does your rtsp statement

rtsp://192.168.1.16:554/user=admin_password=xxxxx_channel=0_stream=0.sdp?real_stream 

work if entered into a browser address bar?

Doing a google search of 'rtsp user password' gets results that suggest the format should be:

rtsp://[username:password@]ip_address[:rtsp_port]/server_URL[[?param1=val1[?param2=val2]…[?paramN=valN]]

you might want to try it that way and lookup the format the RTSP statement should be.

@zenofmud
Ok, this is the summary ......

rtsp://admin:xxxxxx@192.168.1.16:554/h264Preview_01_main
This string work fine in VLC (I see the cam's video without problems); to say that's user and password are correct; probably is from this string that I can start, but I don't know how to set correctly for node red ....

I tried to insert this string:
ffmpeg -rtsp_transport tcp -f rtsp -i rtsp://admin:xxxxx@192.168.1.16:554/h264Preview_01_main -f image2pipe pipe:1

and I have some speedy flash of the image from the cam (problem of buffer?)

rtsp://192.168.1.16:554/user=admin_password=xxxxx_channel=0_stream=0.sdp?real_stream
If I use this string in a browser address bar, I have a request to enter user and password again but nothing user and pass are accepted.

The string you have found on google is that I use in vlc ......

RTSP is generally NOT supported in browsers... and the dashboard is somewhat like a browser in terms of HTTP/CSS support.

VLC does the conversion, so just because it works there means nothing for running it elsewhere... but it is useful for confirming the URL command works and the camera actually streams.

It seems that for Node-Red, the RTSP streams would need to be converted to something else, which FFmpeg does (FFmpeg must be installed on the rpi, or whatever you are using to run NR). But whatever command you are using to do the conversion may be the issue.

Depending on the cameras I used, one of these worked for me... You will have to Google for and test various ones for your camera.

ffmpeg -y -i "http://<USER>:<PASS>@<IP>:<PORT>/streaming/channels/102/picture" -vframes 1 -qscale:v 2

ffmpeg -y -i "rtsp://<USER>:<PASS>@<IP>:<PORT>/cam/realmonitor?channel=1&subtype=0" -vframes 1 -qscale:v 2

I processed it as such: Set the path/name for a *.jpg, run the FFmpeg command, retrieve the *.jpg and display it, rinse repeat. This basically gave a viewable slideshow.

[{"id":"b0c191b669811a54","type":"file in","z":"a0650d3b89aad075","name":"Grab image","filename":"/home/pi/node-red-static/test_image.jpg","format":"","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":610,"y":720,"wires":[["23f6fbeb52f7d6b1"]]},{"id":"e4e2f4bf13d318bd","type":"exec","z":"a0650d3b89aad075","command":"ffmpeg -y -i \"http://<USER>:<PASS>@<IP>:<PORT>/<PATH_AND_COMMAND>\" -vframes 1 -qscale:v 2","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"Grab a frame -> jpg","x":390,"y":740,"wires":[["b0c191b669811a54"],[],[]]},{"id":"fe1ca58fbde0196b","type":"change","z":"a0650d3b89aad075","name":"Set filename","rules":[{"t":"set","p":"payload","pt":"msg","to":"/home/pi/node-red-static/test_image.jpg","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":760,"wires":[["e4e2f4bf13d318bd"]]},{"id":"23f6fbeb52f7d6b1","type":"base64","z":"a0650d3b89aad075","name":"Encode","x":600,"y":760,"wires":[["58c91758b35b0a9e"]]},{"id":"58c91758b35b0a9e","type":"image","z":"a0650d3b89aad075","name":"","width":160,"data":"payload","dataType":"msg","thumbnail":false,"active":true,"pass":false,"outputs":0,"x":940,"y":740,"wires":[]},{"id":"576c948a4e72b40e","type":"inject","z":"a0650d3b89aad075","name":"Trigger","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":170,"y":720,"wires":[["fe1ca58fbde0196b"]]}]

HOWEVER!!...

I eventually found it better to find a MJPEG URL for my camera (most seem to still support one) and use @BartButenaers's node-red-contrib-multipart-stream-decoder

[{"id":"0795688882464f6a","type":"image","z":"9f08acfb5108874a","name":"","width":160,"data":"payload","dataType":"msg","thumbnail":false,"active":true,"pass":false,"outputs":0,"x":1020,"y":840,"wires":[]},{"id":"fb1c03144d31d3f1","type":"multipart-decoder","z":"9f08acfb5108874a","name":"","ret":"bin","url":"","tls":"","delay":0,"maximum":1000000,"blockSize":1,"x":470,"y":880,"wires":[["7f7c82f4f6e58636"]]},{"id":"7f7c82f4f6e58636","type":"base64","z":"9f08acfb5108874a","name":"Encode","action":"","property":"payload","x":660,"y":880,"wires":[["0795688882464f6a","1c68d7aeb974ad21"]]},{"id":"cdb868c3be8533ea","type":"inject","z":"9f08acfb5108874a","name":"Start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":170,"y":820,"wires":[["b3fa45befadf1321"]]},{"id":"b3fa45befadf1321","type":"change","z":"9f08acfb5108874a","name":"MJPEG URL","rules":[{"t":"set","p":"url","pt":"msg","to":"http://<USER>:<PASS>@<IP>:<PORT>/<PATH_AND_COMMAND>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":860,"wires":[["fb1c03144d31d3f1"]]},{"id":"64181c078d3e0296","type":"inject","z":"9f08acfb5108874a","name":"Stop stream","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"true","payloadType":"bool","x":190,"y":940,"wires":[["209afe35dd346ef3"]]},{"id":"209afe35dd346ef3","type":"change","z":"9f08acfb5108874a","name":"","rules":[{"t":"set","p":"stop","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":900,"wires":[["fb1c03144d31d3f1"]]},{"id":"1c68d7aeb974ad21","type":"ui_template","z":"9f08acfb5108874a","group":"619cc9357a067deb","name":"Dashboard View","order":5,"width":8,"height":5,"format":"<style>\n    img {\n        border: 10px solid #999;\n        border-radius: 8px;\n        padding: 2px;\n        width: 300px;\n    }\n</style>\n\n<center>\n    <table>\n        <tr>\n            <!-- Row 1 -->\n            <td style=\"text-align: center\"><img src=\"data:image/jpg;base64,{{msg.payload}}\" /></td>\n        </tr>\n    </table>\n</center>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":840,"y":900,"wires":[[]]},{"id":"619cc9357a067deb","type":"ui_group","name":"Multicams","tab":"73890071.f55b","order":6,"disp":true,"width":24,"collapse":false},{"id":"73890071.f55b","type":"ui_tab","name":"ESP32CAM & IP Cams","icon":"linked_camera","order":10,"disabled":false,"hidden":false}]
1 Like

Thank you ...

In
<PATH_AND_COMMAND>

What should I put ?

That's the part you need to research/test based on your camera make and model. And some of them may want the user and password in a different position.

https://www.google.com/search?q=Reolink+RLC-510wa+Streaming+URL

https://www.google.com/search?q=Reolink+RLC-510wa+mjpeg+URL

Ok, thank you again ....