Sassel
Posts: 4
Joined: Sun Jan 29, 2017 8:39 am

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jan 29, 2017 5:02 pm

Hi Stephen,
thx for your quick help. Have it read before, but not yet tried.

But what I am mainly about is WHY.
What was changed at the kernel, whereupon Bills software accesses and crashed?!
Which component/which parameter makes the issue.

Some said "downgrade the system", but it doesn't work for all.
Other said "wrong powersupply >2,5A". Hmmm, yes it's a general problem but not for this case.
In the evening it works quiet nice, in the morning/at daytime he stopped every minutes

I have a new strange problem:
@Home my Rpi-3B run´s with pikrellcam as unstable as i posted. (Night OK, Day fails every few min)
@office, it run´s only for a few minutes...! Doesn#t matter which time :?: :!:
The same Hardware, nothing disconnected, only the WiFi-AP is another :shock:

bye, Sassel

stephencassidy
Posts: 37
Joined: Mon Aug 19, 2013 11:12 am

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jan 29, 2017 9:31 pm

Mine was exactly the same, 3 out of 4 of my camera pi's would stall randomly. The only stable one was being powered by an old Motorola phone charger and one of the ones that was failing was being powered with an old ATX power supply so I figured it was unlikely to be power related.

I literally have no idea what changed, all I do know is since I rolled back the kernel all is stable.

On a side note and may be a red herring but I installed jessie lite and pikrellcam on anoter B+ earlier in the week, pikrellcam has been working without issue even with everything up to date.

Ste

Sassel
Posts: 4
Joined: Sun Jan 29, 2017 8:39 am

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jan 30, 2017 8:24 pm

@stephen
Interesting.
Have you tried switching the "stable" Pi-SD-Card to another "unstable" machine?

At the moment i have one RPi3 and the A+ back home for testing, but too little time this week.

I'll try a new start, installing a fresh Raspian-Jessie(or/and Raspian-Lite-Jessie) on that machines.
On both i made too many changes (another Main-user, different video-surveilance Packs with it's on libs,...,...)

Then I watch and will also put all logs up


Have a nice week, CU soon,
Sassel

Sassel
Posts: 4
Joined: Sun Jan 29, 2017 8:39 am

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 05, 2017 3:05 pm

Hello everybody.

I have now reinstalled the RasPi 3B and the RasPi A +, tried a few things and now they run stable -for a few hours-.
Yeeahaaaa 8-)
Only the downgrade from Kernel 4.4.4.6 -> 4.4.33 works for me

Systems: RasPi 3B and A+ with both 5V/2,5A powersupply and the RasPi-Cam v1.3

watched Problem:
With a current kernel (>4.4.4x) they work only in the evening / night (!)

The main problem is something with the ambient brightness - perhaps due to the automatic exposure, hardcoded in the modules :?: - can't solved that with control of the webpage exposure-settings
The problem is only in bright surroundings or dark surroundings with many light sources.
e.g. a street with a few lights works wonderfully.
When a certain brightness is reached in the morning, it stops without entries in the logs.
You can then stop them and restart them, but after a few minutes they stop again.

You can try it out:
In a bright room, place a tray over the camera and start the software.
It will run perfectly for a long time.
Lift the tray now slowly, more and more to let more light on the camera.
From a certain brightness it will abort :?

------

I downgrade both RasPi's and they run stable for a few hours.
THX to Bill for the nice Software and Stephen for help

Downgrading to Kernel 4.4.33:
sudo rpi-update 6e2ab8e3f4dbf1f286a2c955631481f2a3bee49c

THX Sassel :mrgreen:

User avatar
DougieLawson
Posts: 39585
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 05, 2017 3:56 pm

You're now five point releases behind the stable kernel you'd get with

sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel

Can I recommend you don't ever run sudo rpi-update unless you need it for a special version of kernel/bootloader to resolve a specific problem.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

User avatar
Ektus
Posts: 11
Joined: Mon Dec 26, 2016 12:02 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 05, 2017 5:19 pm

DougieLawson wrote:You're now five point releases behind the stable kernel you'd get with

sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel

Can I recommend you don't ever run sudo rpi-update unless you need it for a special version of kernel/bootloader to resolve a specific problem.
Well, this is for a specific problem, namely PiKrellCam not working properly with current versions of the bootloader/kernel/drivers/whatever.

I've got a RPi 3 running Raspbian Jessie and PiKrellCam. It has been running stable for several months, until the microSD card died last December. I've had to install everything anew and in the process switched to a USB hard drive in the hope of getting a more durable system. It is working, boots from the HDD, but has the problem with the image in PiKrellCam silently freezing almost instantly as long as it is daylight.

Last Thursday (2017-02-02) evening, I tried a downgrade issuing the command

Code: Select all

sudo BRANCH=next rpi-update ff8b6b07ec8f203e04bb4a7b67e1fdb5e91f98b7
That one is from 2016-09-07 and boots from USB (hence the "BRANCH=next").

The system has been running since then (three full days) without the image freezing and has recorded a couple videos triggered by motion events.

I therefore can report, that somewhere between September 9th, 2016 and early December something has changed in the firmware that renders PiKrellCam unusable, at least for me and several others on this forum.

Steps to reproduce: Install latest Raspian, install PiKrellCam, point the camera outside, wait a couple seconds/minutes, image freezes.


Regards
Ektus.

Fox Mulder
Posts: 42
Joined: Fri Sep 21, 2012 11:24 am

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 05, 2017 5:27 pm

Ektus wrote: Last Thursday (2017-02-02) evening, I tried a downgrade issuing the command

Code: Select all

sudo BRANCH=next rpi-update ff8b6b07ec8f203e04bb4a7b67e1fdb5e91f98b7
That one is from 2016-09-07 and boots from USB (hence the "BRANCH=next").

The system has been running since then (three full days) without the image freezing and has recorded a couple videos triggered by motion events.

I therefore can report, that somewhere between September 9th, 2016 and early December something has changed in the firmware that renders PiKrellCam unusable, at least for me and several others on this forum.
I tested different versions and the latest stable version for me is from 2016-11-25 and the next following version 2016-12-15 is not working stable anymore. So between these two versions seems to be the problem with the camera freezing.

Ciao,
Rainer

User avatar
Ektus
Posts: 11
Joined: Mon Dec 26, 2016 12:02 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 05, 2017 5:44 pm

I tested different versions and the latest stable version for me is from 2016-11-25 and the next following version 2016-12-15 is not working stable anymore. So between these two versions seems to be the problem with the camera freezing.
That's from master. I'm on next, so I've just issued an update to

Code: Select all

sudo BRANCH=next rpi-update 1aafa469e2c5b0f39fee5ca7648114ac176a9372
from December 1st, 2016. Let's see if this one works for me, I'll report back tomorrow evening (European time).

In next, there are more commits than in master, so it might be possible to narrow down the timeframe even further.


Regards
Ektus.

User avatar
DougieLawson
Posts: 39585
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 05, 2017 7:09 pm

I wouldn't touch the BRANCH=next stuff as it's exceedingly unstable. It caused four of my 14 raspberries to fail to boot.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

User avatar
Ektus
Posts: 11
Joined: Mon Dec 26, 2016 12:02 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 05, 2017 7:57 pm

Well, the next branch has been running fine for me. And to my knowledge it currently is the only way to boot from USB, at least without manually tinkering with the bootcode and start_xx.elf files, which poses its own problems.

Regards
Ektus.
Last edited by Ektus on Mon Feb 06, 2017 3:31 am, edited 1 time in total.

User avatar
DougieLawson
Posts: 39585
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 05, 2017 9:54 pm

Ektus wrote:Well, the next bransch has been running fine for me. And to my knowledge it currently is the only way to boot from USB, at least without manually tinkering with the bootcode and start_xx.elf files, which poses its own problems.
That was true about two weeks ago. The RPF folks broke something in BRANCH=next and they've not yet discovered what got broken. So I've reverted to the head of the master branch.

This is what mine are running
*** B+ *** Apollo ****** 4.4.46+ #959 Fri Feb 3 17:21:11 GMT 2017
*** 2B *** Beaufort ****** 4.4.46-v7+ #959 SMP Fri Feb 3 17:24:25 GMT 2017
*** 3B *** Challenger ***** 4.4.46-v7+ #959 SMP Fri Feb 3 17:24:25 GMT 2017
*** 2B *** Eagle ****** 4.4.46-v7+ #959 SMP Fri Feb 3 17:24:25 GMT 2017
*** 3B *** Endeavour ****** 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 (new machine, not yet updated)
*** Z *** Falcon ****** 4.4.46+ #959 Fri Feb 3 17:21:11 GMT 2017
*** 1B *** Gemini ****** 4.4.35+ #931 Sat Nov 26 13:00:50 GMT 2016 (LTS)
*** 3B *** Intrepid ****** 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 (new machine, not yet updated)
*** Z *** Mercury ****** 4.4.38+ #938 Thu Dec 15 15:17:54 GMT 2016 (new machine, not yet updated)
*** 1B *** Odyssey ****** 4.4.46+ #959 Fri Feb 3 17:21:11 GMT 2017
*** 1B *** Pioneer ****** 4.4.46+ #959 Fri Feb 3 17:21:11 GMT 2017
*** 1B *** Ranger ****** 4.1.16+ #1 Sun Jan 24 16:58:09 CET 2016 (has a Wolfram audio card)
*** 1B *** Saturn ****** 4.4.46+ #959 Fri Feb 3 17:21:11 GMT 2017
*** A+ *** Viking ****** 4.4.46+ #959 Fri Feb 3 17:21:11 GMT 2017
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

User avatar
Ektus
Posts: 11
Joined: Mon Dec 26, 2016 12:02 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Feb 06, 2017 4:23 pm

The version I've installed yesterday (BRANCH=next 1aafa469e2c5b0f39fee5ca7648114ac176a9372 from December 1st, 2016) has been working flawlessly so far. I'll keep this version until either I run into problems or someone else can confirm that updating to current master doesn't break PiKrellCam and/or booting from USB.


Regards
Ektus.

User avatar
Gavinmc42
Posts: 4553
Joined: Wed Aug 28, 2013 3:31 am

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Feb 08, 2017 9:15 am

I really love this pikrellcam.
I had just filled my external 1TB purple drive an hour ago and had not had chance to get a replacement.
Only thing I had lying around was a new tiny Lexar 32GB USB stick.
I had already formated it ext4 for other Pi testing and use, so I pulled out the 1TB put the 32GB stick in and powered up again.

Imagine my surprise when it just worked :shock:
Damn good software Bill.

Looking at latest drives and pricing came across M.2 SSD, has anyone used these in a USB caddy?
Need to use caddy/adapter that is USB2 compatible, which probably most are?
They seem to have a wider temp range than the purple HD.
Just wondering if the M.2 SSD might be suitable for field/portable use.

Wonder how many days a 32GB stick will give me? 1TB gave 8 months - 8 days?
Time to update all the other cameras to weekly backups.
Back to shops to get more 32GB sticks that were on special :P
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Feb 20, 2017 11:39 pm

billw wrote:
Nestboxtech wrote:I cant seem to get umask to work with mount.cifs. Oddly, if I just echo a string to a file in the mounted folder directory, there is no issue. Looking at 'top' pikrellcam is running under the 'pi' user, so I'm a bit stumped at what is going on.
The mkdir is done with sudo so it's root trying to set up directories. Can you "sudo echo ..." to a file?
You could manually make the archive directory and the video saving might work. because that is done
as user pi. From the web page the video viewing/deleting is done as user www-data, so reads might
work, but deleting an archived video probably wouldn't.

Or, I'm not really familiar with cifs, but I just stumbled on some web pages mentioning dir_mode and
maybe you could try using dir_mode=0777,file_mode=0666.
Do a search on "cifs dir_mode", I found:
http://superuser.com/questions/456243/m ... e-writable

Note that if you set gid, it should be the www-data gid 33.
Have been looking to set up pikrellcam again, and forgot that I hadnt found a solution to this.
I can manually create the archive, stills, thumbs etc folders in the mounted network share, each of which is owned by uid=pi and gid=www-data with full rwx access (overkill I realise). the start script stops when it cant create the folder on the mounted windows share - I can't figure out why this is after extensive googling....

As suggested previously, in the cifs mount command I include file_mode=0777,dir_mode=0777
I can echo to a txt file from the terminal window
Does anyone have any other suggestions, I was sort of banking on being able to run pikrellcam with a mounted network share...

i did wonder if I could modify the startup script to ignore the create folders bit since I can create these manually, but cannot locate the appropriate script that does that..

I was wondering if it could be that linux cant chown folders created on a windows share? I've an old non-windows NAS box that I'll see if I can get this to work with...
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Feb 23, 2017 10:56 pm

Cant get my networked HardDrive to be mounted either - not having a lot of luck :(

Does anyone have any pointers to how I might make Pikrellcam skip the step of assigning ownership and creating the media folders? I can make these and assign the correct permissions manually. I suspect the issue problem is due to a failure of changing ownership of a windows share (Windows Server) by the startup script of PikrellCam, as I can mount the windows share with the same permissions & ownership as per the ones it creates on the memory card on the Pi, just it does not play nicely with Pikrellcam.

Thanks
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Feb 24, 2017 1:46 am

Nestboxtech wrote:Cant get my networked HardDrive to be mounted either - not having a lot of luck :(

Does anyone have any pointers to how I might make Pikrellcam skip the step of assigning ownership and creating the media folders? I can make these and assign the correct permissions manually. I suspect the issue problem is due to a failure of changing ownership of a windows share (Windows Server) by the startup script of PikrellCam, as I can mount the windows share with the same permissions & ownership as per the ones it creates on the memory card on the Pi, just it does not play nicely with Pikrellcam.
Changing the modes is part of the program and not done in a script, but if modes checking/changing
fails, things should just carry on and the modes you have manually set should still be in effect. Where
is the start script stopping (what are last lines in log file) and is it that pikrellcam hangs at that point?
Are you trying to mount in the start script? If so, maybe don't do that and arrange for the networked
drive to be mounted before starting pikrellcam.

You can get more debug on what happens with how the mode/ownership progresses by running
verbose. So quit pikrellcam and restart from a terminal command line: pikrellcam -v
Then check the log for lines about modes and lets take a look and maybe that can give a clue
about what to do next.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Mar 02, 2017 12:11 am

Some details... The network drive is on Windows Server, with NTFS file systems.
Mounted in /etc/fstab as follows:
//***.***.*.*/SHARE/BirdCam2/PikrellCam /mnt/SHARE cifs noperm,username=***,password=***,uid=1000,gid=33,iocharset=utf8,file_mode=0775,dir_mode=0775, 0 0

which mounts with the following permissions:
drwxrwxr-x 2 pi www-data 0 Feb 20 23:15 media

I then change the media directory in pikrellcam.conf to /mnt/SHARE/media (media folder already exists on network share)
log entry as follows when attempting restart as you suggested:

Code: Select all

========================================================
======= PiKrellCam 3.1.4 started at 2017-03-02 00:04:53
========================================================
  check_modes(/home/pi/pikrellcam/www) 775
    getgrgid() current group name: www-data
    getpwuid() current user name: pi
    User and group names already OK.
    Access mode 775 already OK.
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
make_dir(/mnt/SHARE/media)
  make_dir() execing sudo mkdir -p /mnt/SHARE/media
00:04:53 : execl:[sudo mkdir -p /mnt/SHARE/media]
make_dir(/mnt/SHARE/media) failed.
Failed to create media or archive dir, exiting!
Many thanks
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Mar 02, 2017 3:22 pm

Nestboxtech wrote:Some details... The network drive is on Windows Server, with NTFS file systems.
Mounted in /etc/fstab as follows:
//***.***.*.*/SHARE/BirdCam2/PikrellCam /mnt/SHARE cifs noperm,username=***,password=***,uid=1000,gid=33,iocharset=utf8,file_mode=0775,dir_mode=0775, 0 0

which mounts with the following permissions:
drwxrwxr-x 2 pi www-data 0 Feb 20 23:15 media

Code: Select all

00:04:53 : execl:[sudo mkdir -p /mnt/SHARE/media]
make_dir(/mnt/SHARE/media) failed.
Failed to create media or archive dir, exiting!
It failed at that point because a stat() system call could not detect /mnt/SHARE/media
as a directory. Get the output for these two commands:

Code: Select all

stat /mnt/SHARE/media
and
stat -c %f /mnt/SHARE/media
Also, check that you have execute permission on /mnt/SHARE and /mnt because stat() needs that.

andies
Posts: 144
Joined: Mon Nov 11, 2013 8:12 pm
Location: Berlin

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Mar 02, 2017 6:28 pm

billw: This is great software and I enjoyed using it but I have several questions that are not answered in the doc or in github. I posted it in another thread but maybe this one is better. Unfortunately, the information seems to be scattered in those 40 pages and I do not know whether I will find all questions answered.
  • I used to use motion-mmalcam and I had a cronjob that archived recorded motions. There is a archive feature in Pikrellcam but I have to do this by hand (marking days and clicking the "archive"-button). Is it possible to archive immediately or at the end of the day?
  • When archiving, I used to send a copy of a file over my network to a NAS. I was not able to find a similar tool in Pikrellcam. The documentation says
    If you want motion detect videos immediately archived to another machine you can edit scripts/motion-end and have pikrellcam scp the videos to anywhere. To enable scp copying, put your machine information into the script and enable the on_motion_end command in pikrellcam.conf.
    What language do I use in those scripts? How are those scripts invoked (immediately? By switching something in any conf-file?)? An example would be great so I have an idea how to handle this.
  • In motion-mmalcam I recorded only pictures, no videos (safes space). Is the same possible with pikrellcam and how? I was not able to figure this out.
    I used to erase older files (30 days or longer) automatically. There seems to be a tool for this:
    In the ~/.pikrellcam/at-commands.conf file add any commands to run at a desired time and frequency.
    but again the same questions as above occured.
Pikrellcam seems to be a great software. Unfortunately, I am at the moment not able to use its potential for me. I would appreciate any hint.
raspberry B, Noir camera, Mac Book Air, iPhone, Bezzera

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Mar 02, 2017 11:06 pm

billw wrote:
Nestboxtech wrote:Some details... The network drive is on Windows Server, with NTFS file systems.
Mounted in /etc/fstab as follows:
//***.***.*.*/SHARE/BirdCam2/PikrellCam /mnt/SHARE cifs noperm,username=***,password=***,uid=1000,gid=33,iocharset=utf8,file_mode=0775,dir_mode=0775, 0 0

which mounts with the following permissions:
drwxrwxr-x 2 pi www-data 0 Feb 20 23:15 media

Code: Select all

00:04:53 : execl:[sudo mkdir -p /mnt/SHARE/media]
make_dir(/mnt/SHARE/media) failed.
Failed to create media or archive dir, exiting!
It failed at that point because a stat() system call could not detect /mnt/SHARE/media
as a directory. Get the output for these two commands:

Code: Select all

stat /mnt/SHARE/media
and
stat -c %f /mnt/SHARE/media
Also, check that you have execute permission on /mnt/SHARE and /mnt because stat() needs that.
The outputs are as follows:

Code: Select all

pi@raspberrypi:~ $ stat /mnt/SHARE/media
  File: ‘/mnt/SHARE/media’
  Size: 0         	Blocks: 0          IO Block: 16384  directory
Device: 20h/32d	Inode: 844424930389182  Links: 2
Access: (0775/drwxrwxr-x)  Uid: ( 1000/      pi)   Gid: (   33/www-data)
Access: 2017-02-20 23:15:53.877490000 +0000
Modify: 2017-02-20 23:15:53.877490000 +0000
Change: 2017-02-20 23:15:53.877490000 +0000
 Birth: -
pi@raspberrypi:~ $ stat -c %f /mnt/SHARE/media/
41fd
permissions of /mnt
drwxr-xr-x 5 root root 4.0K Feb 27 22:59 mnt

Thanks again for your help
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Mar 03, 2017 3:02 am

andies wrote:Unfortunately, the information seems to be scattered in those 40 pages and I do not know whether I will find all questions answered.
Have you read the web Help page?

Pikrellcam can run commands/scripts for events. There are predefined events named in
~/.pikrellcam/pikrellcam.conf which you can edit to run commands you want and arguments of
internal pikrellcam variables can be passed to them. For example on_motion_begin, on_motion_end,
etc. Read that file for descriptions. Commands can also be run based on a time event and are
configured in ~/.pikrellcam/at-commands.conf. Read that file and the Help page for info on that.
There's a convenience script directory ~/pikrellcam/scripts where you can put commands. Pikrellcam
substitutes the script directory when you use $C in a configured command. Otherwise you can use a
full pathname to any command or just a command for bin directories to be searched. Any script
directory command can be a shell script, binary, or python or anything a shell can run and arguments
can be passed to them. Most example script commands are bash shell scripts but the ds18b20.py
is python. To run an internal pikrellcam command (like motion on/off) a shell script executed from
pikrellcam.conf should echo the command to ~/pikrellcam/www/FIFO and such a command in
at-commands.conf should have an '@' character prepended. That's the general overview.
I used to use motion-mmalcam and I had a cronjob that archived recorded motions. There is a archive feature in Pikrellcam but I have to do this by hand (marking days and clicking the "archive"-button). Is it possible to archive immediately or at the end of the day?
The easiest is to archive videos for the day with an at command by adding a line to ~/.pikrellcam/at-commands.conf.
To archive all videos at the end of the day:

Code: Select all

daily	 23:59	"@archive_video day today"
or archive sometime each morning videos for yesterday:

Code: Select all

daily    06:00  "@archive_video day yesterday"
If you want to archive immediately each video, you have to write a script in ~/pikrellcam/scripts,
make it executable, and then set up to call it by editing the on_motion_end command in
~/.pikrellcam/pikrellcam.conf.
So in pikrellcam.conf, have something like:

Code: Select all

on_motion_end $C/archive_video_now $v
Restart pikrellcam after editing pikrellcam.conf, and then in the scripts directory, the archive_video_now script would be:

Code: Select all

#!/bin/bash

VID=`basename $1`
echo archive_video $VID today > /home/pi/pikrellcam/www/FIFO
When archiving, I used to send a copy of a file over my network to a NAS. I was not able to find a similar tool in Pikrellcam.
If you want motion detect videos immediately sent to another machine you can edit
scripts/motion-end and have pikrellcam scp the videos to somewhere. To enable scp copying, put
your machine information into the script and use the on_motion_end command in pikrellcam.conf:

Code: Select all

on_motion_end $C/motion-end $v $P $G
Edit the script ~/pikrellcam/scripts/motion-end. The script as is has two scp_video lines for example
copies to two machines. You would probably need only one so comment out one scp_video line and
have the other set up with your destination machine info. This is just what I came up with at the time
and there may be a better way to get the copy done and if you have something that worked before
probably it can be adapted to be run as the on_motion_end script by pikrellcam.

If you also still want to archive the video, add the archive_video echo line shown above to the bottom
of the motion-end script because you can have only one on_motion_end script.

Videos are always recorded, but you can have a script clean out videos older than some days.
You'll have to search for that, but taking stills when motion is detected was discussed more recently
and I found that. It's again something to be done in the on_motion_begin script:

https://www.raspberrypi.org/forums/viewtopic.php?p=1086612#p1086612

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

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Mar 03, 2017 3:45 am

Nestboxtech wrote:

Code: Select all

pi@raspberrypi:~ $ stat -c %f /mnt/SHARE/media/
41fd
permissions of /mnt
drwxr-xr-x 5 root root 4.0K Feb 27 22:59 mnt

Thanks again for your help
So the mode bits have the directory bit set so I'm not sure. Can you do an edit and make a
new pikrellcam test binary to get some debug? If so, what I would do is copy the pikrellcam directory
to a temporary so as to not mess up your install. So try this:

Code: Select all

cd
cp  -a pikrellcam /tmp
cd /tmp/pikrellcam/libkrellm/utils
Now edit utils.c and add some lines to the isdir() function to change it from this:

Code: Select all

boolean
isdir(char *dir)
    {
    struct stat st;
    boolean     result = FALSE;

    if (stat(dir, &st) == 0 && S_ISDIR(st.st_mode))
        result = TRUE;
    return result;
    }
To this (you are adding five lines after the "result = TRUE: line):

Code: Select all

boolean
isdir(char *dir)
    {
    struct stat st;
    boolean	result = FALSE;

    if (stat(dir, &st) == 0 && S_ISDIR(st.st_mode))
         result = TRUE;
    {
    char	buf[128];
    snprintf(buf, sizeof(buf), "  %s mode: %x ", dir, st.st_mode);
    perror(buf);
    }
    return result;
    }

Then go compile a new pikrellcam and run it from the command line. Stop any already running
pikrellcam first. Hopefully you will have the dev packages installed so header files will be found.

Code: Select all

cd /tmp/pikrellcam/src
make
../pikrellcam
You should get directory mode bits printed to the terminal.
Thanks.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Mar 03, 2017 11:54 pm

billw wrote: Then go compile a new pikrellcam and run it from the command line. Stop any already running
pikrellcam first. Hopefully you will have the dev packages installed so header files will be found.

Code: Select all

cd /tmp/pikrellcam/src
make
../pikrellcam
You should get directory mode bits printed to the terminal.
Thanks.
This is the result with the default settings for /media

Code: Select all

pi@raspberrypi:/tmp/pikrellcam/src $ ../pikrellcam 
  /home/pi/.pikrellcam mode: 41ed : Success
  /home/pi/pikrellcam/media mode: 41fd : Success
  /home/pi/pikrellcam/media/archive mode: 41fd : Success
  /run/pikrellcam mode: 41fd : Success
  /home/pi/pikrellcam/media/archive mode: 41fd : Success
  /home/pi/pikrellcam/media/videos mode: 41fd : Success
  /home/pi/pikrellcam/media/thumbs mode: 41fd : Success
  /home/pi/pikrellcam/media/stills mode: 41fd : Success
  /home/pi/pikrellcam/media/timelapse mode: 41fd : Success
This is what I get with /mnt/SHARE/media

Code: Select all

pi@raspberrypi:/tmp/pikrellcam/src $ ../pikrellcam 
  /home/pi/.pikrellcam mode: 41ed : Success
  /mnt/SHARE/media mode: 0 : Value too large for defined data type
  /mnt/SHARE/media mode: 0 : Value too large for defined data type
I googled 'Value too large for defined data type' and came across this, which lead me to modify the mount command as follows:

Code: Select all

//***.***.*.*/SHARE/BirdCam2/PikrellCam /mnt/SHARE cifs username=***,password=***,uid=1000,gid=33,nounix,noserverino,iocharset=utf8,file_mode=0775,dir_mode=0775, 0 0
WORKS !!! I particularly like the following:
Image

I've got a separate issue where I can get PikrellCam to use an external HD mounted on usb, but when I stop then restart PikrellCam the media folders are wiped clean, but will quit while I'm ahead tonight. Many thanks for helping me sort this out.
http://nestboxtech.blogspot.co.uk/

andies
Posts: 144
Joined: Mon Nov 11, 2013 8:12 pm
Location: Berlin

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Mar 04, 2017 5:01 pm

billw wrote:
andies wrote:Unfortunately, the information seems to be scattered in those 40 pages and I do not know whether I will find all questions answered.
Have you read the web Help page?
Yes, I did. Thank you for your post I will try all the details in the coming days.

Would it be possible to establish something like a wiki so that much of the information can be written also by us? So that we could be helpful in writing a detailed documentation? I have no idea how much work needs to be done to run such a wiki but maybe this is better then writing the documentation by yourself?
raspberry B, Noir camera, Mac Book Air, iPhone, Bezzera

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Mar 06, 2017 11:27 pm

Is there a way that I can take the live feed preview and use it in a different webpage?

What I want to do is to use the video preview window on a custom webpage and add buttons to control GPIOs for that RPi.
Camera is in a birdbox, and I want to be able to add some ability to control lighting via GPIOs on a webpage that includes a preview of the video feed. I can do the GPIO control bit, just havent figured out embedding the video feed.

The next logical iteration would be to include the video feeds for several PikrellCams into one webpage...
http://nestboxtech.blogspot.co.uk/

Return to “Camera board”