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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 4:10 pm

Dear mr Lawson,

Have you added

Code: Select all
gpu_mem=128
start_x=1

Thanks a lot for this tip.! I did this for the other pi, but forgot to put this in on this minibian box.

It now works!

many thanks !

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 4:20 pm

piecam wrote:HI Robert,
with regard to altering filename,location in /etc/raspmjpeg, I tried %Y%M%D and it worked. Then, I deleted existing %Y-%M-%D, it worked again.

I suspect that the problem is that, I may have existing directory (created by MotionPie) already each day, your RPI Web Interface finds out there's one already and quits.

Can you check whether script can be modified to check whether there's existing folder? if there's already one, just use it. Otherwise, create new one. Same for date folder and location folder, any folder?

thanks
It does already check for all the folders down the path and only creates new ones as required.

However, if something else has already created them then they might not have the right permissions to allow storage of the data and then that would cause a problem. I'll have to look to see if there is a way round that.

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 4:33 pm

HI Robert,
I am using this on /etc/fstab,
//192.168.100.10/Recording /var/www/media cifs username=cam,password=xxx,workgroup=workgroup,users,auto,user_xattr 0 0


I would assume those files being written to NAS with this user/pass. Is this correct? Instead of www-data? just some thoughts. If you need some log, please let me know which file you need and I can get it for you.

Thanks

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 4:51 pm

piecam wrote:HI Robert,
I am using this on /etc/fstab,
//192.168.100.10/Recording /var/www/media cifs username=cam,password=xxx,workgroup=workgroup,users,auto,user_xattr 0 0


I would assume those files being written to NAS with this user/pass. Is this correct? Instead of www-data? just some thoughts. If you need some log, please let me know which file you need and I can get it for you.

Thanks
www-data is normally used under apache as it offers the best security.

I have made a modification to raspimjpeg in how it handles existing folders which may help. I don't want to put that in github yet so have attached it as a zip.

To replace the existing one you need to stop the existing raspimjpeg if running and then cp the new one in. So assuming you put this in your home folder.

Code: Select all

sudo killall raspimjpeg
sudo cp ~/raspimjpeg /opt/vc/bin/raspimjpeg
Attachments
raspimjpeg.zip
(22.52 KiB) Downloaded 47 times

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 7:04 pm

HI Robert,

I had to add "chmod x" to the program; then it worked well and I have filed stored correctly to NAS.
You may push it to the git when you feel ready.
Thanks a lot.


root@raspberrypi:~# ls /opt/vc/bin/raspimjpeg* -la
-rw-r--r-- 1 root root 55903 Mar 20 14:54 /opt/vc/bin/raspimjpeg
-rwxr-xr-x 1 root root 56134 Mar 20 12:08 /opt/vc/bin/raspimjpeg.bak
root@raspberrypi:~# chmod +x /opt/vc/bin/raspimjpeg
root@raspberrypi:~# ls /opt/vc/bin/raspimjpeg* -la
-rwxr-xr-x 1 root root 55903 Mar 20 14:54 /opt/vc/bin/raspimjpeg
-rwxr-xr-x 1 root root 56134 Mar 20 12:08 /opt/vc/bin/raspimjpeg.bak

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 7:10 pm

sorry,

I directly dropped that file in /opt/vc/bin, instead of copying it from /home/xx/RPI web /bin.

Not sure what difference it would make.
Anyway, now, I copied from /opt/vc/bin to home directory RPI web directory /bin. Both directory have the same file with same attributes.

many thanks.

harlock74
Posts: 182
Joined: Fri Jan 18, 2013 10:47 am

Re: RPi Cam Web Interface

Fri Mar 20, 2015 7:29 pm

Hi Robert,
I have updated your version. All works great. The new annotation option is very good! Thanks for that.
Just out of curiosity I have re-installed the raspbian image and I can confirm that running 'sudo rpi-update' did the trick for the flickering issue. :D

One final note. I would be grateful to you ,when you get a chance, if you could let me know how to get motion to work after setting up the security option. I have already tried twice today but with no avail.

As posted before I have followed this instructions:

http://www.raspberrypi.org/forums/viewt ... 60#p500460

Should that help please find below the motion log:

Code: Select all

[2015/Mar/20 19:14:04] RaspiCam support started
[2015/Mar/20 19:14:04] Capture Pipe already exists /var/www/FIFO1
[2015/Mar/20 19:14:04] Scheduler loop started
[2015/Mar/20 19:14:04] New period detected 3
[2015/Mar/20 19:14:04] Send md 0
[2015/Mar/20 19:14:06] Send em night
[2015/Mar/20 19:15:07] Saved schedule settings
[2015/Mar/20 19:15:07] Send Schedule reset
[2015/Mar/20 19:15:07] Reload parameters command requested
[2015/Mar/20 19:15:07] Scheduler loop started
[2015/Mar/20 19:15:07] New period detected 2
[2015/Mar/20 19:15:07] Send md 0
[2015/Mar/20 19:15:09] Send em auto
[2015/Mar/20 19:15:11] Send md 1
[2015/Mar/20 19:15:13] Stop capture request ignored, already stopped
[2015/Mar/20 19:15:13] Ignore FIFO char 
Thanks a lot and really sorry to bother you again with same question!

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 8:21 pm

piecam wrote:HI Robert,

I had to add "chmod x" to the program; then it worked well and I have filed stored correctly to NAS.
You may push it to the git when you feel ready.
Thanks a lot.
Thanks for test. I have pushed this to git now.

There are some other internal changes to make the formatting of commands and parameters more flexible. Previously they had to be fixed length. This doesn't change any functionality at the moment but has allowed some simplification of the coding.

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 8:47 pm

harlock74 wrote: One final note. I would be grateful to you ,when you get a chance, if you could let me know how to get motion to work after setting up the security option. I have already tried twice today but with no avail.

As posted before I have followed this instructions:

http://www.raspberrypi.org/forums/viewt ... 60#p500460

Thanks a lot and really sorry to bother you again with same question!
The log is not showing any trigger commands being received from motion. When it is working you should see

Code: Select all

[2015/Mar/20 14:20:29] Start capture requested
[2015/Mar/20 14:20:29] Send ca 1
[2015/Mar/20 14:20:34] Stop capture requested
[2015/Mar/20 14:20:34] Send ca 0
The start request means that motion has detected a trigger and sent a start '1' command to scheduler. Scheduler has translated this to ca 1 (start video capture and sent this on. Similarly for the stop request.

So we have to find where in the chain this is breaking down.

a) motion should be running when you have motion detect activated. (ps -A should show a motion process)

b) motion must be able to fetch new images from the web site . This is controlled by the settings in /etc/motion/motion.conf and also visible from the web motion page. The two critical items are
netcam_url http://localhost:port/cam_pic.php where port is the port number if you have changed it from default 80
netcam_userpass username:password where those are set up to be the same as when you secured the web site.

You can test that by closing a browser, re-opening it up and browsing to http://localhost:port/cam_pic.php You should have to enter name and password and then see an image
If you don't then there is something wrong with how you have set up the security

c) motion trigger parameters must allow motion to see a difference between pictures when motion occurs. Set a low threshold and noise level to start to make sure triggers are generated (100 threshold, 20 noise)

d) motion on_event_start and on_event_end should be set up (default) to echo '1' and '0' to FIFO1 which scheduler is monitoring. You can test the FIFO1 is working by manually doing a
echo -n '1' >/var/www/FIFO1 which should start a video recording and '0' to stop it.

If none of this is making sense then maybe post your /etc/motion/motion.conf zipped up and with password xxx'd out

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 8:50 pm

harlock74 wrote: Just out of curiosity I have re-installed the raspbian image and I can confirm that running 'sudo rpi-update' did the trick for the flickering issue. :D
Thanks for confirming rpi-update. Someone said this didn't seem to work for them so I double checked with 6by9 and it has definitely been updated with the flickering fix.

User avatar
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

Re: RPi Cam Web Interface

Fri Mar 20, 2015 10:04 pm

Hello,
btidey wrote: Thanks for confirming rpi-update. Someone said this didn't seem to work for them so I double checked with 6by9 and it has definitely been updated with the flickering fix.
Its fixed for me. Thanks for all your hard work.

Regards

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 10:09 pm

I have added an experimental time-lapse to video conversion in preview.

An extra button shows up when previewing a time lapse sequence to kick off th econversion which replaces the time lapse set with an mp4.

It is not particularly practical at the moment as it is slow (5 seconds per image on a Pi1B+) and the web page is locked till it completes. So a 100 image sequence can take 8 minutes. It may be significantly quicker on a Pi2, but my cameras are using the older models.

To make it more practical.
a) Faster conversion
b) Conversion in the background
c) Control over conversion parameters

For reference the conversion is currently done with a command like

Code: Select all

avconv -i in_%05d.jpeg -r 5 -vcodec libx264 -crf 20 -g 5 -vf crop=2592:1458,scale=1280:720 outFile

harlock74
Posts: 182
Joined: Fri Jan 18, 2013 10:47 am

Re: RPi Cam Web Interface

Fri Mar 20, 2015 10:12 pm

Hi Robert,
Many thanks for helping me out with my current issue.
Please find below my answers to your questions.
btidey wrote:
a) motion should be running when you have motion detect activated. (ps -A should show a motion process)
Confirmed. I can see motion among all the other processes.
btidey wrote: b) motion must be able to fetch new images from the web site . This is controlled by the settings in /etc/motion/motion.conf and also visible from the web motion page. The two critical items are
netcam_url http://localhost:port/cam_pic.php where port is the port number if you have changed it from default 80
netcam_userpass username:password where those are set up to be the same as when you secured the web site.

You can test that by closing a browser, re-opening it up and browsing to http://localhost:port/cam_pic.php You should have to enter name and password and then see an image
If you don't then there is something wrong with how you have set up the security
All confirmed. After inserting user/password I can see an image.
btidey wrote: c) motion trigger parameters must allow motion to see a difference between pictures when motion occurs. Set a low threshold and noise level to start to make sure triggers are generated (100 threshold, 20 noise)
I have tried to change those parameters,as suggested, but with no avail.
btidey wrote: d) motion on_event_start and on_event_end should be set up (default) to echo '1' and '0' to FIFO1 which scheduler is monitoring. You can test the FIFO1 is working by manually doing a
echo -n '1' >/var/www/FIFO1 which should start a video recording and '0' to stop it.
All confirmed.
btidey wrote: If none of this is making sense then maybe post your /etc/motion/motion.conf zipped up and with password xxx'd out
Please find attached the file.

Once again many thanks for that!
Attachments
motion.conf.7z
(7 KiB) Downloaded 44 times

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

Re: RPi Cam Web Interface

Fri Mar 20, 2015 11:03 pm

harlock74 wrote: Please find attached the file.

Once again many thanks for that!
There are a few differences in there from the default. motion.conf.1 in install etc

videodevice /dev/video0 (commented out in default)
netcam_http 1.0 (commented out in default)
mysql_host localhost (commented out in default)
pgsql_host localhost (commented out in default)
pgsql_port 5432 (commented out in default)

The first one is probably problematic as it is telling motion to collect from a real video device whereas we want it to just use the netcam_url

Try using the default motion.conf as supplied and just change the netcam_userpass to match your security.

harlock74
Posts: 182
Joined: Fri Jan 18, 2013 10:47 am

Re: RPi Cam Web Interface

Sat Mar 21, 2015 8:50 am

btidey wrote: There are a few differences in there from the default. motion.conf.1 in install etc

videodevice /dev/video0 (commented out in default)
netcam_http 1.0 (commented out in default)
mysql_host localhost (commented out in default)
pgsql_host localhost (commented out in default)
pgsql_port 5432 (commented out in default)

The first one is probably problematic as it is telling motion to collect from a real video device whereas we want it to just use the netcam_url

Try using the default motion.conf as supplied and just change the netcam_userpass to match your security.
Robert,
thanks for coming back to me.
When you say:
btidey wrote: Try using the default motion.conf as supplied and just change the netcam_userpass to match your security.
do you mean that I have to replace the motion.conf (installed with your version) with the motion.conf installed with the original software?
Thanks a lot!

EDIT:
Good news Robert! I followed your recommended steps and everything worked like a charm! Motion is now working as expected even with the security option activated. Many thanks again for your kind and much appreciated help! :D

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

Re: RPi Cam Web Interface

Sat Mar 21, 2015 10:14 am

harlock74 wrote: Robert,
thanks for coming back to me.
When you say:
btidey wrote: Try using the default motion.conf as supplied and just change the netcam_userpass to match your security.
do you mean that I have to replace the motion.conf (installed with your version) with the motion.conf installed with the original software?
Thanks a lot!
The differences I pointed out were against the motion.conf supplied with my version of the software so I meant to use that.

The installer has a file called motion.conf.1 under etc/motion in the installer folder. The installer should be copying this to /etc/motion/motion.conf during installation. If this is not happening for some reason or you have changed any values from the web i/f then I suggest you manually sudo cp it in.

harlock74
Posts: 182
Joined: Fri Jan 18, 2013 10:47 am

Re: RPi Cam Web Interface

Sat Mar 21, 2015 10:16 am

Nexoru wrote:Hey ,

i secured the Interface with htaccess , because i forwarded it.
Now i recognized that with the htaccess function activated , the Motion Detection doesn't work anymore.

Is there an fix or an better solution for that ?
Nexoru,
If you follow the steps from here

http://www.raspberrypi.org/forums/viewt ... 60#p500460

and Robert's instructions as per his previous post

everything will work just fine :mrgreen:

harlock74
Posts: 182
Joined: Fri Jan 18, 2013 10:47 am

Re: RPi Cam Web Interface

Sat Mar 21, 2015 10:18 am

Hi Robert,
Indeed that did the trick. Please refer to the EDIT in my previous post.
harlock74 wrote: EDIT:
Good news Robert! I followed your recommended steps and everything worked like a charm! Motion is now working as expected even with the security option activated. Many thanks again for your kind and much appreciated help! :D
Once again, thanks a lot! :D

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

Re: RPi Cam Web Interface

Sat Mar 21, 2015 11:36 am

Yesterday's update that made parameter formatting more flexible had a bug so that Camera settings preset resolutions had a problem.

Fixed now.

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

Re: RPi Cam Web Interface

Sat Mar 21, 2015 2:34 pm

Hi,
How to deactivate scheduler-autostart ?
How to get Motion working without scheduler ?
i changed

Code: Select all

# Command to be executed when an event starts. (default: none)
# An event starts at first motion detected after a period of no motio$
# on_event_start echo '1' > /var/www/FIFO1
on_event_start echo 'ca 1' > /var/www/FIFO

# Command to be executed when an event ends after a period of no moti$
# (default: none). The period of no motion is defined by option gap.
# on_event_end echo '0' > /var/www/FIFO1
on_event_end echo 'ca 0' > /var/www/FIFO

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

Re: RPi Cam Web Interface

Sat Mar 21, 2015 3:40 pm

0lly wrote:Hi,
How to deactivate scheduler-autostart ?
How to get Motion working without scheduler ?
First question is what are you trying to achieve?

If you just want manually activated motion detect without any further scheduled automation then the simplest way is to put scheduler into All day mode leave Command_on in Day as ca 1, Command_Off in Day as ca 0, and delete the day mode commands. That way all scheduler is doing is passing the motion trigger commands through. As a background process it takes a tiny % of CPU time.

If for some reason you want to permanently take the scheduler out of the system then you have to do a few changes.

1) Change motion commands to send ca 1 and ca 0 into FIFO rather than FIFO1
2) Take the scheduler boot start up settings out of /etc/rc.local

The changes you posted are effectively step 1) but scheduler would still be running and could action any daily mode change commands. I'd recommend either doing what I said in first paragraph (All day mode) or removing scheduler operations by doing both 1) and 2).

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

Re: RPi Cam Web Interface

Sat Mar 21, 2015 3:50 pm

HI Robert,
Boxing MP4, while continuing capturing H264.

I was just wondering whether we can have a seperate process, say, raspmjpeg, waiting for the instruction from first raspmjpeg. The first will tell second that my raw recording is done, please go ahead to box it into MP4. I will continue to monitor and record new one.

Or, raspmjpeg can invoke avconv or ffmpec or any other resource friendly and efficient tools to convert these h264 to mp4, with no rush.

This may make this monitoring and capturing happening all the time, while, the finished capture will be automatically dealt by other program of choice to convert to MP4.

This would be ideal and better than setting boxing = true.

Just some thoughts to share.
thanks

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

Re: RPi Cam Web Interface

Sat Mar 21, 2015 3:59 pm

btidey wrote: First question is what are you trying to achieve?
I need motion 24/7 :D
btidey wrote: 2) Take the scheduler boot start up settings out of /etc/rc.local
thanks for the tip,maybe a option for autorun is better...
btidey wrote: The changes you posted are effectively step 1) but scheduler would still be running and could action any daily mode change commands. I'd recommend either doing what I said in first paragraph (All day mode) or removing scheduler operations by doing both 1) and 2).
Done ;)

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

Re: RPi Cam Web Interface

Sat Mar 21, 2015 6:54 pm

0lly wrote:
btidey wrote: First question is what are you trying to achieve?
I need motion 24/7 :D
btidey wrote: 2) Take the scheduler boot start up settings out of /etc/rc.local
thanks for the tip,maybe a option for autorun is better...
btidey wrote: The changes you posted are effectively step 1) but scheduler would still be running and could action any daily mode change commands. I'd recommend either doing what I said in first paragraph (All day mode) or removing scheduler operations by doing both 1) and 2).
Done ;)
I'm not sure which option you did. If you just needed motion detection 24 hours then rather than change around the basic scheduler operation I'd have done one of the following.

a) Use all day mode and just set the on off to ca 1, ca 0 as described, or

b) Leave it in day periods mode, put ca 1 and ca 0 in all on off periods, take out all md commands from the modes. This then allows you to have other mode commands during the periods if that was desirable.

The disadvantage of taking scheduler out altogether is that you have to be careful if you update the software.

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

Re: RPi Cam Web Interface

Sat Mar 21, 2015 7:02 pm

piecam wrote:HI Robert,
Boxing MP4, while continuing capturing H264.
I had this on my list of potential improvements so decided to give it a go.

MP4Box option can now be false, true, or background. If background then MP4Box is spawned off as a background task and stop video returns immediately to ready.

There is also an extra raspimjpeg command (bo 0/1/2) which can change the mode on the fly. This is available under Camera Settings on main page.

In preview if it detects that final video is not ready then that shows a busy rather than a file size and the link is disabled.

Note that preview does not currently refresh so if a file shows busy this will not change unless a refresh (F5) is done.

The install default is background but a change made from camera settings will persist until changed again.
Attachments
Box1.jpg
Box1.jpg (8.76 KiB) Viewed 2416 times
Box2.jpg
Box2.jpg (6.14 KiB) Viewed 2416 times

Return to “Camera board”