Nestboxtech
Posts: 71
Joined: Fri Apr 11, 2014 9:45 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 03, 2019 8:14 pm

billw wrote:
Sun Feb 03, 2019 12:25 am
Nestboxtech wrote:
Sat Feb 02, 2019 11:16 pm
I had a go at making the modifications detailed in the example-motion-events script and then pikrellcam.conf for the
on_motion_begin $C/motion_events $e modification, then running pikrellcam from a terminal window, and get:
sh: 1: /home/pi/pikrellcam/scripts/motion_events: Permission denied
I created the motion-events folder as the pi user, I've probably made a stupid mistake, but am struggling to figure out what I've done, I thought that as I ran pikrellcam from the pi user terminal as you said.
When you copied it, does it still have execute permission?
In your ssh terminal, run

Code: Select all

[email protected]: ~/pikrellcam$ ls -l ~/pikrellcam/scripts/motion_events 
-rwxr-xr-x 1 pi pi 1496 Oct 13 11:53 /home/pi/pikrellcam/scripts/motion_events*
You should be able to run the script by hand and it will report the motion events for the last motion video:

Code: Select all

cd ~/pikrellcam/scripts
./motion_events test-run
Output will be like:

Code: Select all

on_motion_begin triggered by: test-run
  motion event number: 1
    motion direction - region: 0
  motion event number: 2
    motion direction - region: 0
    ...
Thanks I got that to work now. I can see that is helpfully documented in the help pages too.
I wondered if it would make more sense to trigger this sort of parsing script on an on_motion_end event otherwise you would miss any triggers that happen in the motion_event_gap?

I'll have a play with that output format, in preparation for your kind offer to add functiaonlaity to generate an equivalent output that doesn't depend on the generation of a video.
http://nestboxtech.blogspot.co.uk/

billw
Posts: 402
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 03, 2019 10:22 pm

Nestboxtech wrote:
Sun Feb 03, 2019 8:14 pm
Thanks I got that to work now. I can see that is helpfully documented in the help pages too.
I wondered if it would make more sense to trigger this sort of parsing script on an on_motion_end event otherwise you would miss any triggers that happen in the motion_event_gap?

I'll have a play with that output format, in preparation for your kind offer to add functiaonlaity to generate an equivalent output that doesn't depend on the generation of a video.
A motion event in the event gap is reported in that file because it is part of the overall motion video. The event gap is extended each
time motion happens in the gap.

It's not intended to run with an on_motion_end because the file is overwritten for each motion video. A new video could start before
your on_motion_end command can run. The on_motion_end happens after a video is converted to mp4 and a new motion video
could start before that conversion is done depending on confirm_gap and how long the conversion takes. When run with on_motion_begin
you get motion events is very close to real time which is part of the idea. It doesn't matter if all you do is write to a database, but
I had in mind being able to dynamically control cameras on servos with that motion data as motion is in progress.

The example-motion-events script is bare bones. There is more info reported than is printed. For example the magnitude and count
of motion vectors is reported. Print the "line" as it is read to see all the data reported.

Nestboxtech
Posts: 71
Joined: Fri Apr 11, 2014 9:45 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 03, 2019 11:24 pm

Different topic...

I'm getting a lot of 504 Gateway Time-outs (nginx/1.10.3), Bill - do you have any suggestions? I have zero experience in webserver configuration!
For info the affected units are Raspberry Pi Zero W, running PiKrellCam V4.1.6. iwconfig reports wifi connection speeds of between 5Mbit/sec and 24MBit/sec. o/s is current version of Raspian Stretch Lite on one and Full distro on the other.
The closest I came is this: http://www.queryadmin.com/933/nginx-504 ... y-timeout/ but I really dont know what I'm doing and want to avoid climbing a tree if a toast it!
I never have a problem connecting by SSH
http://nestboxtech.blogspot.co.uk/

billw
Posts: 402
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Feb 04, 2019 3:58 pm

Nestboxtech wrote:
Sun Feb 03, 2019 11:24 pm
Different topic...

I'm getting a lot of 504 Gateway Time-outs (nginx/1.10.3), Bill - do you have any suggestions? I have zero experience in webserver configuration!
For info the affected units are Raspberry Pi Zero W, running PiKrellCam V4.1.6. iwconfig reports wifi connection speeds of between 5Mbit/sec and 24MBit/sec. o/s is current version of Raspian Stretch Lite on one and Full distro on the other.
The closest I came is this: http://www.queryadmin.com/933/nginx-504 ... y-timeout/ but I really dont know what I'm doing and want to avoid climbing a tree if a toast it!
I never have a problem connecting by SSH
I haven't seen any 504 errors on my Pi's and don't have a good idea why that would happen on a LAN. If you are accessing the pikrellcam
page with a DNS name, you could try using the IP address to bypass DNS lookup and see if that makes a difference. Or maybe there
is a wifi issue because as low as 5Mb/s seems pretty low to me. Check your wifi signal strength and link quality (from iwconfig).
One install I have now has 90 Mb/s with a signal strength of -50 dBm and Link Quality=60/70 . In the past I have had wifi dropout
issues with a Pi where the signal strength was as low as -65 dBm, but I never saw gateway errors.

Nestboxtech
Posts: 71
Joined: Fri Apr 11, 2014 9:45 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Feb 05, 2019 7:10 pm

billw wrote:
Mon Feb 04, 2019 3:58 pm
Nestboxtech wrote:
Sun Feb 03, 2019 11:24 pm
Different topic...

I'm getting a lot of 504 Gateway Time-outs (nginx/1.10.3), Bill - do you have any suggestions? I have zero experience in webserver configuration!
For info the affected units are Raspberry Pi Zero W, running PiKrellCam V4.1.6. iwconfig reports wifi connection speeds of between 5Mbit/sec and 24MBit/sec. o/s is current version of Raspian Stretch Lite on one and Full distro on the other.
The closest I came is this: http://www.queryadmin.com/933/nginx-504 ... y-timeout/ but I really dont know what I'm doing and want to avoid climbing a tree if a toast it!
I never have a problem connecting by SSH
I haven't seen any 504 errors on my Pi's and don't have a good idea why that would happen on a LAN. If you are accessing the pikrellcam
page with a DNS name, you could try using the IP address to bypass DNS lookup and see if that makes a difference. Or maybe there
is a wifi issue because as low as 5Mb/s seems pretty low to me. Check your wifi signal strength and link quality (from iwconfig).
One install I have now has 90 Mb/s with a signal strength of -50 dBm and Link Quality=60/70 . In the past I have had wifi dropout
issues with a Pi where the signal strength was as low as -65 dBm, but I never saw gateway errors.
I suspect its a wifi signal problem...
http://nestboxtech.blogspot.co.uk/

kajan001
Posts: 20
Joined: Wed Feb 13, 2019 7:15 am

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 13, 2019 8:01 am

Pi Zero W freezes

Thanks for a great program! I am trying it out as wildlife cam but ran into issues with the program freezing.

Hardware: Pi Zero W
OS: Stretch 2018-10-09 and Stretch 2018-11-30
GPU exchange 256mb
Pikrellcam version - latest as per post date.
Camera Picam 2 NoIR or Zero Picam by Pimoroni (based on Picam 1 I think)
Typical settings:
Resolution: 1024x768
FPS: 12
mjpeg divider: 4
Bit rate: 3,5 milj.

Background: I have tried the above constellation with different boards, in both inside and outside evironments with both regular Pi-branded PSU, other 5v/2,1A PSUs and powerbanks. At first everything seems fine and runs for days on end, then it starts to freeze and has to be restarted by pulling the plug. This happens after anything between 2 minutes and 48 hours.

Typically the pi is not contactable by either the Web interface or SSH.
Sometimes I get to the login and then nothing happens, by then the pi is not contactable via SSH either.
On occasion it can be contacted via SSH and rebooted, even if the web interface is not working.
Also it sometimes happens that it starts up again and I can reach the web interface as usual.

At first I thought it was bas SD cards so I changed them into fresh ones and checked the old ones with dskckr - no sign degradation. They were pretty fresh to begin with. However, the freezing started again with the new SD cards.

So I thought it may be some power issue and tried many different kinds of PSUs, including PI-branded, and powerbanks. I also changed cables, used shorter ones etc. Still the problem persisted.
I also tried to minimize power consumtion by turning off LEDs and HDMI-socket etc.

I tried to check the logs (the ones reached by the Web interface) but there is nothing strange that I can see. They also seem to be started blank every time I restart.
Is there other logs that can be found somewhere in the Pikrelcam files?

Finally I noticed that sometimes when Pikrellcam has frozen there is a full h264 file that has not been converted, sometimes the Web interface actually shows a thumbnail of video with 0 mb that corresponds to time when a H264 file has been created. However, this does not always happen, i.e. the program froze when there was no video being recorded.

SO, the questions:
- Are there other similar experiences out there? Solutions?
- Any guess if this is a Power-, CPU-, or a program-problem?
- Are there other log-files, apart from those on the web interface, that I have missed?
- Are my settings unrealistically high for Pi Zero?


I will continue to try different tests.

I recently found a post on camera issues viewtopic.php?t=212777
Proposed to change the config.txt and add:
over_voltage=4
force_turbo=1
Apparently this managed to make it stable. I have no idea what this actually does but I will try it today.

A few pages back I found someone that had tried to downgrade to (Jessie??) 20160523 (kernel 4.4.11) but this was almost 2 years ago. If nothing else works I will try this as well.

Thankful for all help and ideas I can get.

Edit:
Tried the over_voltage & force_turbo as described above.
I have run 2 pi-s with setup like above for 4 days straight with no freezing or other trouble.
First pi is running with regular 2,5 A PSU
Second pi is running on various powerbanks so I need to shutdown and change powerbank every 24-48 hours. Last change was with a 16Ah bank its now running on its 3 day.

Edit 2019-03-21
Changed the config.txt to only over_voltage=4 (no other overclocking) and the pi has been running for 3 weeks straight.
Had other issues with freezing but that appeared to be related to the portnumber I was using and my old router.
Last edited by kajan001 on Fri Mar 22, 2019 9:00 am, edited 2 times in total.

xzanfr
Posts: 18
Joined: Wed Jun 20, 2012 12:52 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 13, 2019 9:07 pm

Hi kajan

Where I've had issues like yours in the past its been caused by bad power (cheap supplies & poor quality usb leads), failing cards & poor wi-fi connection (router being useless, wi-fi interference).
When the power has been an issue I've also experienced interference on the preview screen (lines slowly raising up) so this may be an indicator of power issues.

I suggest the following:
check the usb lead again. This has been 99% of my issues and has been solved by buying a box of anker ones.
try to reduce wi-fi connection issues - move pi closer etc.
check to make sure there is no time out setting for the wi-fi in the pi (long shot - this happened to me when I used a dongle and connection dropped, then the dongle shut off).

kajan001
Posts: 20
Joined: Wed Feb 13, 2019 7:15 am

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Feb 14, 2019 10:37 am

Thanks xzanfr!

Power issues was my first suspect but I have now tried so many different PSUs and cables. The Pi should not use more than around 500 mA at full speed with a camera and I have plugged in 2500 mA PSUs to it.
Still, I will try an Anker cable as you suggested.

I will check the Wifi but the Pis are located just a few meters from the router so connection problems should not be the cause. Also, the video recording should still continue even though I cannot connect.

I am currently trying out the over_voltage and force_turbo thing suggested in my last post on one pi with regular PSU and one pi on powerbank. So far they have run 24h without a glitch (same pi's that got hung up on standard installation).
I will let them run for a couple of days and see what happens.

Nestboxtech
Posts: 71
Joined: Fri Apr 11, 2014 9:45 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Feb 19, 2019 1:43 pm

kajan001 wrote:
Thu Feb 14, 2019 10:37 am
Thanks xzanfr!

Power issues was my first suspect but I have now tried so many different PSUs and cables. The Pi should not use more than around 500 mA at full speed with a camera and I have plugged in 2500 mA PSUs to it.
Still, I will try an Anker cable as you suggested.

I will check the Wifi but the Pis are located just a few meters from the router so connection problems should not be the cause. Also, the video recording should still continue even though I cannot connect.

I am currently trying out the over_voltage and force_turbo thing suggested in my last post on one pi with regular PSU and one pi on powerbank. So far they have run 24h without a glitch (same pi's that got hung up on standard installation).
I will let them run for a couple of days and see what happens.
re your H264 file problem I've seen that, I think there is a setting in ?pikrellcam.conf where you can set the maximum file size for videos, that way your conversion to mp4 happens in chunks rather than all at one... What would have been a massive continual video gets chopped upito smaller pieces -the Pi Zero can struggle to convert a very large video file to mp4. With that same 'orphan H264' file issue, these files then escape the handy setting of auto deletion of the oldest mp4 file if you've set it to do that meaning the SD card gradually fills up until unreponsive (unless you add some sort of 'old H264 scrapping' script) - and if like mine, they're several meters up trees you've got a problem!
http://nestboxtech.blogspot.co.uk/

dubzdubz
Posts: 19
Joined: Tue Oct 07, 2014 8:55 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Feb 19, 2019 8:21 pm

I'm desperately trying to get this to run.. i have no video.. and when i try and start at terminal,

i get "/home/pi/pikrellcam/scripts/startup: not found"

I really welcome any help.. need to get this camera working asap.

many thanks

dubzdubz
Posts: 19
Joined: Tue Oct 07, 2014 8:55 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Feb 19, 2019 10:26 pm

here is my log

command FIFO: /home/pi/pikrellcam/www/FIFO
audio FIFO : /home/pi/pikrellcam/www/audio_FIFO
mjpeg stream: /run/pikrellcam/mjpeg.jpg
21:46:31 : execl[wait:1]: /home/pi/pikrellcam/scripts-dist/_init /home/pi/pikrellcam /home/pi/pikrellcam/media/archive /home/pi/pikrellcam/media /run/pikrellcam/mjpeg.jpg /home/pi/pikrellcam/www/FIFO /tmp/pikrellcam.log servos_off /home/pi/pikrellcam/media/loop
www/media link is already set to /home/pi/pikrellcam/media
www/archive link is already set to /home/pi/pikrellcam/media/archive
21:46:31 : execl[wait:1]: /home/pi/pikrellcam/scripts/startup /home/pi/pikrellcam /home/pi/pikrellcam/media /home/pi/pikrellcam/media/archive /tmp/pikrellcam.log
www/loop link is already set to /home/pi/pikrellcam/media/loop
make_fifo(/home/pi/pikrellcam/www/FIFO) failed: File exists
Failed to create media directories or FIFO, exiting!
/home/pi/pikrellcam/www/config.php: LOG_FILE not changed.
/home/pi/pikrellcam/www/config.php: MJPEG_FILE not changed.
/home/pi/pikrellcam/www/config.php: FIFO_FILE not changed.
/home/pi/pikrellcam/www/config.php: PIKRELLCAM not changed.
/home/pi/pikrellcam/www/config.php: SERVOS_ENABLE not changed.
/home/pi/pikrellcam/www/config.php: VERSION not changed.
21:46:31 : execl[wait:1]: /home/pi/pikrellcam/scripts/startup /home/pi/pikrellcam /home/pi/pikrellcam/media /home/pi/pikrellcam/media/archive /tmp/pikrellcam.log
make_fifo(/home/pi/pikrellcam/www/FIFO) failed: File exists
Failed to create media directories or FIFO, exiting!

dubzdubz
Posts: 19
Joined: Tue Oct 07, 2014 8:55 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Feb 19, 2019 11:36 pm

Ok all working..:) just deleted and recreated the FIFO directory.

No working at email... i edited the pikrellcam.conf and put my email in there and uncommented.. still no email.... any thoughts? thanks

billw
Posts: 402
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 20, 2019 12:34 am

dubzdubz wrote:
Tue Feb 19, 2019 11:36 pm
Ok all working..:) just deleted and recreated the FIFO directory.

No working at email... i edited the pikrellcam.conf and put my email in there and uncommented.. still no email.... any thoughts? thanks
To send mail from the Pi, you need a smtp server installed.. You can install the full package if you want but it does take some
configuration to set up. So what I do is instead install the simple smtp package: ssmtp

That is relatively easy to configure to send to an external email account.

$ apt-get install ssmtp

Then edit /etc/ssmtp/ssmtp.conf. Mine has (put in your email address and password):

Code: Select all

# Use my gmail account:
mailhub=smtp.gmail.com:587
AuthUser=your-gmail-username
AuthPass=your-gmail-password
UseSTARTTLS=YES
There's other config stuff in that file, so look up a config guide on the web. Test send emails by hand to get it
working. You can run a mpack command or use this script I use to send emails from command line or from
inside of programs:

Code: Select all

#!/bin/bash
# This is my /usr/local/bin/send-gmail script.  Sends to my gmail account.
subject=$1
msg=$2
date=$(date '+%a %H.%M.%S')

ssmtp [email protected] << EOF
Subject: $subject
$date - $msg
EOF
Test usage:
$ send-gmail test "This is a test of sending email to my gmail account"

dubzdubz
Posts: 19
Joined: Tue Oct 07, 2014 8:55 am

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 20, 2019 1:27 am

Thanks , so much !! email working, and getting pics... I have just put my email into the pikrellcam.conf....


Would I be better off looking at this method? I just cant see the scripts directory, only scripts-dist?


"Email uses “mpack” an email application. To get the emailing you have to edit preview-save in the scripts directory and not the one in the scripts-dist directory. In the preview-save script uncomment the two lines:
mpack -s [email protected]$HOSTNAME $PREVIEW_JPEG $MY_EMAIL
echo “mpack -s [email protected]$HOSTNAME $PREVIEW_JPEG $MY_EMAIL” >> $LOG_FILE

and make sure the MY_EMAIL line has your correct email address. Finally, in pikrellcam.conf, this line must be set and not commented out:
on_motion_preview_save $C/preview-save $F $m $P $G"

billw
Posts: 402
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 20, 2019 2:22 am

dubzdubz wrote:
Wed Feb 20, 2019 1:27 am
Thanks , so much !! email working, and getting pics... I have just put my email into the pikrellcam.conf....


Would I be better off looking at this method? I just cant see the scripts directory, only scripts-dist?


"Email uses “mpack” an email application. To get the emailing you have to edit preview-save in the scripts directory and not the one in the scripts-dist directory. In the preview-save script uncomment the two lines:
mpack -s [email protected]$HOSTNAME $PREVIEW_JPEG $MY_EMAIL
echo “mpack -s [email protected]$HOSTNAME $PREVIEW_JPEG $MY_EMAIL” >> $LOG_FILE

and make sure the MY_EMAIL line has your correct email address. Finally, in pikrellcam.conf, this line must be set and not commented out:
on_motion_preview_save $C/preview-save $F $m $P $G"
The scripts directory should have been created when you ran install-pikrellcam.sh ... so maybe just rerun it and watch for errors?
The install script makes the scripts directory and then copies over the initial scripts from scripts-dist. The $C you can have in commands
will expand to the scripts directory. You can modify and add files in the scripts directory and they will not be touched when you
upgrade pikrellcam. Files in scripts-dist are subject to modification on upgrades and they are intended to be starting points.

If all you want to do is send an email, you can directly put the mpack into the on_motion_preview_save command. But
if you want to do that and something else, the on_motion_preview_save should run a script (preview-save for example) where you can
add all the commands you want to do when the preview is saved. Probably you just want to send an email, so do it either way.

dubzdubz
Posts: 19
Joined: Tue Oct 07, 2014 8:55 am

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 20, 2019 8:17 am

Ok..

If i run the install.sh, will it damage my current working install?

Could I not just create that folder now?

other questions... is there a stream URL, so icould integrate this as an IP cam, with my blue iris software?

How do i go about saving vids and stills at a similar time when motion is detected?

Thanks


Must say this software is awesome ! good work

billw
Posts: 402
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 20, 2019 3:00 pm

dubzdubz wrote:
Wed Feb 20, 2019 8:17 am
Ok..

If i run the install.sh, will it damage my current working install?

Could I not just create that folder now?

other questions... is there a stream URL, so icould integrate this as an IP cam, with my blue iris software?

How do i go about saving vids and stills at a similar time when motion is detected?

Thanks


Must say this software is awesome ! good work
Running the install the first time sets up links, initializes script directory and checks for needed packages.
Rerunning offers to do only three config setups: port to access the web page, autostart at boot, and set web page password.
So it will not damage anything else. You should rerun because you did not get a scripts directory and maybe there is an
error message to look at, or maybe it will set up correctly.

You can stream the mjpeg preview with a browser with live.php, or a tcp connection for vlc and others with mjpeg_stream.php,
Also you can view the h264 tcp video stream but this would need some additional setup steps. Look on the help page just under
the achitecture diagram.

Now you can only get videos, but soon there will be an option to record stills instead of videos. I don't think I will officially
support getting both videos and stills at the same time because if videos are recording, taking a still will put a glitch in the video
when the camera changes modes. But if you do want both stills and videos, it is easy to do. Just have an on_motion_begin
script that sends still commands to the FIFO.. The script can read the /run/pikrellcam/motion-events file and only take stills
when motion is detected or just take a still or two while the motion event is going on. It would be up to you.. Look at
scripts-dist/example-motion-events script for reading when motion is detected.

dubzdubz
Posts: 19
Joined: Tue Oct 07, 2014 8:55 am

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 20, 2019 3:08 pm

Excellent response.. thank you.

when it installed originally. it did say error, when creating the media folders.... should i install this, with the sudo command? as when I had logged in as root user, it wouldnt let me install ... Im using stretch BTW

billw
Posts: 402
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 20, 2019 4:05 pm

dubzdubz wrote:
Wed Feb 20, 2019 3:08 pm
Excellent response.. thank you.

when it installed originally. it did say error, when creating the media folders.... should i install this, with the sudo command? as when I had logged in as root user, it wouldnt let me install ... Im using stretch BTW
Permissions need to be that user pi has read write access to everything so you probably should not install with sudo. Did you install
under /home/pi? If so, something about permissions is not right and I would look into that. You could move /home/pi/pikrellcam out
of the way into an old directory and try a complete new git clone and initial run of the install script. If you try that, everything you have
already set up in pikrellcam.conf will not be affected.

As per your previous question, you could create this stuff by hand (scripts directory, media dirs, etc), but you should not have gotten
any file creation errors from the install script if you install in your home directory.

dubzdubz
Posts: 19
Joined: Tue Oct 07, 2014 8:55 am

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Feb 21, 2019 12:54 pm

OK... fixed needed to chmod 777 folder pikrellcam, prior to install..

Ok.. all I want to to is tweak some of the HTML to a slightly different flavour... just want to change title, for each of these cams im deploying, approx 20... so cam1 location 1 etc... instead of the default text [email protected]


Thanks for your patience btw

kajan001
Posts: 20
Joined: Wed Feb 13, 2019 7:15 am

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Feb 22, 2019 7:49 am

Ok, so now I have managed to get the Pi stable at home. I am running this on Pi Zero W

I used the overvoltage and force_turbo as described earlier and the pi would run for days (one of them is still running about a week later)

The moment I moved it to the test area I started having issues. I suspect a wifi signal problem or something with the ngnix server.

I enter the IP:port and get to the login page, enter login details and then ...nothing. Eventually I get the 504 timout or simply cannot connect.
It also appears that this freezes the entire program so pikrellcam no longer takes any videos on motion detection.
Why?

Can Pikrell cam work without wifi connection or does the program freeze if the wifi is lost?


In writing moment I get this data from the connection:
Frequency:2.437 GHz
Bit Rate=65 Mb/s Tx-Power=31 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=57/70 Signal level=-53 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:1 Invalid misc:0 Missed beacon:0

I have read that in earlier models the powermanagement in Pi (at least Pi3) has been a culprit but since then it should have been fixed, also I ran these Pi's for days on a different router so it should not be a problem.

EDIT:
It seems that the program freezes when I am on the web interface and the motion is detected at the same time. Could it be some sort of GPU overload?
Strangely enough this did not happen when I tested it at my desk. It only happens in the test area, with the other router.


Edit 2 and 3:
The following seem to have fixed the issue:
- Changed the pi to another - the one I hade trouble with is tested and is workring ok so we can rule that out as a problem source.
- pikrellcam on a fresh stretch lite
-changed the port for web interface that I was using.
- Set the PI wifi up IN the testarea and not on a different router using raspi-config - i.e. I did not use the standard headless setup. Bit of a hassle because I had to set it up with a screen and keybord.

The pi has now been working for a couple of days at least.
Edit 4: The pi is working most of the time. I had a couple of freezes but I suspect it could also be related to the battery dropping power when it starts to run down to 25%.
Also the router in the testarea is an old ADSL router (2010) and is not very good to begin with. I will try with another router or extender.
Edit 5: Since changing the port I have had very little problems with freezing. The Pi has been running for a week at the time.
I recently started another pi which used the old port and imeadiately had issues with it. When I changed to a new port it ran without a problem. For some reason port 82 on my old router seem to be a cause of freezing. Strange that the wifi issue also affects the motiondetection/recording.
I also tested starting the Pi with Pikrellcam (and new port) and then turning off the wifi. It still worked fine. I have also removed the force_turbo but kept over_voltage=4 and the pi is still running ok.

Conlusion:

It seems that if the pi freezes when using pikrellcam check the following:
- Add over_voltage=4 to config.txt in boot file
- sufficient powersupply: I am running on 2.1 and 2.5 A from good quality PSUs or batterypacks.
- Check that powercables are good quality and not too long.
- Make sure you set up the wifi properly and have decent connection, at least when you are using WUI. I tried using my pad as wifi-hotspot and that worked ok.
- Change port number.

jeff65
Posts: 6
Joined: Fri Apr 19, 2019 5:57 am

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Apr 19, 2019 6:10 am

I've been using the software for a while. Great stuff! I can't thank you enough.

I just noticed today that my NFS set up is incorrect. The web interface doesn't seem to have correct premissions to any media, even manually created stills and videos initiated in the web interface!

All the media files created have ownership and permissions as per this:

Code: Select all

-rwx------ 1 pi pi       159455 Apr 19 12:32 image_2019-04-19_12.35.48_1.jpg
I've read the posts regarding ensuring the correct permissions of the parent directories and symbolic links within the ~/pikrellcam/www directory and have fixed those to have www-data as the group, but the problem still persists.

In addition to having the incorrect group it looks like umask is wrong as group and everyone have no access. pi user's umask value is 0022 so it isn't using that.

Really baffled at what's going on!

Edit: Is the intent to enable access to the media files to both the pi and www-data users via setgid on the media directories? Or is it something else? Mostly confused that the mode is 700 on the media files when umask for the pi user shows they should be created with 755.

billw
Posts: 402
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Apr 24, 2019 4:23 pm

jeff65 wrote:
Fri Apr 19, 2019 6:10 am
I've been using the software for a while. Great stuff! I can't thank you enough.

I just noticed today that my NFS set up is incorrect. The web interface doesn't seem to have correct premissions to any media, even manually created stills and videos initiated in the web interface!

All the media files created have ownership and permissions as per this:

Code: Select all

-rwx------ 1 pi pi       159455 Apr 19 12:32 image_2019-04-19_12.35.48_1.jpg
I've read the posts regarding ensuring the correct permissions of the parent directories and symbolic links within the ~/pikrellcam/www directory and have fixed those to have www-data as the group, but the problem still persists.

In addition to having the incorrect group it looks like umask is wrong as group and everyone have no access. pi user's umask value is 0022 so it isn't using that.

Really baffled at what's going on!

Edit: Is the intent to enable access to the media files to both the pi and www-data users via setgid on the media directories? Or is it something else? Mostly confused that the mode is 700 on the media files when umask for the pi user shows they should be created with 755.
The remote machine nfs root directory needs to have 755 permissions and then /etc/exports needs to export rw as shown in the help
page NFS section. Then when the NFS is mounted, the pikrellcam program running as user pi makes subdirectories with 775 permission
and owner pi and group www-data. The final media files will be created 644 but the parent directories will be 775 and group www-data
so the web page running as www-data still has permission to delete the files.

So for example I have a NFS mount on a remote machine directory /mnt/archive/media-archive, and permssions look like:

Code: Select all

In /mnt/archive/
drwxr-xr-x  6 pi   pi    4096 Apr 21 13:57 media-archive/

ls -Rl /mnt/archive/media-archive:
drwxrwxr-x 4 pi www-data 4096 Apr 21 13:59 2019/

/mnt/archive/media-archive/2019:
drwxrwxr-x 4 pi www-data 4096 Apr 24 11:00 04/

/mnt/archive/media-archive/2019/04:
drwxrwxr-x 4 pi www-data 4096 Apr 21 13:58 18/

/mnt/archive/media-archive/2019/04/18:
drwxrwxr-x 2 pi www-data 4096 Apr 21 13:58 thumbs/
drwxrwxr-x 2 pi www-data 4096 Apr 21 13:58 videos/

/mnt/archive/media-archive/2019/04/18/thumbs:
total 4
-rw-r--r-- 1 pi pi 973 Apr 18 10:10 motion_2019-04-18_10.08.55_479.th.jpg

/mnt/archive/media-archive/2019/04/18/videos:
total 24912
-rw-r--r-- 1 pi pi 25509115 Apr 18 10:10 motion_2019-04-18_10.08.55_479.mp4
Stop pikrellcam from running through the web interface and then run a verbose pikrellcam from a terminal so you can
see any errors:
pikrellcam -v

Look for "make_dir" sections on the NFS directory to see if pikrellcam has trouble with check_modes() on that directory.
If the modes are OK, then archive a video from a day that has not been previously archived and see if any errors show up
when the /home/pi/pikrellcam/scripts-dist/_archive-video script is run. That script should create the archive subdirectories
with the correct permissions like: drwxrwxr-x 4 pi www-data 4096 Apr 21 13:58 18/

Edit:
A shorter debug you can do from a terminal outside of pikrellcam. These commands need to work on the pi running
pikrellcam with the NFS mounted on for example /mnt/archive/media-archive:

Code: Select all

[email protected]: ~$ ls -lt /mnt/archive/media-archive/
total 4
drwxrwxr-x 5 pi www-data 4096 Apr 24 11:11 2019/

[email protected]: ~$ cd /mnt/archive/media-archive/
[email protected]: /mnt/archive/media-archive$ mkdir testdir
[email protected]: /mnt/archive/media-archive$ ls -l
total 8
drwxrwxr-x 5 pi www-data 4096 Apr 24 11:11 2019/
drwxr-xr-x 2 pi pi       4096 Apr 24 11:40 testdir/
[email protected]: /mnt/archive/media-archive$ sudo chown :www-data testdir
[email protected]: /mnt/archive/media-archive$ sudo chmod 775 testdir
[email protected]: /mnt/archive/media-archive$ ls -l
total 8
drwxrwxr-x 5 pi www-data 4096 Apr 24 11:11 2019/
drwxrwxr-x 2 pi www-data 4096 Apr 24 11:40 testdir/
The testdir needs to end up with owner/permissions as shown. If this can work from the command line then
pikrellcam should be able to do the same.

mrmate
Posts: 2
Joined: Fri Apr 26, 2019 7:16 am
Location: Ukraine

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Apr 26, 2019 7:28 am

I also use this script for sending a telegram message with a preview on my handy and it works very well.

Ciao,
Rainer
[/quote]

Dear Fox Mulder, kindly ask your assistance to make sending motion event notifications to telegram.
Will be very thankful for detailed instructions.
I just managed to arrange sending emails, but telegram usage is much needed for me.
Many thanks in advance and Best regards from Ukraine!

jeff65
Posts: 6
Joined: Fri Apr 19, 2019 5:57 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Apr 30, 2019 10:06 am

billw wrote:
Wed Apr 24, 2019 4:23 pm
Edit:
A shorter debug you can do from a terminal outside of pikrellcam. These commands need to work on the pi running
pikrellcam with the NFS mounted on for example /mnt/archive/media-archive:

Code: Select all

[email protected]: ~$ ls -lt /mnt/archive/media-archive/
total 4
drwxrwxr-x 5 pi www-data 4096 Apr 24 11:11 2019/

[email protected]: ~$ cd /mnt/archive/media-archive/
[email protected]: /mnt/archive/media-archive$ mkdir testdir
[email protected]: /mnt/archive/media-archive$ ls -l
total 8
drwxrwxr-x 5 pi www-data 4096 Apr 24 11:11 2019/
drwxr-xr-x 2 pi pi       4096 Apr 24 11:40 testdir/
[email protected]: /mnt/archive/media-archive$ sudo chown :www-data testdir
[email protected]: /mnt/archive/media-archive$ sudo chmod 775 testdir
[email protected]: /mnt/archive/media-archive$ ls -l
total 8
drwxrwxr-x 5 pi www-data 4096 Apr 24 11:11 2019/
drwxrwxr-x 2 pi www-data 4096 Apr 24 11:40 testdir/
The testdir needs to end up with owner/permissions as shown. If this can work from the command line then
pikrellcam should be able to do the same.
Thanks Bill,

I am able to successfully archive media files and also perform the above steps manually. But the media files are created with owner pi:pi and mode: 600. This remains the case with the archived media files, too. This means that the content of the media can't be displayed through the web interface.

So it looks like the media files are the issue and not the directories.

Still scratching my head!

Any further thoughts appreciated.

Cheers
Jeff

Return to “Camera board”