wingers
Posts: 50
Joined: Wed Dec 31, 2014 8:31 pm

Re: RPi Cam Web Interface

Mon Jun 20, 2016 9:02 pm

btidey wrote: You can either put a number in GMTOffset or you can put in a time zone string (e.g. Europe/London)

I doubt whether the scheduler part would affect the filenames though, more just when scheduler actions happen.

What time zone are you in? A 1 hour difference sounds like a daylight savings offset.
My time zone is London, Europe

Annotation shows correct time of 21:57

Schedule page shows 22:57

Whether GMToffset was set to 0 or 1 it still showed 22:57

Changed it to Europe/London and it then shows time correctly at 21:57 on scheduler page - even though that is a time offset of 1 the same as I tried above and it didn't work

BUT still timestamp on files is wrong at 22:57

nospam
Posts: 54
Joined: Sun Jun 14, 2015 10:38 pm

Re: RPi Cam Web Interface

Tue Jun 21, 2016 2:08 pm

"Error in RaspiMJPEG: restart RaspiMJPEG(./RPI_Cam_Web_Interface_installer.sh start) or the whole RPi."

This one has been an endless source of frustration for me and I'm posting my workaround for this. I have yet to find a fix for the problem and every suggestion found in this forum has not worked so far. This problem has affected my RasPi B+ and RasPi 2 boards on multiple RaspiOS versions and RasPi Cam Control versions.

Originally I was going to add a "sudo service motion restart" button to the main web interface but that still required me to manually reset motion after it crapped out.

Instead I am running a cron script which checks the file '/dev/shm/mjpeg/status_mjpeg.txt' status every 10 minutes and forces a motion restart if it isn't running. It may not be elegant but it works for my 3 Pi's which I am using as cheap megapixel security cameras.

First I created a script "mjpegerror.sh" which checks the status of MOTION

Code: Select all

#!/bin/bash
set -x
MYWORD="Error"
FILENAME='/dev/shm/mjpeg/status_mjpeg.txt'
if fgrep -c $MYWORD $FILENAME ; then
echo "MOTION CRASHED FORCE RESTART"
RESET=$(sudo service motion restart)
else
echo "MOTION OK"
fi
exit
Next do a "chmod +x mjpegerror.sh"

Finally I run this script every 10 minutes by adding to crontab "sudo crontab -e"

Code: Select all

*/10 7-23 * * * /home/pi/mjpegerror.sh
No more annoying pop-up messages.

Explanation: The file "/dev/shm/mjpeg/status_mjpeg.txt" normally contains the word "md_ready". When MOTION stops working the file is updated and contains the word "Error". I figured checking the file contents every 10 minutes was less taxing on the CPU load than monitoring when the file contents changed which is why I used crontab.

Let me know if you find a better solution. Un-installing, re-installing does not work...at least for me.

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

Re: RPi Cam Web Interface

Tue Jun 21, 2016 2:31 pm

nospam wrote:"Error in RaspiMJPEG: restart RaspiMJPEG(./RPI_Cam_Web_Interface_installer.sh start) or the whole RPi."

This one has been an endless source of frustration for me and I'm posting my workaround for this. I have yet to find a fix for the problem and every suggestion found in this forum has not worked so far. This problem has affected my RasPi B+ and RasPi 2 boards on multiple RaspiOS versions and RasPi Cam Control versions.
Sorry to hear the problem you have been having with this.

You associate this as a MOTION problem. Why do you say that? Are you running external motion detection and it doesn't happen if this is off? Your fix is to restart the motion service which is strange as that shouldn't be clearing the status file. Are you sure you are letting the Web cam software stop and start the motion process as intended or have you also installed and configured motion separately? RPiWeb Cam only uses motion for detection and it should not be part of normal operation of the camera.

error is only written into the status file by the raspimjpeg process which is running the camera and it should log a cause for that in the scheduler log. So I'd be interested to see that part of the log when you get one of those errors.

nospam
Posts: 54
Joined: Sun Jun 14, 2015 10:38 pm

Re: RPi Cam Web Interface

Tue Jun 21, 2016 3:20 pm

Maybe I am misunderstanding the error.

Yes I am running external motion. I am letting the Web cam software trigger the motion event. Instead of video I use the command
echo -n 'im' >/var/www/FIFO
to grab an image on event start.

Here's what appears in the logs
{2016/06/13 07:31:18} Capturing image
{2016/06/13 07:31:18} Error: Could not write all bytes jpeg2
{2016/06/13 07:31:19} Error: Could not write all bytes jpeg2
... repeats about 30 times ...
{2016/06/13 07:31:19} Error: Could not write all bytes jpeg2
{2016/06/13 07:31:19} Error: Could not write all bytes jpeg2
{2016/06/13 07:31:24} RaspiMJPEG Version 5.2.14
{2016/06/13 07:31:24} Error: Could not enable camera
{2016/06/13 07:31:24} Executing macro /var/www/macros/error_hard.sh "Could not enable camera"
To me it looks like the Pi is trying to send too many commands and/or there is a write error if the SD card writes are too slow and it tries to process multiple sequential writes. Restarting motion definitely clears the status file. I've tried slowing the camera frame rate down to help and tried adding a larger camera buffer.

framerate = 2
minimum_frame_time = 1

These do help and I seem to have less issues on the Pi2 than the B+ and I attribute that to better processing and I/O speeds. Using a hard wired ethernet connection versus wifi also helps.

FYI I've ordered a new RasPi 3 with a faster Class 10 U3 microSD card it will be interesting to see how that changes things.

If it isn't a MOTION related problem why does restarting the service clear the error?

User avatar
gigpi
Posts: 17
Joined: Thu May 14, 2015 12:23 pm

Re: RPi Cam Web Interface

Wed Jun 22, 2016 10:32 am

I have 2 problems like above:
1)
"Error in RaspiMJPEG: Restart RaspiMJPEG (./RPi_Cam_Web_Interface_Installer.sh start) or the whole RPi."
Restarted and re-installed from zero but the error persist, i can see it after a full day usage (where it works fine), usually when dark come.

Here are my logs, it's interesting to note that just before stop to work my schedule command "ca 1;sy notify.sh;im" become "Can't find macro notify.shim" where clearly a semicolon is missing between the script name notify.sh and the im command.
Error messages are repeated every 5 seconds.

Code: Select all

[2016/06/21 20:26:50] Start capture requested from Pipe
[2016/06/21 20:26:50] Send ca 1
{2016/06/21 20:26:50} Capturing started
[2016/06/21 20:26:52] Send sy notify.sh
{2016/06/21 20:26:52} Executing macro /var/www/picam/macros/notify.sh &
[2016/06/21 20:26:54] Send im
{2016/06/21 20:26:54} Capturing image
[2016/06/21 20:26:56] Stop capture requested
[2016/06/21 20:26:56] Send ca 0
[2016/06/21 20:26:58] Start capture requested from Pipe
[2016/06/21 20:26:58] Send ca 1
{2016/06/21 20:26:58} Capturing stopped
{2016/06/21 20:26:58} Add /var/www/picam/media/vi_0088_20160621_202650.mp4 to Box Queue at pos 14
{2016/06/21 20:26:59} Capturing started
[2016/06/21 20:27:00] Send sy notify.sh
[2016/06/21 20:27:02] Send im
{2016/06/21 20:27:03} Can't find macro /var/www/picam/macros/notify.shim
{2016/06/21 20:27:04} Start boxing /var/www/picam/media/vi_0088_20160621_202650.mp4.h264 to /var/www/picam/media/vi_0088_20160621_202650.mp4 Queue pos 14
[2016/06/21 20:27:05] Stop capture requested
[2016/06/21 20:27:05] Send ca 0
{2016/06/21 20:27:05} Error: Could not send buffers to port, h264 callback
{2016/06/21 20:27:05} Executing macro /var/www/picam/macros/error_hard.sh "Could not send buffers to port, h264 callback"
{2016/06/21 20:27:10} RaspiMJPEG Version 5.6.1
{2016/06/21 20:27:10} Error: Could not enable camera
{2016/06/21 20:27:10} Executing macro /var/www/picam/macros/error_hard.sh "Could not enable camera"
--- repeated messages
{2016/06/22 12:11:30} RaspiMJPEG Version 5.6.1
{2016/06/22 12:11:31} Error: Could not enable camera
{2016/06/22 12:11:31} Executing macro /var/www/picam/macros/error_hard.sh "Could not enable camera"  
2)
My logs are flooded every second with messages regarding keep-alive not set, i changed the line in motion.conf from "netcam_keepalive off" to "netcam_keepalive on" to test but then it throw me another error regarding jpeg in the logs
raspberrypi motion[11925]: [1] [NTC] [NET] netcam_read_first_header: Non-streaming camera (keep-alive not set)
raspberrypi motion[11925]: [1] [NTC] [NET] netcam_read_html_jpeg: disconnecting netcam since keep-alive not set.
raspberrypi motion[11925]: [1] [NTC] [NET] netcam_read_html_jpeg: leaving netcam connected.
raspberrypi motion[11925]: [1] [NTC] [NET] netcam_read_first_header: Found Conn: close header ('Connection: close')
I don't know if the 2 are related, but i'm open to some more testing if this can solve the troubles.
I'm on Jessie + rPi2 + external motion

BTW, which motion is to be considered the stable/preferred version now? Internal or external?

nospam
Posts: 54
Joined: Sun Jun 14, 2015 10:38 pm

Re: RPi Cam Web Interface

Fri Jun 24, 2016 6:33 pm

Question about RPi Cam Control Log

Where is this log data stored on the RPi? path and file name please

tbr
Posts: 18
Joined: Mon Jul 23, 2012 9:12 pm

Re: RPi Cam Web Interface

Fri Jun 24, 2016 11:00 pm

Trying to install on a fresh Jessie Disk image, after running ./install.sh I get the error,

"WARNING: The following packages cannot be authenticated!
dialog
E: There are problems and -y was used without --force-yes"

Any clues?

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

Re: RPi Cam Web Interface

Mon Jun 27, 2016 8:54 am

nospam wrote:Question about RPi Cam Control Log

Where is this log data stored on the RPi? path and file name please
The logging is done to scheduleLog.txt which is located in the web install folder (e.g. /var/www/html). There are two types of entries in the log. Those with [] around the time stamp come from the web side. Those with {} around the time stamp come from the raspimjpeg process.

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

Re: RPi Cam Web Interface

Mon Jun 27, 2016 8:56 am

tbr wrote:Trying to install on a fresh Jessie Disk image, after running ./install.sh I get the error,

"WARNING: The following packages cannot be authenticated!
dialog
E: There are problems and -y was used without --force-yes"

Any clues?
That's a fairly unusual error. It sounds like the keys used to check the repositories are out of date.

Try running

Code: Select all

sudo apt-key update
sudo apt-get update

burnhaj
Posts: 24
Joined: Sun Mar 09, 2014 3:43 am

Re: RPi Cam Web Interface

Tue Jun 28, 2016 1:43 am

I am new to RPi Cam Web Interface but am starting to figure it out.

I would like to have the camera start automatically in the Time Lapse mode rather than Motion Detect when it is powered up. I believe that there is a command line that controls this behavior but have been unsuccessful in finding it and determining just what would need to be changed to enable TL at startup.

Any direction to the location and the changes needed to make this happen would be greatly appreciated.

Thanks

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

Re: RPi Cam Web Interface

Tue Jun 28, 2016 12:31 pm

burnhaj wrote:I am new to RPi Cam Web Interface but am starting to figure it out.

I would like to have the camera start automatically in the Time Lapse mode rather than Motion Detect when it is powered up. I believe that there is a command line that controls this behavior but have been unsuccessful in finding it and determining just what would need to be changed to enable TL at startup.

Any direction to the location and the changes needed to make this happen would be greatly appreciated.

Thanks
There are two easy ways to achieve this.

1) Use the standard scheduler set up. When the scheduler starts up (when the system starts up or after saving a settings change) then it will issue any commands in the appropriate Period start. For example, in all day mode there is only one Period start setting so the scheduler will issue these commands. tl 1 starts the time lapse operation using whatever interval has been previously set up in camera settings or you can use the tv command to set it up here. So putting tv 300;tl 1 into Period start will initiate captures every 30 seconds.

2) You can do exactly the same as 1) but from an external program by sending the same instructions into the FIFO pipe. So assuming you installed in /var/www then echo -n 'tl 1' will start the time lapse. It is a good idea to put a short delay between sending in successive commands (e.g. 1 second) to make sure the previous one finishes before sending the next.


Note also the Command reference on the scheduler page which lists all the commands supported.

rhellyer
Posts: 11
Joined: Sat Sep 26, 2015 3:21 am

Start at boot up

Tue Jun 28, 2016 10:58 pm

I've installed and been using the web interface with a pi version 3 and pics v2 .. the software is wonderful so thanks for the great work.

What is the best way to autostart the picam web app when my RPI boots up?

Thanks

rhellyer
Posts: 11
Joined: Sat Sep 26, 2015 3:21 am

Re: RPi Cam Web Interface

Wed Jun 29, 2016 7:08 am

It's OK - I worked it out and realized that I needed to use ./RPi_Camera_Web_Interface_Installer.sh autostart_yes

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: RPi Cam Web Interface

Wed Jun 29, 2016 1:33 pm

Hey all,

it's some years ago I tried this script and meanwhile there are certainly updates :) Anyone can give me an information update on what have changed so far in the last 2 years for this RPi Cam Web Interface? I own a RPi with revision number 000e which should be Model B Revision 2.0 with 512MB and the RPi Cam connected internally (not usb!) I see there are a lot of tutorials on the net and I am confused which way to choose for setting up a RPi+RPiCam. For example HEREis a ready-to-go image with web interface and motion recording. Is that good? Or do you guys suggest me to try something else?

My goal is:

I want to view the "live" picture of the Picam connected to my RPi2 by accessing it through a webpage. Additionally I want to configure and use motion recording and save the videos somewhere on a predefined path onto the RPi. In the following the new recorded videos should be transferred to a NAS through "rsync" or "ftp" or "scp" or similar and then deleted from the local SD card.

Any help appreciated, please point me to the right direction. Is [url=http://elinux.org/RPi-Cam-Web-Interface]that script/url] still advisable to use or do you guys suggest me to use another solution like the ready-packaged image (motionPie) described at the beginning of my post ?

Cheers

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

Re: RPi Cam Web Interface

Wed Jun 29, 2016 5:49 pm

Pangu wrote:Hey all,

it's some years ago I tried this script and meanwhile there are certainly updates :) Anyone can give me an information update on what have changed so far in the last 2 years for this RPi Cam Web Interface? I own a RPi with revision number 000e which should be Model B Revision 2.0 with 512MB and the RPi Cam connected internally (not usb!) I see there are a lot of tutorials on the net and I am confused which way to choose for setting up a RPi+RPiCam. For example HEREis a ready-to-go image with web interface and motion recording. Is that good? Or do you guys suggest me to try something else?

My goal is:

I want to view the "live" picture of the Picam connected to my RPi2 by accessing it through a webpage. Additionally I want to configure and use motion recording and save the videos somewhere on a predefined path onto the RPi. In the following the new recorded videos should be transferred to a NAS through "rsync" or "ftp" or "scp" or similar and then deleted from the local SD card.

Any help appreciated, please point me to the right direction. Is [url=http://elinux.org/RPi-Cam-Web-Interface]that script/url] still advisable to use or do you guys suggest me to use another solution like the ready-packaged image (motionPie) described at the beginning of my post ?

Cheers
Quite a lot has changed over the last couple of years in RPi Cam Web Interface. It exploits most of the capabilities of the camera module to give a live preview and full control from the web pages to set up the camera, and take full resolution video and image captures. It can playback captures from the web page and can do motion detection using either the external motion program or the built in internal motion detection. A scheduler allows it to vary the set up at different times of the day, and performs housekeeping tasks like deleting older captures if required.

If you want to store media on external devices like NAS then you use standard Linux linking facilities.

Take a look at the wiki for a description of the functions. http://elinux.org/RPi-Cam-Web-Interface

The beauty of the Pi is that is eay to try out different solutions and decide which best satisfies your needs.

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: RPi Cam Web Interface

Wed Jun 29, 2016 6:43 pm

Thanks a lot for the kind reply. Could you tell me what the difference to MotionPie OS is ? I know RPi Cam Web interface very well because I used it 2-3 years ago, but I never heard of MotionPie OS before. It also sounds interesting to me because it's dedicated to the surveillance capabilities for the RPi and it comes pre-shipped with a ready-to-use configuration. I'd really like to know opinions from users who tried both. Thanks in advance

burnhaj
Posts: 24
Joined: Sun Mar 09, 2014 3:43 am

Re: RPi Cam Web Interface

Thu Jun 30, 2016 1:19 am

There are two easy ways to achieve this.

1) Use the standard scheduler set up. When the scheduler starts up (when the system starts up or after saving a settings change) then it will issue any commands in the appropriate Period start. For example, in all day mode there is only one Period start setting so the scheduler will issue these commands. tl 1 starts the time lapse operation using whatever interval has been previously set up in camera settings or you can use the tv command to set it up here. So putting tv 300;tl 1 into Period start will initiate captures every 30 seconds.

2) You can do exactly the same as 1) but from an external program by sending the same instructions into the FIFO pipe. So assuming you installed in /var/www then echo -n 'tl 1' will start the time lapse. It is a good idea to put a short delay between sending in successive commands (e.g. 1 second) to make sure the previous one finishes before sending the next.


Note also the Command reference on the scheduler page which lists all the commands supported.[/quote]


Exactly what I needed. Thanks Btidey!

User avatar
ReadiesCards
Posts: 40
Joined: Sun May 13, 2012 5:22 am

Re: RPi Cam Web Interface

Thu Jun 30, 2016 5:52 am

How do I get the camera to automatically begin motion detection after a reboot?

I have the schedule settings set to the default Day Mode = Sun based but on reboot the Motion Detection button says 'Start' which I take to mean motion detection is not running.

Thanks

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

Re: RPi Cam Web Interface

Thu Jun 30, 2016 11:35 am

ReadiesCards wrote:How do I get the camera to automatically begin motion detection after a reboot?

I have the schedule settings set to the default Day Mode = Sun based but on reboot the Motion Detection button says 'Start' which I take to mean motion detection is not running.

Thanks
The software first starts up after a reboot with motion detection based on the setting in the /etc/raspimjpeg config file

motion_detection false (default)
or
motion_detection true

Then the scheduler will issue any commands in the Period start field associated with the time when the reboot takes place. These commands can include md 1 which will turn motion detection on or md 0 which will turn motion detection off.

If scheduler is set to All Day mode then there is only one Period start so any command there is always executed. So a md 1 will result in motion detection being turned on irrespective of the config setting.

If Scheduler is in Sun mode then it will issue the commands in Period Start corresponding to Period of the day. For example if md 1 is included in the Day period and a md 0 in Dusk period this is basically saying that motion detection should only be active during the day. If you boot up during a day period then it will be turned on. If you boot up any other time then it will wait till the next start of day before turning on.

nospam
Posts: 54
Joined: Sun Jun 14, 2015 10:38 pm

Re: RPi Cam Web Interface

Thu Jun 30, 2016 4:52 pm

Question on thumbnail generation:

Where in the scripts do I define how raspimjpeg defines the thumbnail file name?

example

If I define the filename output as
20160630_125038.jpg.

the thumbnail generated is
20160630_125038.jpg.i0537.th.jpg

I need to get rid of the ".i0537" part

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: RPi Cam Web Interface

Thu Jun 30, 2016 7:56 pm

Pangu wrote: what the difference to MotionPie OS is ? I know RPi Cam Web interface very well because I used it 2-3 years ago, but I never heard of MotionPie OS before. It also sounds interesting to me because it's dedicated to the surveillance capabilities for the RPi and it comes pre-shipped with a ready-to-use configuration. I'd really like to know opinions from users who tried both.
anyone?

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

Re: RPi Cam Web Interface

Fri Jul 01, 2016 9:34 am

nospam wrote:Question on thumbnail generation:

Where in the scripts do I define how raspimjpeg defines the thumbnail file name?

example

If I define the filename output as
20160630_125038.jpg.

the thumbnail generated is
20160630_125038.jpg.i0537.th.jpg

I need to get rid of the ".i0537" part
In your example 20160630_125038.jpg is the name of the full resolution image capture and its name is what is controlled by the naming scheme (image_path in /etc/raspimjpeg).

A thumbnail is generated for all captures and its name is the same as the full resolution file but with .xNNNN.th.jpg added on the end. x describes the type of capture (i image, v video, t timelapse, NNNN is the serial number of the capture and th.jpg identifies it as a thumbnail. This scheme is not configurabl as it is what ties a thumbnail back to the full resolution capture and allows the web pages to function.

If you want to produce copies of the thumbnails with a different name somewhere else then this could be achieved using a macro. For example, when an image is captured then the end_img.sh macro is run if it is present. It is passed the thumbnail name and the macro script can then do whatever it wants with that.

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: RPi Cam Web Interface

Fri Jul 01, 2016 3:24 pm

Pangu wrote:
Pangu wrote: what the difference to MotionPie OS is ? I know RPi Cam Web interface very well because I used it 2-3 years ago, but I never heard of MotionPie OS before. It also sounds interesting to me because it's dedicated to the surveillance capabilities for the RPi and it comes pre-shipped with a ready-to-use configuration. I'd really like to know opinions from users who tried both.
anyone?
Well, meanwhile I tried MotionEye OS and my impression is: it's a nice GUI and really easy to setup. No fiddling around in config files or on the shell prompt, everything is very simple to setup through WebUI. Very nice! Overall it's really simple to install and configure but the only disadvantage is:

The performance is not as good as expected, the frame rates are really low. There is an option called "Fast-Network-Camera" which you can enable and afterwards it works pretty fine as one would expect from the RPi+RPiCam. Unfortunately this has a down-side as explained on the Fast-Network-Camera WiKi: you cannot use still images, you cannot record video and you cannot use motion. Simple said ==> you can only monitor the live cam, that's all.

Anyone else experienced this and can share his opinion, please?

nospam
Posts: 54
Joined: Sun Jun 14, 2015 10:38 pm

Re: RPi Cam Web Interface

Fri Jul 01, 2016 4:15 pm

If you want to produce copies of the thumbnails with a different name somewhere else then this could be achieved using a macro. For example, when an image is captured then the end_img.sh macro is run if it is present. It is passed the thumbnail name and the macro script can then do whatever it wants with that.
OK thanks for pointing me in the right direction. How do I get the file name handle in the macro of the image just created? In my example I want to rename the thumbnail that was created e.g.

end_img.sh

Code: Select all

#!/bin/bash
mv 20160630_125038.jpg.i0537.th.jpg 20160630_125038.jpg.th.jpg

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

Re: RPi Cam Web Interface

Fri Jul 01, 2016 6:23 pm

nospam wrote:
OK thanks for pointing me in the right direction. How do I get the file name handle in the macro of the image just created? In my example I want to rename the thumbnail that was created e.g.

end_img.sh

Code: Select all

#!/bin/bash
mv 20160630_125038.jpg.i0537.th.jpg 20160630_125038.jpg.th.jpg
Job macros get passed a command line parameter containing the full path to the captured image. This can be referenced as $1 in the script. You would need to construct the thumbnail name from that. If you have removed the %i parameter from the name then you would have to search the media folder to find a file that started the same as $1 and ended in th.jpg

If you rename it like you suggest then you will break the web access to both the thumbnail and the original image. The web code uses the extra fields at the end of the thumbnail to do its work.

You can copy if you like to some other name or some other location but bear in mind the web functions to clear up files when an item is deleted or purged won't apply to these copies.

If you can explain why you want to change the name then that might help.

Return to “Camera board”