Raspberry+camera module

All questions/comments regarding the Surveillance Station using IP Cameras may be placed here
Forum rules
We've moved! Head over to Synology Community (community.synology.com) to meet up with our team and other Synology enthusiasts!
BreeeZe
Rookie
Rookie
Posts: 35
Joined: Sun Apr 22, 2012 9:23 pm

Re: Raspberry+camera module

Unread post by BreeeZe » Thu Apr 02, 2015 10:48 pm

The code is now available @ https://github.com/BreeeZe/rpos

Shake3000
I'm New!
I'm New!
Posts: 1
Joined: Fri Apr 03, 2015 10:31 pm

Re: Raspberry+camera module

Unread post by Shake3000 » Fri Apr 03, 2015 10:44 pm

Hi Breeze, thanks so much for sharing your experiments :D I managed to get it all up and running today. However I had to drop some of the options from raspivid because i got a black screen, don't know which one caused it though.

this is what I run now, I also lowered the res a bit:

Code: Select all

raspivid -o - -fps 25 -t 0 -b 800000 -w 1280 -h 720  | ~/live/raspi/testRaspi
I'm running a pi 2 with a pi camera module on raspbian. I noticed you can't change the options for the capture in SS (it defaults to 1080 for instance) I guess that's a limitation of your onvif server? Next step is to get it all running when I boot the pi, I wish I wasn't such a linux noob, heh.

BreeeZe
Rookie
Rookie
Posts: 35
Joined: Sun Apr 22, 2012 9:23 pm

Re: Raspberry+camera module

Unread post by BreeeZe » Sat Apr 04, 2015 11:43 am

Shake3000 wrote:Hi Breeze, thanks so much for sharing your experiments :D I managed to get it all up and running today. However I had to drop some of the options from raspivid because i got a black screen, don't know which one caused it though.

this is what I run now, I also lowered the res a bit:

Code: Select all

raspivid -o - -fps 25 -t 0 -b 800000 -w 1280 -h 720  | ~/live/raspi/testRaspi
I'm running a pi 2 with a pi camera module on raspbian. I noticed you can't change the options for the capture in SS (it defaults to 1080 for instance) I guess that's a limitation of your onvif server? Next step is to get it all running when I boot the pi, I wish I wasn't such a linux noob, heh.
Hi Shake3000,

Great to hear you got it all running!

Indeed, you cannot change the resolution, framerate and quality yet, the Onvif server reports the available options to SS which at this moment are hardcoded.
You can however, as you have noticed, provide a h264 stream with a different resolution, there is no verification that the camera actually applied the requested settings.

To implement this feature I will need to start up the stream from the Onvif service itself, instead of you actually starting it from the commandline, which I plan on building soon.

I also need to provide a snapshot, which SS uses as a preview and in it's notification emails, but you cannot run "raspivid" and "raspistill" at the same time, which means I have to capture frames from the video stream, but I already found some example of how to do that :)

But first I'm writing a js code generator which generates method stubs with complete request and response parameter from a WSDL, which wil speed up implementation of other calls and options :) I'll probably have that done today.

BreeeZe
Rookie
Rookie
Posts: 35
Joined: Sun Apr 22, 2012 9:23 pm

Re: Raspberry+camera module

Unread post by BreeeZe » Sun Apr 19, 2015 5:03 pm

For anyone interested, the current version starts the stream by itself and the camera options (resolution/framerate) can be controlled through SS.
I haven't tested it thoroughly yet, so consider this code alpha. :)

Any feedback is appreciated.

ernieb
Trainee
Trainee
Posts: 17
Joined: Thu Mar 13, 2014 4:08 am

Re: Raspberry+camera module

Unread post by ernieb » Sun Apr 26, 2015 3:02 pm

Just found this on GitHub...Should work on the Pi since it's written in Python.

https://github.com/quatanium/python-onvif

BreeeZe
Rookie
Rookie
Posts: 35
Joined: Sun Apr 22, 2012 9:23 pm

Re: Raspberry+camera module

Unread post by BreeeZe » Sun Apr 26, 2015 3:06 pm

ernieb wrote:Just found this on GitHub...Should work on the Pi since it's written in Python.

https://github.com/quatanium/python-onvif
Wel yes, it will probably work, but it is a client implementation and not a server, so for this scenario it is quite useless ;)

ernieb
Trainee
Trainee
Posts: 17
Joined: Thu Mar 13, 2014 4:08 am

Re: Raspberry+camera module

Unread post by ernieb » Sun Apr 26, 2015 4:09 pm

BreeeZe wrote:For anyone interested, the current version starts the stream by itself and the camera options (resolution/framerate) can be controlled through SS.
I haven't tested it thoroughly yet, so consider this code alpha. :)

Any feedback is appreciated.
I have a error when I use the latest code from GitHub...

Code: Select all

 ~/rpos $ sudo node server.js
Manufacturer : Raspberry Pi
Model : B+
FirmwareVersion : 0.0.1
SerialNumber : 000000003bce416d
HardwareId :

Starting webserver on port: 81
Binding  to /onvif/device_service
Starting webserver on port: 81
Binding  to /onvif/media_service
device_service started
Starting Live555 rtsp server
Uncaught Exception...
Error: spawn EACCES
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1155:11)
    at exports.spawn (child_process.js:988:9)
    at Camera.startRtsp (/home/pi/rpos/lib/camera.js:96:21)
    at MediaService.started (/home/pi/rpos/services/media_service.js:55:17)
    at Service._started (/home/pi/rpos/lib/service.js:65:8)
    at Object.serviceOptions.onReady (/home/pi/rpos/lib/service.js:37:11)
    at null.callback (/home/pi/rpos/node_modules/soap/lib/server.js:70:17)
    at /home/pi/rpos/node_modules/soap/lib/wsdl.js:1058:12
    at /home/pi/rpos/node_modules/soap/lib/wsdl.js:1125:7
How do I troubleshoot this?

BreeeZe
Rookie
Rookie
Posts: 35
Joined: Sun Apr 22, 2012 9:23 pm

Re: Raspberry+camera module

Unread post by BreeeZe » Sun Apr 26, 2015 4:14 pm

ernieb wrote:
BreeeZe wrote:For anyone interested, the current version starts the stream by itself and the camera options (resolution/framerate) can be controlled through SS.
I haven't tested it thoroughly yet, so consider this code alpha. :)

Any feedback is appreciated.

Code: Select all

 ~/rpos $ sudo node server.js
Manufacturer : Raspberry Pi
Model : B+
FirmwareVersion : 0.0.1
SerialNumber : 000000003bce416d
HardwareId :

Starting webserver on port: 81
Binding  to /onvif/device_service
Starting webserver on port: 81
Binding  to /onvif/media_service
device_service started
Starting Live555 rtsp server
Uncaught Exception...
Error: spawn EACCES
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1155:11)
    at exports.spawn (child_process.js:988:9)
    at Camera.startRtsp (/home/pi/rpos/lib/camera.js:96:21)
    at MediaService.started (/home/pi/rpos/services/media_service.js:55:17)
    at Service._started (/home/pi/rpos/lib/service.js:65:8)
    at Object.serviceOptions.onReady (/home/pi/rpos/lib/service.js:37:11)
    at null.callback (/home/pi/rpos/node_modules/soap/lib/server.js:70:17)
    at /home/pi/rpos/node_modules/soap/lib/wsdl.js:1058:12
    at /home/pi/rpos/node_modules/soap/lib/wsdl.js:1125:7
How do I troubleshoot this?
Did you use 'sudo' ?
So : "sudo node server.js" ?

-edit: DOH, it says so in the log...
I'll have to check what it could be, I'll do that later today.
-edit again:
You probably have to set execute permission on the rtspServer file:

sudo chmod -R a+rwx ./bin/rtspServer

ernieb
Trainee
Trainee
Posts: 17
Joined: Thu Mar 13, 2014 4:08 am

Re: Raspberry+camera module

Unread post by ernieb » Sun Apr 26, 2015 4:31 pm

Code: Select all

sudo chmod -R a+rwx ./bin/rtspServer
That worked!

ernieb
Trainee
Trainee
Posts: 17
Joined: Thu Mar 13, 2014 4:08 am

Re: Raspberry+camera module

Unread post by ernieb » Sun Apr 26, 2015 5:13 pm

I don't see the verbose logging like you show in the Youtube video. I have the logLevel set 4 in config.js.

I'd like to see the logging to troubleshoot why my synology cannot connect to the Rpi.

Code: Select all

 ~/rpos $ sudo node server.js
Manufacturer : Raspberry Pi
Model : B+
FirmwareVersion : 0.0.1
SerialNumber : 000000003bce416d
HardwareId :

Starting webserver on port: 81
Binding  to /onvif/device_service
Starting webserver on port: 81
Binding  to /onvif/media_service
device_service started
Starting Live555 rtsp server
media_service started
rtspServer: Streaming on URL "rtsp://192.168.2.2:8554/h264"

(RTSP-over-HTTP tunneling is not available.)
I'm using port 81, and the IP of the Rpi in the SS config page. Also selected ONVIF and Generic_ONVIF for camera brand and model.

When I 'test' the connection via the test button, SS times out and I don't see any logging on the Rpi.

BreeeZe
Rookie
Rookie
Posts: 35
Joined: Sun Apr 22, 2012 9:23 pm

Re: Raspberry+camera module

Unread post by BreeeZe » Sun Apr 26, 2015 5:50 pm

ernieb wrote:I don't see the verbose logging like you show in the Youtube video. I have the logLevel set 4 in config.js.

I'd like to see the logging to troubleshoot why my synology cannot connect to the Rpi.

Code: Select all

 ~/rpos $ sudo node server.js
Manufacturer : Raspberry Pi
Model : B+
FirmwareVersion : 0.0.1
SerialNumber : 000000003bce416d
HardwareId :

Starting webserver on port: 81
Binding  to /onvif/device_service
Starting webserver on port: 81
Binding  to /onvif/media_service
device_service started
Starting Live555 rtsp server
media_service started
rtspServer: Streaming on URL "rtsp://192.168.2.2:8554/h264"

(RTSP-over-HTTP tunneling is not available.)
I'm using port 81, and the IP of the Rpi in the SS config page. Also selected ONVIF and Generic_ONVIF for camera brand and model.

When I 'test' the connection via the test button, SS times out and I don't see any logging on the Rpi.
If you set 'logSoapCalls' in the config to true it logs the content of all the soap calls, however without that setting it should still report the name of the call that is requested.

You can also browse to the pi and request the wsdl to test if the service is running.
In your case: http://192.168.2.2:81/onvif/media_service?wsdl (from the top of my head, can't double check right now)

ernieb
Trainee
Trainee
Posts: 17
Joined: Thu Mar 13, 2014 4:08 am

Re: Raspberry+camera module

Unread post by ernieb » Sun Apr 26, 2015 9:56 pm

Sorry, my fault. I don't have the Rpi on the same network as my NAS.

theoldwiseman
I'm New!
I'm New!
Posts: 6
Joined: Fri Apr 25, 2014 9:11 am

Re: Raspberry+camera module

Unread post by theoldwiseman » Fri May 01, 2015 3:06 pm

I'm not brilliant with the Pi or linux. Would you be able to provide a slightly more idiot guide to getting the software on the Pi?

"Download the code on your machine (one which has nodejs installed) and restore the dependencies using the "npm update" command or if you have Visual Studio 2013 and Nodejs tools, open the solution and build it. (https://nodejstools.codeplex.com)

Copy the code to your Pi."


this bit has me a bit confused, is this downloading something to my windows machine to then copy across to the pi or can the pi download it on it's own?

Any step by step guide would be fantastic.

Any help greatly appreciated.

Thanks

BreeeZe
Rookie
Rookie
Posts: 35
Joined: Sun Apr 22, 2012 9:23 pm

Re: Raspberry+camera module

Unread post by BreeeZe » Fri May 01, 2015 5:47 pm

theoldwiseman wrote:I'm not brilliant with the Pi or linux. Would you be able to provide a slightly more idiot guide to getting the software on the Pi?

"Download the code on your machine (one which has nodejs installed) and restore the dependencies using the "npm update" command or if you have Visual Studio 2013 and Nodejs tools, open the solution and build it. (https://nodejstools.codeplex.com)

Copy the code to your Pi."


this bit has me a bit confused, is this downloading something to my windows machine to then copy across to the pi or can the pi download it on it's own?

Any step by step guide would be fantastic.

Any help greatly appreciated.

Thanks
Hi!

I have not tested downloading the code directly to the Pi and restoring the node dependencies there, but in theory it should work.
But that's why the instructions say to, first download the code to a windows machine and run 'npm install' there, this downloads all the dependencies needed to run the code.

I plan on making a release package soon which includes all dependencies and maybe even a script to install nodejs and the live555 libraries.
I'm now working on finishing controlling the camera through onvif and adding settings webpage to set all other camera parameters, which is already far along.
But being a full time developer, dad and husband also takes a lot of time :lol: so it will probably take another week or 2.

I'll update the guide with some extra instructions this weekend or maybe I'll upload a zip to github of the current version which you could then just extract and copy to the Pi without having to restore the nodejs dependencies, but it would still require you to install nodejs and the live555 libraries.

theoldwiseman
I'm New!
I'm New!
Posts: 6
Joined: Fri Apr 25, 2014 9:11 am

Re: Raspberry+camera module

Unread post by theoldwiseman » Fri May 01, 2015 9:34 pm

Wow, thanks for the quick response. I'm an IT Project Manager and understand the work/life pressures of Devs; I run a team of 25 devs/testers. I'm cool with installing nodejs and live555, it was just the bit about getting the files onto the windows machine (I play with TFS and Jira, but don't look at github much).

I'll have another look and see if I can get that bit sorted, but some extra instructions on that first bit might help some of us non-devs.

Thanks for your work on this, it looks great.

Locked

Return to “Surveillance Station”