Image from IP Camera

2,748 views
Skip to first unread message

Mike Biddell

unread,
May 31, 2015, 3:59:39 AM5/31/15
to node...@googlegroups.com
Has anyone got any examples or retrieved images from an IP Camera?

I have attempted to do it but it crashes my node-red server.

I have a URL as follows:-


This returns a camera snapshot when typed into the browser URL (it's only 50K bytes or so)

So I have used Inject,  followed by HTTP request node, followed by my email

I set the HTTP node to GET, no authentication (as that is passed in the URL) and with binary buffer.

Then when I inject the HTTP node says retrieving and then loses comms with the server (I then have to reboot).
There is no output to the debug window, prior to the crash.

Any help would be gratefully received.

Mike

Nicholas O'Leary

unread,
May 31, 2015, 4:06:27 AM5/31/15
to node...@googlegroups.com

Don't have an example flow to hand, but have done exactly that sort of thing.

What do the node-red logs show?

Nick


--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Biddell

unread,
May 31, 2015, 4:10:32 AM5/31/15
to node...@googlegroups.com
Nick

Where are the logs and what are they called...... sorry to have to keep asking elementary questions !!!!!!!!

I presume they are only accessible via SSH?

Mike

Nicholas O'Leary

unread,
May 31, 2015, 4:19:29 AM5/31/15
to node...@googlegroups.com

Yes, you need to be logged. Where the logs are depends how you are running node-red.

If using pm2 as per our docs, you can use

    pm2 logs node-red

Nick

Dave C-J

unread,
May 31, 2015, 5:05:32 AM5/31/15
to node...@googlegroups.com

Nick,

There have been a couple of fixes to the http node since 0.10.6 that may be relevant

https://github.com/node-red/node-red/commit/38ab1550d2712265e2ee5ed295e037799c3da90f

Maybe grab the latest from git first... ?

Nicholas O'Leary

unread,
May 31, 2015, 5:08:39 AM5/31/15
to node...@googlegroups.com

I doubt Mike is running a proxy on his home network...

Let's get the logs and find out what the issue is first. Getting the logs is an easier task than upgrading to the code from git.

N


--
Message has been deleted

Nicholas O'Leary

unread,
May 31, 2015, 5:49:52 AM5/31/15
to node...@googlegroups.com

Fair enough... Didn't see that mentioned in the commit message. Would that cause a crash like Mike describes...?


On Sun, 31 May 2015 10:41 Dave C-J <dce...@gmail.com> wrote:
That fix also fixed an error where for buffer payload (like Mike does have) it was returning the incorrect Content-Length header..

Dave C-J

unread,
May 31, 2015, 5:56:08 AM5/31/15
to node...@googlegroups.com
Well - it depends what length does get reported... it may just hang waiting for data that never arrives - or it may try to allocate a massive space for the data, and blow it's stack. Must admit when it wasn't working for me it was non-fatal (on laptop) - and just hung waiting - so could be something else - so yes let's start with the logs... but...

Mike Biddell

unread,
May 31, 2015, 5:56:13 AM5/31/15
to node...@googlegroups.com
errrr

I'm struggling to find log files (I'm running thethingbox)

I searched from root for *.log files and got:-

root@thethingbox / # find . -name *.log -print
./var/log/daemon.log
./var/log/lightdm/x-0-greeter.log
./var/log/lightdm/x-0.log
./var/log/lightdm/lightdm.log
./var/log/kern.log
./var/log/auth.log
./var/log/dpkg.log
./var/log/alternatives.log
./var/log/user.log
./var/log/lpr.log
./var/log/mosquitto/mosquitto.log
./var/log/Xorg.0.log
./var/log/mail.log
./var/log/apt/term.log
./var/log/apt/history.log
./root/thethingbox/node_modules/node-red/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/libpeerconnection.log
./root/thethingbox/node_modules/node-red/node_modules/grunt/node_modules/grunt-legacy-log/node_modules/underscore.string/libpeerconnection.log
./root/thethingbox/node_modules/node-red/node_modules/mongodb/node_modules/kerberos/builderror.log
./root/thethingbox/node_modules/node-red/node_modules/mongodb/node_modules/bson/builderror.log
./root/thethingbox/npm-debug.log

Is npm-debug.log, the log file we are looking for??

mike

Nicholas O'Leary

unread,
May 31, 2015, 6:14:15 AM5/31/15
to node...@googlegroups.com

I can't remember how thethingbox runs node-red, or where it puts the log.

I'm sure its been mentioned on this list before, but I can't immediately find it.

Nicolas/thingbox team - are there any docs you point your users at for this sort of thing?

Nick

Mike Biddell

unread,
May 31, 2015, 11:55:28 AM5/31/15
to node...@googlegroups.com
Chaps

I set up a guest account on my IP camera and wondered if anyone else could have a go !!!!


The above URL returns a snapshot thru my porch camera !!! So theoretically a GET with binary set, should email the snap !!!

It would be interesting to see whether it works for anyone else !!!

Mike

Max Hadley

unread,
May 31, 2015, 12:23:26 PM5/31/15
to node...@googlegroups.com
It worked for me!

Max

Mike Biddell

unread,
May 31, 2015, 12:27:08 PM5/31/15
to node...@googlegroups.com
Max

from within a node red flow????

could u send me the flow.... I'm obviously doing something wrong????

It's annoying .... not knowing enough LOL !!!!!

cheers

Mike

On Sunday, 31 May 2015 17:23:26 UTC+1, Max Hadley wrote:
It worked for me!

Max

Edward Vielmetti

unread,
May 31, 2015, 12:38:43 PM5/31/15
to node...@googlegroups.com, mike.b...@googlemail.com
worked for me Mike! thanks Ed

Dave C-J

unread,
May 31, 2015, 12:39:49 PM5/31/15
to node...@googlegroups.com
Mike

Just sent you an email using the slow below... - of course it has your credentials in - so please block at some point....


[{"id":"3d8f4de6.c270b2","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":137,"y":240,"z":"f307b843.0cf848","wires":[["a4078f78.5bf87"]]},{"id":"a4078f78.5bf87","type":"http request","name":"","method":"GET","ret":"bin","url":"http://mikebid.dyndns.ws:22222/snapshot.cgi","x":329,"y":191,"z":"f307b843.0cf848","wires":[["8fdd66f.f702298","7afe5ab.f8501a4"]]},{"id":"8fdd66f.f702298","type":"debug","name":"","active":true,"console":"false","complete":"false","x":547,"y":265,"z":"f307b843.0cf848","wires":[]},{"id":"7afe5ab.f8501a4","type":"function","name":"Add attributes","func":"msg.topic = \"Test Picture for Mike\";\nmsg.description = \"This is some body text to go with the picture;\"\nmsg.filename = \"testpic.jpg\";\nreturn msg;","outputs":1,"noerr":0,"x":547,"y":206,"z":"f307b843.0cf848","wires":[["2ee4fccc.d11b04"]]},{"id":"2ee4fccc.d11b04","type":"e-mail","server":"smtp.gmail.com","port":"465","name":"mike.b...@googlemail.com","dname":"","x":795,"y":227,"z":"f307b843.0cf848","wires":[]}]

Dave C-J

unread,
May 31, 2015, 12:44:19 PM5/31/15
to node...@googlegroups.com
PS - you need to put the userid and password into the basic authentication credentials fields - nodered etc...

Mike Biddell

unread,
May 31, 2015, 12:54:28 PM5/31/15
to node...@googlegroups.com
Chaps 

Incidentally.... that view from the cam, is directly of the old Watling street....... if you could turn the clock back 2,000 years, there would be Roman soldiers wandering by !!!!!

Mike

Mike Biddell

unread,
May 31, 2015, 12:56:54 PM5/31/15
to node...@googlegroups.com
Oh and incidentally...

I'm rambling now..... u can see my drive 433 Mhz PIR above the white car !!!!

mike

Mike Biddell

unread,
May 31, 2015, 2:24:18 PM5/31/15
to node...@googlegroups.com
Dave

all working...... I naively expected the mail to go with no attributes i.e. a blank message with the snapshot attached. So add attributes was the missing piece of the jigsaw.... I now have doorbell, snapshot, email working !!! Node-red just gets better and better...... I need to add speech next  (I have a powered amp attached to the raspberry pi) !!!! And Amazon Echo integration (when I get one).

Mike

On Sunday, 31 May 2015 17:44:19 UTC+1, Dave C-J wrote:

Dave C-J

unread,
May 31, 2015, 2:53:11 PM5/31/15
to node...@googlegroups.com
Mike,

yeah I think it ought to do "something" when no extra attributes set.... so will make it so. 

Dave C-J

unread,
May 31, 2015, 3:29:25 PM5/31/15
to node...@googlegroups.com
Fix pushed to git to try to set a default name for occasions when a buffer "just arrives".

Mike Biddell

unread,
May 31, 2015, 4:13:23 PM5/31/15
to node...@googlegroups.com
Blimey Dave

shouldn't u be drinking wine ???

I'm on my 3rd bourbon after 3 wines !!! Well it is the weekend !!!!

Mike

Dave C-J

unread,
May 31, 2015, 4:17:49 PM5/31/15
to node...@googlegroups.com

That was last night ! Slow start today.

Julian Knight

unread,
May 31, 2015, 7:23:33 PM5/31/15
to node...@googlegroups.com, mike.b...@googlemail.com
Got the picture fine but can't send it! For some reason, GMail won't let me send though I know the ID/pw is correct

And I can't use my own email server because it has a self-signed cert and the email node gives the error:

Error: Hostname/IP doesn't match certificate's altnames

Mike Biddell

unread,
Jun 1, 2015, 3:50:03 AM6/1/15
to node...@googlegroups.com, mike.b...@googlemail.com
Julian

I just imported Dave's flow and it worked. In Dave's flow, the HTTP GET is followed by an attribute function which sets mail header and filename etc, then this is followed by an email node. Some Mail Systems can be iffy about blank messages with attachments only (but u probably know all this anyway). 

The camera I am using is a cheap FOSCAM clone (steerable and with audio). It is only 640 x 480, but the image quality is more than good enough for facial recognition and number plates of cars coming into our close. 

Mike

Dave C-J

unread,
Jun 1, 2015, 6:17:24 AM6/1/15
to node...@googlegroups.com
ooo... what s/w do you use for Number plate reco ?

Mike Biddell

unread,
Jun 1, 2015, 8:38:20 AM6/1/15
to node...@googlegroups.com
ooopppss

mislead you there Dave..... Ninjablock emails me the Piccy (soon to be node-red, now snapshot is working) and I recognise the number plate. But you have got me thinking there......!!!!! OCR from the piccy surely should be possible, then a lookup on the DVLA website !!!!! The node-red possibilities are endless.

Mike

Dave C-J

unread,
Jun 1, 2015, 8:42:29 AM6/1/15
to node...@googlegroups.com
ah - bio-computing, or mechanical turk :-)

Shem Jamieson

unread,
Jun 1, 2015, 9:33:07 AM6/1/15
to node...@googlegroups.com
Thanks Mike & Dave, worked for me. I had never tried using Node-red for this before but the public IP camera and the flow made it all-to-easy to try out!

On Sunday, 31 May 2015 17:29:39 UTC+9:30, Mike Biddell wrote:
Has anyone got any examples or retrieved images from an IP Camera?

I have attempted to do it but it crashes my node-red server.

I have a URL as follows:-


This returns a camera snapshot when typed into the browser URL (it's only 50K bytes or so)

So I have used Inject,  followed by HTTP request node, followed by my email

I set the HTTP node to GET, no authentication (as that is passed in the URL) and with binary buffer.

Then when I inject the HTTP node says retrieving and then loses comms with the server (I then have to reboot).
There is no output to the debug window, prior to the crash.

Any help would be gratefully received.

Mike

Mike Biddell

unread,
Jun 1, 2015, 9:45:28 AM6/1/15
to node...@googlegroups.com
Shem

That did occur to me when I set up the guest account i.e. a number of people could have a go....... I'll leave it up for a bit, for other people to try !!!!

Mike

Edward Vielmetti

unread,
Jun 1, 2015, 1:37:55 PM6/1/15
to node...@googlegroups.com
I've used openalpr for license plate recognition, acceptably speedy on a fast Intel machine, don't know how speedy it would be on a Pi or Pi 2. It uses OpenCV for image processing. 

thanks 

Ed

--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Biddell

unread,
Jun 1, 2015, 1:53:43 PM6/1/15
to node...@googlegroups.com
ED

Thanks for the info 

Mike

Mike Biddell

unread,
Jun 1, 2015, 1:56:01 PM6/1/15
to node...@googlegroups.com

Julian Knight

unread,
Jun 1, 2015, 4:29:14 PM6/1/15
to node...@googlegroups.com
Hi Mike,

Yes, I used the same flow. I changed the email login though

Julian Knight

unread,
Jun 1, 2015, 4:31:11 PM6/1/15
to node...@googlegroups.com
Fairly sure I read somewhere that OpenCV is pretty unusable on a Pi, Pi2 might not be so bad though.


On Monday, 1 June 2015 18:37:55 UTC+1, Edward Vielmetti wrote:

Julian Knight

unread,
Jun 1, 2015, 4:32:56 PM6/1/15
to node...@googlegroups.com
OK, this thread is officially getting weird now!! :)

Dave C-J

unread,
Jun 1, 2015, 4:38:53 PM6/1/15
to node...@googlegroups.com


Compared to the "front door fun" one ? This is just getting started !

Swapan Sarkar

unread,
Jun 16, 2015, 3:27:45 AM6/16/15
to node...@googlegroups.com
FYI, if you are using thethingbox then the console log can be found at $cat /root/thethingbox/node_modules/node-red/public/console.txt
-swapan

Marko S

unread,
Mar 25, 2016, 9:24:25 AM3/25/16
to Node-RED
So did anyone of you guys do it and display it in node-red-contrib-ui?

Dne nedelja, 31. maj 2015 09.59.39 UTC+2 je oseba Mike Biddell napisala:

Timur Fatykhov

unread,
Mar 25, 2016, 12:30:42 PM3/25/16
to Node-RED
Here is sample flow that will re-direct image from camera to node-red instance to avoid CORS etc. This sample is for foscam camera . 

it's just sample but I am using similar thechnology to get snapshots from multiple cameras using node-red. with this flow you can type http://your-node-red-host/red/foscam_snapshot
 and it will return image.


[{"id":"3112a589.ceed5a","type":"http in","z":"d2eb9926.2d1468","name":"","url":"/red/foscam_snapshot","method":"get","swaggerDoc":"","x":242,"y":403,"wires":[["9100f3c0.6eff1"]]},{"id":"9100f3c0.6eff1","type":"function","z":"d2eb9926.2d1468","name":"","func":"\n var camera={\n     \"hostname\":\"192.168.1.15\",\n     \"uid\":\"user\",\n     \"pwd\":\"password\"\n }\n\n            var camera=context.global.FosCam[cam];\n            msg.url=\"http://\"+camera.hostname+\"/snapshot.cgi?user=\"+camera.uid+\"&pwd=\"+camera.pwd;\n            return msg;\n\n","outputs":1,"noerr":0,"x":475,"y":404,"wires":[["b052b7e3.4fad48"]]},{"id":"b052b7e3.4fad48","type":"http request","z":"d2eb9926.2d1468","name":"","method":"GET","ret":"bin","url":"","x":625,"y":403,"wires":[["bfee534d.4011b"]]},{"id":"bfee534d.4011b","type":"http response","z":"d2eb9926.2d1468","name":"","x":790,"y":403,"wires":[]}]

Timur Fatykhov

unread,
Mar 25, 2016, 12:34:24 PM3/25/16
to Node-RED

here is how it looks on UI (not node-red-contrib-ui but should not be any difference

Marko S

unread,
Mar 25, 2016, 5:26:40 PM3/25/16
to Node-RED
Thanks for the example. Looks cool!

Dne petek, 25. marec 2016 17.34.24 UTC+1 je oseba Timur Fatykhov napisala:

Timur Fatykhov

unread,
Mar 25, 2016, 5:52:17 PM3/25/16
to Node-RED
I have sample flows for several models. Some require digest authentication.
Also I have a flow that works with BlueIris software which supports lot of different camera models  (http://blueirissoftware.com/)

you can find them here:


They are adapted to work with blueMix instance including cloudant db for history snapshots etc. but except saving in the db everything else works with any setup

asher cohen

unread,
Jul 21, 2016, 10:28:43 AM7/21/16
to Node-RED
Sorry, I cannot understand Your flow. How does it work?

Timur Fatykhov

unread,
Jul 21, 2016, 3:25:18 PM7/21/16
to Node-RED
Asher,
I think I had extra line in the function node which I removed.
here is modified flow:
[{"id":"7a786dda.257cb4","type":"http in","z":"7197cfff.d585a","name":"","url":"/red/foscam_snapshot","method":"get","swaggerDoc":"","x":269,"y":217,"wires":[["6d3cd4d8.c6fb2c"]]},{"id":"6d3cd4d8.c6fb2c","type":"function","z":"7197cfff.d585a","name":"","func":"\n var camera={\n     \"hostname\":\"192.168.1.15\",\n     \"uid\":\"user\",\n     \"pwd\":\"password\"\n }\n\n            msg.url=\"http://\"+camera.hostname+\"/snapshot.cgi?user=\"+camera.uid+\"&pwd=\"+camera.pwd;\n            return msg;\n\n","outputs":1,"noerr":0,"x":502,"y":218,"wires":[["b98b4170.3dd09"]]},{"id":"b98b4170.3dd09","type":"http request","z":"7197cfff.d585a","name":"","method":"GET","ret":"bin","url":"","x":652,"y":217,"wires":[["fb8b2893.21c6d8"]]},{"id":"fb8b2893.21c6d8","type":"http response","z":"7197cfff.d585a","name":"","x":817,"y":217,"wires":[]}]

The way it works - I am creating a http in node with path /red/foscam_snapshot. when you access this endpoint from your browser, function node will generate a request to a foscam camera based on the local variable camera:

//this is javascript object describing camera.
 var camera={
     "hostname":"192.168.1.15",
     "uid":"user",
     "pwd":"password"
 }

            msg.url="http://"+camera.hostname+"/snapshot.cgi?user="+camera.uid+"&pwd="+camera.pwd; //this is a call to actual foscam camera based on foscam api definition for Fi89w model.
            return msg;

them it sends am http request which in return should give you a binary bufer with the image, and then you redirect that buffer back as a response to /red/foscam
Reason for this - you can either put your node -red instance in the cloud and then you can only allow that instance to access your local ip cameras or you can access your node-red instance remotely and you do not want to expose your actual cameras outside your firewall. going further you can add an path variable to your request and using same end point access multiple cameras inside your house, letting function node handle actual url generation and hiding your real cameras hostnames. etc. behind this "proxy" call

asher cohen

unread,
Jul 23, 2016, 1:01:06 PM7/23/16
to Node-RED
I will try tomorrow  .
I was using something similar, but i have problems showing a snapshot saved on the raspberry in an html ui node. How can I retrieve a jpg file from the raspberry and show it in a frame?Is there any permission issue that doesn't make me get the image?other links from the web work.

Timur Fatykhov

unread,
Jul 24, 2016, 10:04:30 AM7/24/16
to Node-RED
I think there are couple of options. Node red has public folder which has static Web content so you can copy image files into that folder. Other option would be to use read file node to get contents of the image file as binary buffer to http out node. You might need to set content type value for response header
Message has been deleted

Bart Ellast

unread,
Nov 17, 2016, 8:57:08 AM11/17/16
to Node-RED
I am trying this with a samsung ip camera.
I'm trying the following:

[{"id":"9245d236.2d5b9","type":"inject","z":"894c465c.5897a8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":250,"y":380,"wires":[["475924f9.d89f2c"]]},{"id":"3955c3d6.3a5e7c","type":"function","z":"894c465c.5897a8","name":"Add attributes","func":"msg.topic = \"Test Picture for Mike\";\nmsg.description = \"This is some body text to go with the picture;\"\nmsg.filename = \"testpic.jpg\";\nreturn msg;","outputs":1,"noerr":0,"x":600,"y":380,"wires":[["3db8e9d3.a28286"]]},{"id":"475924f9.d89f2c","type":"http request","z":"894c465c.5897a8","name":"","method":"GET","ret":"bin","url":"http://admin:x...@192.168.1.153/cgi-bin/video.cgi?msubmenu=mjpg","tls":"","x":410,"y":380,"wires":[["3955c3d6.3a5e7c"]]}]

This gives an empty jpg, when i set the output to string i get 401 unauthorised as output.
So it seems the authentication isn't working. But the url is definately working in a browser!

When i use this template:

[{"id":"883f3b4b.ff2408","type":"ui_template","z":"894c465c.5897a8","tab":"f67fe1d0.731c2","name":"vid","group":"","order":1,"format":"<iframe width=\"1280\" height=\"1024\" src=\"http://admin:x...@192.168.1.153/cgi-bin/video.cgi?msubmenu=mjpg\" frameborder=\"0\" allowfullscreen></iframe>","storeOutMessages":true,"fwdInMessages":false,"x":550,"y":600,"wires":[["3db8e9d3.a28286"]]},{"id":"f67fe1d0.731c2","type":"ui_tab","z":"894c465c.5897a8","name":"Home","icon":"dashboard","order":"1"}]

I get a working image on the ui!
Setting basic authentication with valid credentials doesn't work either!

I hope anyone can help!

Toshi Bass

unread,
Nov 17, 2016, 9:28:05 AM11/17/16
to Node-RED
Not sure if this will help, its not a samsung cam but this works for me.....

[{"id":"d045e8b7.de0198","type":"ui_template","z":"2fdfca3b.b1407e","group":"a2addb2.eac1c28","name":"","order":0,"width":0,"height":0,"format":"<!DOCTYPE html>\n<style>\niframe{ width:640px; height: 370px; overflow-x: hidden; overflow-y: scroll }\n</style>\n<iframe name=\"Frame3\" src=\"http://192.168.0.199:81/videostream.cgi?loginuse=XXXXXXXXX&loginpas=XXXXXXXX\" frameborder=\"5\"allowfullscreen>\n</iframe>","storeOutMessages":true,"fwdInMessages":true,"x":358,"y":261,"wires":[[]]},{"id":"a2addb2.eac1c28","type":"ui_group","z":"","name":"video feed","tab":"73b25dc4.93e1d4","order":1,"disp":false,"width":"12"},{"id":"73b25dc4.93e1d4","type":"ui_tab","z":"","name":"video feed","icon":"dashboard","order":10}]

Bart Ellast

unread,
Nov 17, 2016, 10:10:23 AM11/17/16
to Node-RED
I can use the cam feed on the ui fine with the second template i quoted.
What i want to do however is take a snapshot upon injecting something and sending it via email.
This is what my first quoted code should do, but fails to authenticate.

Toshi Bass

unread,
Nov 17, 2016, 11:01:31 AM11/17/16
to Node-RED
Sorry my misunderstanding
Reply all
Reply to author
Forward
0 new messages