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

Re: RPi Cam Web Interface

Thu Apr 09, 2015 1:24 pm

ianj wrote:Has anybody had recent trouble with motion not triggering captures? Working with a Pi B, brand new install of Raspbian and the latest btidey version 4.4.2R.

My trouble:

-If I haven't clicked the motion capture button, going to edit motion settings page results in "Motion not running. Put in detection state"
-Going to edit motion settings after clicking motion detection start will bring me to a page after lots of waiting, with nothing on it. Just blank space. Takes a good 1-2 minutes.
-The log shows "motion detection started and stopped" as per the button clicking
-Set the schedule to AllDay

Motion doesn't seem to fire off a record. Sending video record commands (ca 0, 1) via console works, hitting the record video button works.
As this seems a common question I added a trouble shooting section to end of pdf with motion detection as first topic.

However, I am not sure it is going to deal with your problem which seems a bit strange.

First going to the motion page and getting that message is quite normal. The settings are retrieved and saved via a web control interface in motion itself so it only works if motion is running. I have only ever seen a virtually immediate response to the request to get settings so something is wrong there.

Try this
manually motion config (sudo nano /etc/motion/motion.conf)
Check that control_port 6642 and control_html_output off
Change control_localhost to off and save the file
Stop and restart motion (turn off motion detection and back on again

Now browse to http://yourcamIP:6642/0/config/list This accesses the motion control port and asks for a full list of settings. You should get back a text page with all the motion parameters.

If you do not get this then there is something seriously wrong with the motion install.

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

Re: RPi Cam Web Interface

Thu Apr 09, 2015 1:34 pm

Sephiron wrote:
btidey wrote:
I formatted the card, installed latest version of raspbian, then used these instructions http://elinux.org/RPi-Cam-Web-Interface to install everything (using latest version of your repo).
After making all the necessary adjustments and restarting raspberry, It starts to print the error.message continuously again.
It prints those messages even after I change permissions with "sudo chmod 666 /var/www/scheduleLog.txt".

Edit: I am getting a feeling that the error is caused by multiple files trying to open the logfile at the same time. Is there a reasonable way to check/fix that?
There are three things that can write to the log; the web page schedule.php, a background version of schedule.php which is normally running and actions the schedule and raspimjpeg. You can separate the raspimjpeg from this by changing the log_file setting in the /etc/raspimjpeg config file to something else like /var/www/raspiLog.txt. That is worth doing as a test. You will need to stop and start raspimjpeg.

Currently there is not a way to separate the logging of the background and web page schedule but the latter can only log when it is on screen and in general logs very little other than when you save settings. The logging routines open, append, and close the file, plus if they can't open the file then they just skip that item.

Are you running a Pi2? It shouldn't matter but the multiple core might be having some effect.

Edit Couple of further tests if raspimjpeg is still set to log to scheduleLog.txt
sudo rm /var/www/scheduleLog.txt to remove the file
echo -n 'im' >/var/www/FIFO to trigger an image capture and raspimjpeg should create and start the log
ls -l /var/www/scheduleLog.txt should show root owns the log but permissions should be rwxrwxrwx

If you now

sudo rm /var/www/scheduleLog.txt to remove the file
Go into schedule screen and save settings so that schedule creates the file
ls -l /var/www/scheduleLog.txt should show www-data owns the log and permissions should be rw r r

AlainA+
Posts: 2
Joined: Wed Mar 11, 2015 2:50 pm

Re: RPi Cam Web Interface

Thu Apr 09, 2015 2:14 pm

Hi Robert and Sylvan !

ToDay... i see your projet, your great projet ! Nice Job Guys !!!

At this time i only play with "RaspiMjpeg" witch anwser for what i'm looking...
I don't install anything else, but just some little on the other code (web, script etc...)

i have some remarques, but not a lot time actualy to give to you.
today just 2 thinks, one error and one idea

on the github of Robert in the install scripts... (https://github.com/roberttidey/RPi_Cam_ ... staller.sh)

Line 124-125:
- if [ ! -e /var/www/raspimjpeg ];
- sudo ln -s /etc/raspimjpeg /var/www/raspimjpeg
+ if [ ! -e /var/www/$rpicamdir/raspimjpeg ];
+ sudo ln -s /etc/raspimjpeg /var/www/$rpicamdir/raspimjpeg

(to respect the choice of the folder config use by $rpicamdir, and "if" the user choice 'raspimjpeg' as the folder name your link don't work ;) )

on the github of Robert i see (rapid) the project "RaspCam" for motion ans the gestion of Night, Dawn,Day and Dusk...
(https://github.com/roberttidey/RaspiCam)
why don't use a simply solution, and a real solution by using the detection of the variation of a little photoresistor ?
Image
it's cheap... simple... and easy with a Raspberry... and alway give the real light :idea:

see you soon !! your project is a great interest ! :D

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

Re: RPi Cam Web Interface

Thu Apr 09, 2015 2:45 pm

*** IMPORTANT ***

As part of the simplification of the projects my changes are merged back into silvan's original repo
https://github.com/silvanmelchior/RPi_Cam_Web_Interface

My fork is now redundant and all installs / updates etc should refer to the original.

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

Re: RPi Cam Web Interface

Thu Apr 09, 2015 2:57 pm

AlainA+ wrote:Hi Robert and Sylvan !

i have some remarques, but not a lot time actualy to give to you.
today just 2 thinks, one error and one idea

on the github of Robert in the install scripts... (https://github.com/roberttidey/RPi_Cam_ ... staller.sh)

Line 124-125:
- if [ ! -e /var/www/raspimjpeg ];
- sudo ln -s /etc/raspimjpeg /var/www/raspimjpeg
+ if [ ! -e /var/www/$rpicamdir/raspimjpeg ];
+ sudo ln -s /etc/raspimjpeg /var/www/$rpicamdir/raspimjpeg

(to respect the choice of the folder config use by $rpicamdir, and "if" the user choice 'raspimjpeg' as the folder name your link don't work ;) )

why don't use a simply solution, and a real solution by using the detection of the variation of a little photoresistor ?
Thanks for pointing out install script problem if installing underneath www. We'll correct that. However, I've never tried that and I suspect there may be other issues with other parts of the program that are relying on the Document root being /var/www.

A light detector input as scheduler control is interesting but not quite so easy for a Pi which has no analog in. One might need to use a i2c or one-wire sensor.

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

Re: RPi Cam Web Interface

Thu Apr 09, 2015 6:10 pm

Cool. Will try when I get home from work, thanks for the help!

Say this all fails, what do you think next steps would be for fixing motion? I've tried apt-get purge/remove motion after the first failure to make sure it was wiped completely. What else would do the trick, any other stray settings and files to delete / reinstall?

Edit: Ok, that did work. Here's the list of settings:
daemon = on
process_id_file = (null)
setup_mode = off
videodevice = /dev/video0
v4l2_palette = 8
input = 8
norm = 0
frequency = 0
rotate = 0
width = 352
height = 288
framerate = 2
minimum_frame_time = 0
netcam_url = http://localhost/cam_pic.php
netcam_userpass = (null)
netcam_http = 1.0
netcam_proxy = (null)
netcam_tolerant_check = off
auto_brightness = off
brightness = 0
contrast = 0
saturation = 0
hue = 0
roundrobin_frames = 1
roundrobin_skip = 1
switchfilter = off
threshold = 1500
threshold_tune = off
noise_level = 32
noise_tune = on
despeckle = EedDl
area_detect = (null)
mask_file = (null)
smart_mask_speed = 0
lightswitch = 0
minimum_motion_frames = 1
pre_capture = 0
post_capture = 0
gap = 3
max_mpeg_time = 0
output_all = off
output_normal = off
output_motion = off
quality = 75
ppm = off
ffmpeg_cap_new = off
ffmpeg_cap_motion = off
ffmpeg_timelapse = 0
ffmpeg_timelapse_mode = daily
ffmpeg_bps = 500000
ffmpeg_variable_bitrate = 0
ffmpeg_video_codec = swf
ffmpeg_deinterlace = off
snapshot_interval = 0
locate = off
text_right = %Y-%m-%d\n%T-%q
text_left = (null)
text_changes = off
text_event = %Y%m%d%H%M%S
text_double = off
target_dir = /var/www/media
snapshot_filename = %v-%Y%m%d%H%M%S-snapshot
jpeg_filename = vthumb_%Y%m%d_%H%M%S
movie_filename = %v-%Y%m%d%H%M%S
timelapse_filename = %Y%m%d-timelapse
webcam_port = 0
webcam_quality = 50
webcam_motion = off
webcam_maxrate = 1
webcam_localhost = on
webcam_limit = 0
control_port = 6642
control_localhost = off
control_html_output = off
control_authentication = (null)
track_type = 0
track_auto = off
track_port = (null)
track_motorx = 0
track_motory = 0
track_maxx = 0
track_maxy = 0
track_iomojo_id = 0
track_step_angle_x = 10
track_step_angle_y = 10
track_move_wait = 10
track_speed = 255
track_stepsize = 40
quiet = on
on_event_start = echo -n '1' > /var/www/FIFO1
on_event_end = echo -n '0' > /var/www/FIFO1
on_picture_save = (null)
on_motion_detected = (null)
on_area_detected = (null)
on_movie_start = (null)
on_movie_end = (null)
on_camera_lost = (null)
sql_log_image = on
sql_log_snapshot = on
sql_log_mpeg = off
sql_log_timelapse = off
sql_query = insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
mysql_db = (null)
mysql_host = localhost
mysql_user = (null)
mysql_password = (null)
pgsql_db = (null)
pgsql_host = localhost
pgsql_user = (null)
pgsql_password = (null)
pgsql_port = 5432
video_pipe = (null)
motion_video_pipe = (null)
thread = (null)
btidey wrote:
ianj wrote:Has anybody had recent trouble with motion not triggering captures? Working with a Pi B, brand new install of Raspbian and the latest btidey version 4.4.2R.

My trouble:

-If I haven't clicked the motion capture button, going to edit motion settings page results in "Motion not running. Put in detection state"
-Going to edit motion settings after clicking motion detection start will bring me to a page after lots of waiting, with nothing on it. Just blank space. Takes a good 1-2 minutes.
-The log shows "motion detection started and stopped" as per the button clicking
-Set the schedule to AllDay

Motion doesn't seem to fire off a record. Sending video record commands (ca 0, 1) via console works, hitting the record video button works.
As this seems a common question I added a trouble shooting section to end of pdf with motion detection as first topic.

However, I am not sure it is going to deal with your problem which seems a bit strange.

First going to the motion page and getting that message is quite normal. The settings are retrieved and saved via a web control interface in motion itself so it only works if motion is running. I have only ever seen a virtually immediate response to the request to get settings so something is wrong there.

Try this
manually motion config (sudo nano /etc/motion/motion.conf)
Check that control_port 6642 and control_html_output off
Change control_localhost to off and save the file
Stop and restart motion (turn off motion detection and back on again

Now browse to http://yourcamIP:6642/0/config/list This accesses the motion control port and asks for a full list of settings. You should get back a text page with all the motion parameters.

If you do not get this then there is something seriously wrong with the motion install.

Sephiron
Posts: 13
Joined: Fri Mar 27, 2015 11:10 am

Re: RPi Cam Web Interface

Fri Apr 10, 2015 9:10 am

btidey wrote: There are three things that can write to the log; the web page schedule.php, a background version of schedule.php which is normally running and actions the schedule and raspimjpeg. You can separate the raspimjpeg from this by changing the log_file setting in the /etc/raspimjpeg config file to something else like /var/www/raspiLog.txt. That is worth doing as a test. You will need to stop and start raspimjpeg.

Currently there is not a way to separate the logging of the background and web page schedule but the latter can only log when it is on screen and in general logs very little other than when you save settings. The logging routines open, append, and close the file, plus if they can't open the file then they just skip that item.

Are you running a Pi2? It shouldn't matter but the multiple core might be having some effect.

Edit Couple of further tests if raspimjpeg is still set to log to scheduleLog.txt
sudo rm /var/www/scheduleLog.txt to remove the file
echo -n 'im' >/var/www/FIFO to trigger an image capture and raspimjpeg should create and start the log
ls -l /var/www/scheduleLog.txt should show root owns the log but permissions should be rwxrwxrwx

If you now

sudo rm /var/www/scheduleLog.txt to remove the file
Go into schedule screen and save settings so that schedule creates the file
ls -l /var/www/scheduleLog.txt should show www-data owns the log and permissions should be rw r r
I am not using Pi2 and I did everything you described, but the problem still persists(all permissions are as you have said). I even formatted the card and installed everything from scratch tried formatting the card and followed instructions on the main page to reinstall everything, but the warning still persists. I just don't know what I am doing wrong, since I just follow steps 1-5 exactly like they are given in http://elinux.org/RPi-Cam-Web-Interface. It starts printing errors immediately after I reboot it after step 5

jarrah31
Posts: 125
Joined: Wed Oct 10, 2012 10:16 am

Re: RPi Cam Web Interface

Fri Apr 10, 2015 11:00 am

silvanmelchior wrote:Great, I'd suggest the following:

1. I add you as a collaborator to my interface repository, so you can push all your commits easily. You would write in your repo that the newest version is in my repo.

2. We use your userland-repo, since my is way behind the official one and merging wouldn't be very funny. So I write in my repo that it isn't updated anymore and link to your repo and you could add me as collaborator there.

3. I change the first post to a single link to the wiki, where I add my actual first post as the first section, then we can edit is to be up-to-date.

What do you think? Is this ok for you or would you like to do it in another way?

Silvan
Hi Silvan,

Good to see you back here! Thanks for the really great wiki update, I like how clear the instructions are and that it has a great introduction to the software.

Robert, do you have an account on the wiki? I'm going to put a link to your PDF because I know you keep updating it with useful information, but I wonder if we should include links to posts where you've replied with useful information too, to save people asking the same questions again? I'll start by reviewing some of the previous posts.

jarrah31
Posts: 125
Joined: Wed Oct 10, 2012 10:16 am

Re: RPi Cam Web Interface

Fri Apr 10, 2015 11:26 am

Does anyone know why we can't change web interface values on Safari from an iPhone/iPad/Mac please?

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

Re: RPi Cam Web Interface

Fri Apr 10, 2015 11:51 am

Sephiron wrote: I am not using Pi2 and I did everything you described, but the problem still persists(all permissions are as you have said). I even formatted the card and installed everything from scratch tried formatting the card and followed instructions on the main page to reinstall everything, but the warning still persists. I just don't know what I am doing wrong, since I just follow steps 1-5 exactly like they are given in http://elinux.org/RPi-Cam-Web-Interface. It starts printing errors immediately after I reboot it after step 5
Starting to scratch my head on this one. Maybe try following.

Stop motion detect, stop schedule from schedule screen, and stop camera. Close browser page into camera.

sudo rm /var/www/scheduleLog.txt

Grab a copy of the parent directory (ls -l /var >~/var.txt )
Grab a copy of the www directory (ls -l /var/www >~/wwwraw.txt )

Copy in logtest.php from zip into /var/www

Browse to http://camIp/logtest.php This writes a log record using same routine.

Does this give permissions error?

Grab another copy of the www directory (ls -l /var/www >~/wwwlog.txt )

Zip up those grabs and post here.
Attachments
logtest.zip
(325 Bytes) Downloaded 48 times

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

Re: RPi Cam Web Interface

Fri Apr 10, 2015 12:04 pm

jarrah31 wrote:
Robert, do you have an account on the wiki? I'm going to put a link to your PDF because I know you keep updating it with useful information, but I wonder if we should include links to posts where you've replied with useful information too, to save people asking the same questions again? I'll start by reviewing some of the previous posts.
Just created an account there. Links would be good. As the web side of pipan stuff is built in, a lot of the instructions there can be simplified.

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

Re: RPi Cam Web Interface

Fri Apr 10, 2015 12:33 pm

btidey wrote:*** IMPORTANT ***

As part of the simplification of the projects my changes are merged back into silvan's original repo
https://github.com/silvanmelchior/RPi_Cam_Web_Interface

My fork is now redundant and all installs / updates etc should refer to the original.
Great news, does that mean we can revert back to using the original procedure to upgrade to the current version?
3b+, 2b, b+, b, Zero & Zero-W

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

Re: RPi Cam Web Interface

Fri Apr 10, 2015 12:47 pm

Gary Littlemore wrote:
btidey wrote:*** IMPORTANT ***

As part of the simplification of the projects my changes are merged back into silvan's original repo
https://github.com/silvanmelchior/RPi_Cam_Web_Interface

My fork is now redundant and all installs / updates etc should refer to the original.
Great news, does that mean we can revert back to using the original procedure to upgrade to the current version?
You should now be using the original repo as indicated in the wiki. The instructions remain the same as shown there or that also worked if using my previous fork. The install script does support an upgrade action as well as install which just updates the code files and doesn't change the config files.

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

Re: RPi Cam Web Interface

Fri Apr 10, 2015 2:22 pm

HI Robert,
With regard to the WEB GUI showing stuck in recording for long time, I tried to manually stop the Scheduler and start the scheduler again, that seems bring back the "frozen" in recording mode.

In that "frozen" mode, the h264 was left and unconverted to MP4.

Haven't found any useful log, being in debug text file, either by storing file in SD card or CIFS NAS.

Just so you know this a a workaround for the issue (pi cam in high traffic area). If I find out new info, will let you know.
If you have some thoughts, please let us know as well.
thanks
BTW, with current install of your repo, if we are going to do new update, do we do,
$git pull origin master
as we always do? or
we have to redo
$git clone https://silvan's repo all over again?

thanks

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

Re: RPi Cam Web Interface

Fri Apr 10, 2015 2:47 pm

piecam wrote:HI Robert,
With regard to the WEB GUI showing stuck in recording for long time, I tried to manually stop the Scheduler and start the scheduler again, that seems bring back the "frozen" in recording mode.

In that "frozen" mode, the h264 was left and unconverted to MP4.

Haven't found any useful log, being in debug text file, either by storing file in SD card or CIFS NAS.

Just so you know this a a workaround for the issue (pi cam in high traffic area). If I find out new info, will let you know.
If you have some thoughts, please let us know as well.
thanks
BTW, with current install of your repo, if we are going to do new update, do we do,
$git pull origin master
as we always do? or
we have to redo
$git clone https://silvan's repo all over again?

thanks
If I understand this then stopping restarting scheduler releases it from 'frozen state'. Is that right? When it is stuck in this state is it continuing to record to the h264 file or there is a h264 file that just hasn't been converted?

For updates the git clone needs to be redone once back to the common repo (silvan). Updates will then refresh from this repo from then on.

fengbers
Posts: 1
Joined: Fri Apr 10, 2015 10:10 pm

Re: RPi Cam Web Interface

Fri Apr 10, 2015 10:43 pm

Sephiron wrote:2btidey
Thanks again for the great work. After a bit of fiddling around I found where the error with the servos was (wrong address of python script at startup), so I got everything working with the old version.

For some reason, when I update to the newest version, the program starts complaining about permissions:
PHP Warning: fopen(scheduleLog.txt): failed to open stream: Permission denied in /var/www/config.php on line 46
PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/config.php on line 48
PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /var/config.php on line 49
and it keeps repeating these messages. How to fix that?

Also, at one point the camera stopped recording altogether. The page was there and video feed from camera came, but even with motion detection on, it wouldn't start recording when something moved (it ran properly for around a day before that happened).

P.S. Is there any chance you would modify your distribution, so that when I refresh the webpage and try moving the camera (with servos), it wouldn't return to neutral position? I have the code to fix the issue, but I have to rewrite it again after updates, since part of it is in index.php. I can repost updated version here if it helps.
Had the same problem with the PHP Warning. Not sure that it has been solved already.
Seems that the logfiles cannot be found in config.php
What worked for me:
I changed the config.php
added in the top section with the defines
define('LBASE_DIR',dirname(__FILE__));
then in the function writeLog($msg):
$log = fopen(LBASE_DIR. '/' .LOGFILE_SCHEDULE,'a')
did the same in the function: saveUserConfig($config)

donster22
Posts: 19
Joined: Sat Nov 09, 2013 3:35 pm

404 error on index.php

Sat Apr 11, 2015 8:50 am

hello.

in my syslog i see these 2 lines repeated every 10 seconds.

Apr 11 09:42:40 raspberrypi motion: [1] Retrying until successful connection with camera
Apr 11 09:42:40 raspberrypi motion: [1] libjpeg decompression failure on first frame - giving up!

snapshots work fine but when i poke something in the birdbox to create motion, nothing records.

thanks for any pointers,
don
Last edited by donster22 on Sat Apr 11, 2015 10:18 am, edited 4 times in total.

silvanmelchior
Posts: 76
Joined: Mon Nov 25, 2013 5:56 pm

Re: RPi Cam Web Interface

Sat Apr 11, 2015 9:45 am

Hello everybody

I finally implemented a circular buffer for video recording, so you'll be able to record the "past" with motion detection or manually by hand.

The size of the buffer is set in milliseconds with the config-file or on the web-page, however, this value will then be calculated into a buffer-size in bytes according to the bitrate, so it's not very exactly. If you have a lot of motion in the picture for example, the gpu can't compress the video very well, so the buffer is "shorter" compared to a video with nearly no motion in it.

Please test the new feature and give me a feedback if it works for you

Silvan

Dittie
Posts: 9
Joined: Sun Mar 29, 2015 12:57 pm

Re: RPi Cam Web Interface

Sat Apr 11, 2015 10:15 am

silvanmelchior wrote:Hello everybody

I finally implemented a circular buffer for video recording, so you'll be able to record the "past" with motion detection or manually by hand.

The size of the buffer is set in milliseconds with the config-file or on the web-page, however, this value will then be calculated into a buffer-size in bytes according to the bitrate, so it's not very exactly. If you have a lot of motion in the picture for example, the gpu can't compress the video very well, so the buffer is "shorter" compared to a video with nearly no motion in it.

Please test the new feature and give me a feedback if it works for you

Silvan
So I am on the latest version of the robert's fork. What would be the commands to switch to your repository again (keeping my config changes) ?

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

Re: RPi Cam Web Interface

Sat Apr 11, 2015 11:03 am

silvanmelchior wrote:
Please test the new feature and give me a feedback if it works for you

Silvan
Great stuff silvan.

Quick test looks OK.

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

Re: RPi Cam Web Interface

Sat Apr 11, 2015 11:15 am

Dittie wrote:
So I am on the latest version of the robert's fork. What would be the commands to switch to your repository again (keeping my config changes) ?
I think this will work

First play safe and back up your existing config data
a) /etc/motion/motion.conf
b) /etc/raspimjpeg
c) /var/www/uconfig
d) /var/www/schedule.json

Delete the existing RPI_Cam_Web_Interface in your home folder
Git clone from silvanmelchior repository which is now the root project and all further updates are from here.

Run RPI_Cam_Web_Interface_Install.sh update

update just copies new www and code stuff, it doesn't update any config files so it should leave your settings in place but obviously any new stuff in config files has to be manually added

Manually add the new raspimjpeg item controlling the circular buffer

sudo nano /etc/raspimjpeg

Add the line

video_buffer 0

(put it after video_bitrate to keep same as supplied config file)

You can change the value of video_buffer here in the default file or you can change it from the web interface

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

Re: RPi Cam Web Interface

Sat Apr 11, 2015 11:34 am

fengbers wrote: Had the same problem with the PHP Warning. Not sure that it has been solved already.
Seems that the logfiles cannot be found in config.php
What worked for me:
I changed the config.php
added in the top section with the defines
define('LBASE_DIR',dirname(__FILE__));
then in the function writeLog($msg):
$log = fopen(LBASE_DIR. '/' .LOGFILE_SCHEDULE,'a')
did the same in the function: saveUserConfig($config)
Thanks that's Interesting. The code in config was relying on the current directory being the www directory which had not caused me a problem but it is better to set it explicitly like the other php files do.

I have changed it to include that and added it in to the other routines in config.php that access data files as well.

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

Re: RPi Cam Web Interface

Sat Apr 11, 2015 1:07 pm

silvanmelchior wrote: The size of the buffer is set in milliseconds with the config-file or on the web-page, however, this value will then be calculated into a buffer-size in bytes according to the bitrate, so it's not very exactly. If you have a lot of motion in the picture for example, the gpu can't compress the video very well, so the buffer is "shorter" compared to a video with nearly no motion in it.

Please test the new feature and give me a feedback if it works for you

Silvan
This is working very nicely now I have seen some real world motion triggered captures.

The annotation timestamps can also help tune the buffer size particularly if the main use is with motion triggers.

The thumbnail is captured at the point of video start trigger whereas the video will have an earlier start timestamp due to the circular buffer used to add video before the trigger. This is nice because the thumbnail shows the cause of the trigger. The time difference as seen on the thumbnail and the video shows how much video is being stored in the buffer. In my case, for motion triggers, setting a buffer of 3000 resulted in 6 seconds of pre-trigger video. By definition there is not a lot of movement in the first part resulting in high coding efficiency.

If the video is being manually started then the time difference could be more variable as it will more dependent on movement occurring at that time.

Dittie
Posts: 9
Joined: Sun Mar 29, 2015 12:57 pm

Re: RPi Cam Web Interface

Sat Apr 11, 2015 2:07 pm

btidey wrote:
Dittie wrote:
So I am on the latest version of the robert's fork. What would be the commands to switch to your repository again (keeping my config changes) ?
I think this will work

First play safe and back up your existing config data
a) /etc/motion/motion.conf
b) /etc/raspimjpeg
c) /var/www/uconfig
d) /var/www/schedule.json

Delete the existing RPI_Cam_Web_Interface in your home folder
Git clone from silvanmelchior repository which is now the root project and all further updates are from here.

Run RPI_Cam_Web_Interface_Install.sh update

update just copies new www and code stuff, it doesn't update any config files so it should leave your settings in place but obviously any new stuff in config files has to be manually added

Manually add the new raspimjpeg item controlling the circular buffer

sudo nano /etc/raspimjpeg

Add the line

video_buffer 0

(put it after video_bitrate to keep same as supplied config file)

You can change the value of video_buffer here in the default file or you can change it from the web interface
Thanks, worked!

Dittie
Posts: 9
Joined: Sun Mar 29, 2015 12:57 pm

Re: RPi Cam Web Interface

Sat Apr 11, 2015 2:17 pm

silvanmelchior wrote:Hello everybody

I finally implemented a circular buffer for video recording, so you'll be able to record the "past" with motion detection or manually by hand.

The size of the buffer is set in milliseconds with the config-file or on the web-page, however, this value will then be calculated into a buffer-size in bytes according to the bitrate, so it's not very exactly. If you have a lot of motion in the picture for example, the gpu can't compress the video very well, so the buffer is "shorter" compared to a video with nearly no motion in it.

Please test the new feature and give me a feedback if it works for you

Silvan
This is really a nice addition! Good to have you back and glad to see you will be working on this together.
Since the movements were short in on my cam it always captured a bit to late. Now the video is actually showing the full movement.

What I did notice while reviewing the timestamps in motion started video is something like this :

Suppose a video started motion triggered with timestamp 16:30:01

16:30:01 good video
16:30:02 good video
16:30:00 blurry/still video
16:30:01 blurry/still video
16:30:02 blurry/still video
16:30:03 good video
16:30:04 good video
16:30:05 good video

It jumps back some seconds and shows blurry video those couple of seconds, after that video looks good again.
Any idea what that could be and how to fix it ? I could send you an example video if you would like to check it out.

Return to “Camera board”