btidey
Posts: 1639
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Thu Feb 19, 2015 5:19 pm

If you want to use a webcam then you need to look at other options as this app is fundamentally tied to the raspberry native cam.

This one uses the raspimjpeg process which only interfaces to the raspberry to produce the source data for the live display and feed motion with a stream of jpegs. Motion then sends the triggers back to raspimjpeg to kick off recordings. The advantage here is that the jpeg stream can be medium resolution to allow motion to do its work effectively but the captures can be the HD resolution quality handled by the Pi camera which is much higher than most webcams. The downside is there is a lag between motion detection and capture starting but for most purposes that isn't critical. Theoretically, it might be possible to add webcam handling into raspimjpeg but it would require serious c coding skills to do that.

If you want just a raw security cam then look at the thread describing BuildRoot and motion. That is a small system dedicated to camera operation not Raspbian based.It can handle webcams and raspberry cams. It is simple to set up with good functionality. It works in a different way where it is effectively recording all the time and sending data to motion for triggers. That is good as it means there is no lag but it does limit it to medium resolution videos.

If you want raspbian based security webcam then that is possible using motion as the basis but you would have to search around for solutions to integrating that all together with web interface etc.

plasma69
Posts: 5
Joined: Tue Feb 17, 2015 9:11 pm

Re: RPi Cam Web Interface

Fri Feb 20, 2015 1:08 am

btidey wrote:If you want to use a webcam then you need to look at other options as this app is fundamentally tied to the raspberry native cam.

This one uses the raspimjpeg process which only interfaces to the raspberry to produce the source data for the live display and feed motion with a stream of jpegs. Motion then sends the triggers back to raspimjpeg to kick off recordings. The advantage here is that the jpeg stream can be medium resolution to allow motion to do its work effectively but the captures can be the HD resolution quality handled by the Pi camera which is much higher than most webcams. The downside is there is a lag between motion detection and capture starting but for most purposes that isn't critical. Theoretically, it might be possible to add webcam handling into raspimjpeg but it would require serious c coding skills to do that.

If you want just a raw security cam then look at the thread describing BuildRoot and motion. That is a small system dedicated to camera operation not Raspbian based.It can handle webcams and raspberry cams. It is simple to set up with good functionality. It works in a different way where it is effectively recording all the time and sending data to motion for triggers. That is good as it means there is no lag but it does limit it to medium resolution videos.

If you want raspbian based security webcam then that is possible using motion as the basis but you would have to search around for solutions to integrating that all together with web interface etc.
Thank you very much for your explanation and references.

WandW
Posts: 1
Joined: Fri Feb 20, 2015 7:22 am

Re: RPi Cam Web Interface

Fri Feb 20, 2015 8:01 am

Hey Peeps
I'm a long time lurker, first time caller... Hope this is the right place.. Well it is to do with the RPi Cam Web Interface..
For the life of me I cannot work out how to set a white balance without it drifting. I want it to stay set in stone no matter what happen to the lighting conditions

Basically I want to turn AWB off.
When turning white balance off all I get either black or just a green image. I have worked out that this is because the red and blue gains are both 0. Somehow I need to change this but I don't know where or how. Can someone help?
I have read somewhere that this works for images but not for video.. So I'm not sure if it can even be done.

Sorry for the n00bness, Thanks for your help!

btidey
Posts: 1639
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Fri Feb 20, 2015 8:08 pm

Trying out a new version of my modifications to preview.

This one moves away from table view to a grid of thumbnails. This is to hopefully make it clearer and also pack more captures on a screen for more rapid viewing.

I am still playing around (fighting) with the styles and when I get that better I'll probably move them into a separate css sheet.

New preview.php is at https://github.com/roberttidey/RPi_Cam_Web_Interface

and it needs the extra icon file delete.png
Attachments
preview5.jpg
preview5.jpg (47.45 KiB) Viewed 4898 times

cazz
Posts: 221
Joined: Wed Nov 14, 2012 9:01 pm
Location: Sweden

Re: RPi Cam Web Interface

Fri Feb 20, 2015 11:19 pm

Hi
I do like this project alot but I have to ask one thing.
I have read some page about this project and I have read that somone here write about a year ago that you have to mask or something to make motion less sensitive to recording if something happend.
I going to have the camera outside and I'm a little afraid that the sun and the shadow going to make it recording alot and that is no good :)
/Cazz

btidey
Posts: 1639
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Fri Feb 20, 2015 11:49 pm

In its raw state then the motion detection will typically produce a lot of false triggers.

These can be minimised by adjusting the motion config (/etc/motion/motion.conf) in a number of ways.

1) It is definitely good to use a mask to limit the area of interest. This is easy to do by using a cam.jpg taken from /dev/shm/mjpeg and then editing it to define the areas of movement interest in white and the rest black. Converted to a pgm image file and linked to motion using mask_file then motion will ignore all changes outside of the white mask. I have a camera at the front of my house and use this to ignore pedestrians on the pavement and passing cars. Totally effective.

2) Sensitivity can also be tuned by increasing the number of pixels needing to change (threshold), the noise level that is ignored (noise_level), number of frames before a trigger (minimum_motion_frames), and large intensity changes (lightswitch).

Using the parameters in 2) I get very few false triggers normally. The occasions when I do still get them are typically on days with bright sunshine, passing clouds and the sun in a direction casting a shadow.

The other factor to bear in mind is that dusk and dawn will also tend to cause false detection. This tends to exacerbated if motion detection is on when it is darkish and there are passing cars with headlights on. I automate the motion detection on / off based on sunrise / sunset to avoid this. I am also experimenting with dynamically changing the motion detection parameters in these periods to try to stretch the valid motion detection period.

btidey
Posts: 1639
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Fri Feb 20, 2015 11:51 pm

Tuned up the styling a bit and moved the major preview styles out to a new preview.css in the css folder.
Attachments
preview6.jpg
preview6.jpg (46.44 KiB) Viewed 4853 times

cazz
Posts: 221
Joined: Wed Nov 14, 2012 9:01 pm
Location: Sweden

Re: RPi Cam Web Interface

Sat Feb 21, 2015 12:05 am

Hi again
I have read some more and have one more question.
I want to have a copy of all it recording or capture on a windows share folder.
I did try with bind that I find I can use here
http://elinux.org/RPi-Cam-Web-Interface

But then I can't delete the file from RPi from webinterface so I did have to delete them from then windows share folder.

Then I was thinking maybe use crontab to copy every new file ever 15 min or so but is not so good idea I think if it recording on the same time I trying to copy.

I have to sync the two folder or when it have convert the movie to mp4 or save the image as jpg it copy the files to the folder that I have connect to the share folder. But I have not yet find out where it does that.
/Cazz

cazz
Posts: 221
Joined: Wed Nov 14, 2012 9:01 pm
Location: Sweden

Re: RPi Cam Web Interface

Sat Feb 21, 2015 12:12 am

ahh ok
but the camera is not going to recording in any public place (is forbidden here in Sweden) so it just going to recording my own place. Just afraid that the light and shadow is going to mess thing up.

So I think I have to do nr 2 but I have to read how to make it work.
I have never use motion before so everything of this is new for me.
/Cazz

Gary Littlemore
Posts: 327
Joined: Thu Oct 11, 2012 11:52 am
Location: Cheshire, UK

Re: RPi Cam Web Interface

Sat Feb 21, 2015 9:47 am

btidey

I've followed your instructions and when I do 'cd RaspiCam-master/www' it says www doesn't exist?
btidey wrote:
Gary Littlemore wrote:Hi btidey,

What files need updating to get your latest preview page into my RPi Cam Web Interface?
In the /var/www folder the preview.php needs to be replaced and 2 icon files added. These 3 files are under the www folder on the github link.

Easiest procedure is to
Download zip from github link and extract the 3 files from the www folder. Then sudo cp them into /var/www. You don't need to restart anything, any changes take immediate effect next time you access the preview page.

E.g. from home folder

Code: Select all

wget https://github.com/roberttidey/RaspiCam/archive/master.zip -O master.zip
unzip master.zip
cd RaspiCam-master/www
sudo cp * /var/www/
3b+, 2b, b+, b, Zero & Zero-W

btidey
Posts: 1639
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sat Feb 21, 2015 11:31 am

That's because those were written before I moved this into a proper github fork of the full RpiCam project as noted in a later post. That allows for doing an install from that fork and will allow me to do pull requests on the original code. The RaspiCam github now has just the python automater.

So you can either update using the normal update instructions for RPi_Cam but using my fork or you can still do it manually to an existing install. Get the zip from

https://github.com/roberttidey/RPi_Cam_Web_Interface

This has the full RPI_Cam_Web_Interface. The www folder has a changed preview.php, 3 png icon files, and a preview.css in the css subfolder.

I think the following should work. It puts a copy of the installer into a separate "modified" folder to avoid overwriting the original.

Code: Select all

wget https://github.com/roberttidey/RPi_Cam_Web_Interface/archive/master.zip -O master.zip
unzip master.zip -d modified
cd modified/RPi_Cam_Web_Interface-master/www
sudo cp -r * /var/www/
Gary Littlemore wrote:btidey

I've followed your instructions and when I do 'cd RaspiCam-master/www' it says www doesn't exist?

theC0der
Posts: 1
Joined: Sat Oct 18, 2014 3:06 pm

Re: RPi Cam Web Interface

Sat Feb 21, 2015 6:28 pm

Hi, I've been working on Raspberry pi camera for almost 6 months. There is a small problem I encounter frequently. When I connect my RPi with HDMI display then rapsistill takes images with preview but when I interface Rpi with ssh (to pc) then there's no preview at all. I can take images but I can't properly position my camera due to lack of preview. Do you guys have any solution to this problem ?

cazz
Posts: 221
Joined: Wed Nov 14, 2012 9:01 pm
Location: Sweden

Re: RPi Cam Web Interface

Sat Feb 21, 2015 6:30 pm

I have now got the backup of my recording and image to a windows shared folder.
I did use rsync and crontab.

But I have notice that the motion is to sensitive
It recording many many many tiny mp4 file, less then 0,5mb each and that is not good.

So I need to do that nr 2 that btidey told but I have no idea how I can do it.
I'm just afraid that if I find someplace how to modd motion it maybe stop working.


/update

Have now change noise_level in the conf file to see if it is a good value
/Cazz

btidey
Posts: 1639
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sat Feb 21, 2015 8:00 pm

cazz wrote:I have now got the backup of my recording and image to a windows shared folder.
I did use rsync and crontab.

But I have notice that the motion is to sensitive
It recording many many many tiny mp4 file, less then 0,5mb each and that is not good.

So I need to do that nr 2 that btidey told but I have no idea how I can do it.
I'm just afraid that if I find someplace how to modd motion it maybe stop working.


/update

Have now change noise_level in the conf file to see if it is a good value
You can take a backup copy of the motion.conf file (sudo cp /etc/motion/motion.conf ~/motion.conf) Then if you get in a mess you can copy that back in.

I would start by putting the noise_level up to about 80; increase the threshold to say 1500, and the minimum_motion_frames to say 5

cazz
Posts: 221
Joined: Wed Nov 14, 2012 9:01 pm
Location: Sweden

Re: RPi Cam Web Interface

Sat Feb 21, 2015 8:05 pm

yes I have made a back but I only change noise_level from 32 to 15.

I does look good but I maybe going try that you have write.
/Cazz

Gary Littlemore
Posts: 327
Joined: Thu Oct 11, 2012 11:52 am
Location: Cheshire, UK

Re: RPi Cam Web Interface

Sat Feb 21, 2015 8:48 pm

I've done the RPi_Can normal upgrade and nothing has updated.
btidey wrote:So you can either update using the normal update instructions for RPi_Cam but using my fork or you can still do it manually to an existing install. Get the zip from
3b+, 2b, b+, b, Zero & Zero-W

0lly
Posts: 77
Joined: Sun Mar 02, 2014 5:07 pm

Re: RPi Cam Web Interface

Sun Feb 22, 2015 8:42 am

btidey wrote:

Code: Select all

wget https://github.com/roberttidey/RPi_Cam_Web_Interface/archive/master.zip -O master.zip
unzip master.zip -d modified
cd modified/RPi_Cam_Web_Interface-master/www
sudo cp -r * /var/www/
This works for me,thanks ;)

btidey
Posts: 1639
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sun Feb 22, 2015 10:46 am

Gary Littlemore wrote:I've done the RPi_Can normal upgrade and nothing has updated.
Did you get the zip from my github fork?

You can then do the manual process as described or run the script install from my forked code.

If you do the latter then you can check the /var/ww folder. It should have 3 png files which aren't in the original and the preview.php should be about 9k which is bigger than the original.

ianj
Posts: 21
Joined: Mon May 12, 2014 2:24 am

Re: RPi Cam Web Interface

Sun Feb 22, 2015 8:14 pm

Edit: Nevermind. New problem, as some have mentioned above. New Pi2, motion detection seems to do nothing at the moment. Process runs when button is clicked or run in terminal, but it never detects any motion, even with all default settings.

Tried reducing the detection value very low, and still never picks up anything despite waving the camera around.

cazz
Posts: 221
Joined: Wed Nov 14, 2012 9:01 pm
Location: Sweden

Re: RPi Cam Web Interface

Sun Feb 22, 2015 10:59 pm

btidey wrote:I would start by putting the noise_level up to about 80; increase the threshold to say 1500, and the minimum_motion_frames to say 5
I have change the value that you told me and it looks good

But I have to ask, if I want to make it more sensitive, what do I have to change, maybe less about noise level or less minimum motion frames or maybe both??

Right now it look like it recording but it take sometime before it start.
I did see my neighbours cat was at my place this morning but it did not start recording until it was almost out of the picture.
/Cazz

ale1980
Posts: 1
Joined: Wed Jan 14, 2015 12:24 pm

Re: RPi Cam Web Interface

Sun Feb 22, 2015 11:13 pm

hi
and can run Pi -pan without servo board pan / tilt with the servo connected directly to the gpio raspbery pi
Thanks in advance for your help

btidey
Posts: 1639
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sun Feb 22, 2015 11:38 pm

ianj wrote:Edit: Nevermind. New problem, as some have mentioned above. New Pi2, motion detection seems to do nothing at the moment. Process runs when button is clicked or run in terminal, but it never detects any motion, even with all default settings.

Tried reducing the detection value very low, and still never picks up anything despite waving the camera around.
I am not aware of anything specific on Pi 2 that would stop motion detection working.

I'd start off establishing whether the problem is the actual motion detection or whether it is something in the Rpi Cam motion integration that is stopping this working.

Motion is starting and stopping when you press motion detect so that is good.

Next step is to check that RPi Cam is responding correctly to the motion triggers. If you send the command echo 'ca 1' >/var/www/FIFO then video should start recording. Then echo 'ca 0' >/var/www/FIFO should stop the recording. That is probably OK but it is a quick easy check.

Next step is to check whether motion is being triggered. If you search for those commands in the motion.conf file in /etc/motion/motion.conf then you can temporarily edit them to something else. E.g. if you replace the 'ca 1' version by echo 'start' > /home/pi/motion.txt then if the motion is being detected you should see a file called motion.txt in the home pi folder with start in it. Change the setting back after the test.

If that is all working then the next most likely cause is that motion is not able to fetch the jpegs necessary for it to do its work. Try browsing to http://cameraip/cam_pic.php where cameraip needs to be your camera. You should get back a frame from the camera. If you don't then have you changed the username password of web access or the port used by the web server. If so then these need to be put in the motion.conf file

btidey
Posts: 1639
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sun Feb 22, 2015 11:46 pm

cazz wrote:
I have change the value that you told me and it looks good

But I have to ask, if I want to make it more sensitive, what do I have to change, maybe less about noise level or less minimum motion frames or maybe both??

Right now it look like it recording but it take sometime before it start.
I did see my neighbours cat was at my place this morning but it did not start recording until it was almost out of the picture.
Noise , threshold and minimum frames all affect the sensitivity. I would start adjusting the threshold lower for more sensitivity. That effectively changes the minimum area of the picture that has to change for detection to be triggered.

There is always a bit of lag here as the video only starts recording after motion is detected. The delay is made up of three major components. The minimum frame setting will delay motion detecting the difference and sending a trigger. The trigger is picked up by a polling loop in the raspimjpeg program so it can take 0.1sec to recognise the trigger. Then there is a delay as raspimjpeg gets the camera going. These last 2 parts are fixed in the raspimjpeg program.

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Mon Feb 23, 2015 1:30 am

HI GUys,

I have 4 Pi B+ with Pi IR cam and NoIR cam , as well as USB logitech 9000, C270 hooked up around my house. I was useing MotionPie distro, which is so smooth and great so far. The only thing is feel that the frame rate might be a bit slow.

https://github.com/ccrisan/motionPie

Today I just loaded https://minibianpi.wordpress.com/ and tried following to get your system up and running.

1. root@raspberrypi:/# cat /boot/config.txt
gpu_mem=128
start_x=1

2. root@raspberrypi:/# cat /etc/modules
snd-bcm2835
bcm2835-v4l2
root@raspberrypi:/#

It looks great with fast frame rate.

I was just wondering whether it would be a good idea that you guys can consider. That is to have some coordinated effort with MotionPie developer, MiniBian developer, then, work out a best of all system.

In my opinion, it would be either with motionpie's system+yours or minibian+yours+motionpies. The GUi and light web interface from motionpie is pretty good.

Just thought to share.
tks

Just to add,
http://www.openmediavault.org/
https://openwrt.org/
as well as motionpie (motione eye is opensource as well), have light WEB GUI. They are not using Apache. It maybe worth effort of learning from those and have this project getting better. Just some thoughts. hope you guys don't mind.

thanks
Last edited by piecam on Mon Feb 23, 2015 3:51 pm, edited 2 times in total.

ianj
Posts: 21
Joined: Mon May 12, 2014 2:24 am

Re: RPi Cam Web Interface

Mon Feb 23, 2015 3:08 am

btidey wrote:Next step is to check whether motion is being triggered. If you search for those commands in the motion.conf file in /etc/motion/motion.conf then you can temporarily edit them to something else. E.g. if you replace the 'ca 1' version by echo 'start' > /home/pi/motion.txt then if the motion is being detected you should see a file called motion.txt in the home pi folder with start in it. Change the setting back after the test.
Interesting tests, thanks for the help. Everything worked up to this part that I quoted. As suspected, motion isn't (for some reason) being detected. The file never gets created.

Just for info, I changed on_event_start to the above, instead of the default 'ca 1' and respective directory.

For what it's worth, ps -A reports motion is running when the button is active, and that it is not when the button is not. I think that was mentioned earlier, but again it's just worth pointing out for anyone reading.

Thanks again!

Return to “Camera board”