Rasilon
Posts: 101
Joined: Wed Mar 11, 2015 7:30 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Jan 04, 2018 12:03 am

I installed openmediavault on my storage pi, but can find no way to connect to it using nfs from my picam

physis
Posts: 8
Joined: Sun Oct 29, 2017 7:41 am

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Jan 04, 2018 4:39 pm

hi,
First of all, thanks a lot billw and all the users that have contributed with ideas for such a powerful software that is Pikrellcam!! Thank you 
So, I'm currently building a camera trap using the Pikrellcam on a pi zero W and my power source is a power bank. I want to improve the battery autonomy using the Witty Pi Mini so I can turn Off Pi when is dark. To turn ON would be using the signal of a PIR sensor when motion is detected and send it to Witty Pi (I'm currently trying figure out how to put everything together, any help would be great) to wake up the Pi and the IR lights.
To make sense all this system, the Pi must boot as fast as possible to be able of record the detected motion. I would like to have a OS just with what do I need to run the Pikrellcam, so I could boot the pi faster. With a fresh Raspbian Stretch (for the time being I need GUI) I’m getting:

Code: Select all

~ $ systemd-analyze
Startup finished in 1.541s (kernel) + 53.156s (userspace) = 54.697s

Code: Select all

~ $ systemd-analyze blame
         39.152s dev-mmcblk0p2.device
         35.421s systemd-fsck-root.service
          6.832s networking.service
          6.709s dphys-swapfile.service
          5.776s hciuart.service
          5.302s raspi-config.service
          4.257s rc-local.service
          4.197s nginx.service
          4.123s lightdm.service
          2.955s php7.0-fpm.service
          2.604s keyboard-setup.service
          2.525s systemd-logind.service
          2.162s [email protected]
          1.684s rsyslog.service
          1.347s gldriver-test.service
          1.224s systemd-journald.service
          1.171s ssh.service
          1.121s triggerhappy.service
          1.091s udisks2.service
          1.070s systemd-udev-trigger.service
           898ms systemd-udevd.service
           882ms systemd-timesyncd.service
           829ms dhcpcd.service
           803ms systemd-rfkill.service
           772ms alsa-restore.service
           691ms [email protected]\x2dpartuuid-7e434fc6\x2d01.service
           651ms phpsessionclean.service
           624ms dev-mqueue.mount
           605ms run-rpc_pipefs.mount
           527ms systemd-modules-load.service
           521ms systemd-tmpfiles-setup.service
           514ms systemd-user-sessions.service
           461ms sys-kernel-debug.mount
           457ms systemd-tmpfiles-setup-dev.service
           440ms kmod-static-nodes.service
           426ms systemd-update-utmp.service
           423ms polkit.service
           370ms plymouth-read-write.service
           349ms nfs-config.service
           305ms sys-kernel-config.mount
           301ms systemd-sysctl.service
           296ms console-setup.service
           242ms systemd-remount-fs.service
           224ms systemd-journal-flush.service
           220ms boot.mount
           207ms plymouth-quit-wait.service
           204ms plymouth-start.service
           170ms systemd-random-seed.service
           149ms systemd-update-utmp-runlevel.service
           146ms plymouth-quit.service
           121ms systemd-tmpfiles-clean.service
           110ms sys-fs-fuse-connections.mount
So, my questions are…. what would be best OS to run the Pikrellcam to get a faster boot? What kind of services can I delete to reduce boot time? Or even more, is possible to create a kind of embedded system to run Pikrellcam (using Buildroot, for example)?
Any help or idea is welcome. Thanks a lot!!

User avatar
jbeale
Posts: 3518
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

another use for the PS3 Eyecam audio recordings

Thu Jan 04, 2018 6:22 pm

Now that PiKrellCam does audio... in case of interest, here's something else you can do with continuous recordings from the PS3 Eyecam:
viewtopic.php?f=41&t=201554#p1254333

the earthquake is obvious in the graphs, but the energy was sub-sonic (around 7 Hz) so it was almost completely inaudible just listening to it. Even with the volume all the way up, the only thing I heard was one brief creak as the garden shed shelves rattled a bit.

Rasilon
Posts: 101
Joined: Wed Mar 11, 2015 7:30 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Jan 04, 2018 8:45 pm

I have had to settle with using owncloud to store my archives, although i have to remember to move the archives from the share folder, before i do a local delete. This is not what i want to do, but without any knowledge of how to set up a proper server I am stumped.

arnauld
Posts: 21
Joined: Wed Oct 14, 2015 2:12 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Jan 05, 2018 5:54 pm

I got the 2 channel audio fixed up and audio can now be used as a motion event to trigger a recording.

The PS3 Eye Cam is a good buy. It has better sensitivity than a -35 dB electret mic I was using and is better with noise than those cheap USB soundcards you find on Ebay and Amazon. I've been able to modulate noise with those soundcards just by changing the orientation of the USB extension cable I have them plugged in to. So I do recommend trying the Eye Cam, thanks John for pointing it out.
So now I may record sound in stereo if I buy a stereo mic like the ps3 eye ?

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Jan 06, 2018 4:22 pm

I have a v simple python script that appends a row to a 'event log file', events might include a PIR activation, IR beam breakage, or camera trigger.
I want this to run when motion is detected by PikrellCam to cover the camera trigger bits. I cant locate in the forums how to do this, the nearest I got was adding this to at-commands.conf : on_motion_begin python "/home/pi/sensor_Camera_on_motion_event.py"
which does not work.... am I adding this to the right place, or is the syntax wrong?
any help would be appreciated :)
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

Sat Jan 06, 2018 7:12 pm

Nestboxtech wrote:
Sat Jan 06, 2018 4:22 pm
I have a v simple python script that appends a row to a 'event log file', events might include a PIR activation, IR beam breakage, or camera trigger.
I want this to run when motion is detected by PikrellCam to cover the camera trigger bits. I cant locate in the forums how to do this, the nearest I got was adding this to at-commands.conf : on_motion_begin python "/home/pi/sensor_Camera_on_motion_event.py"
which does not work.... am I adding this to the right place, or is the syntax wrong?
any help would be appreciated :)
A bit closer I think..
Have switched the command to pikrellcam.conf:
on_motion_begin "python /home/pi/Desktop/BirdCam2/Dec_2017_scripts/live/sensor_Camera_on_motion_event.py"

the script is executable and works if run form a terminal window.
log entry as follows: 19:04:39 : on_motion_begin: - running: "python /home/pi/sensor_Camera_on_motion_event.py"

but does not trigger the script...
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Jan 06, 2018 8:37 pm

Nestboxtech wrote:
Sat Jan 06, 2018 7:12 pm
A bit closer I think..
Have switched the command to pikrellcam.conf:
on_motion_begin "python /home/pi/Desktop/BirdCam2/Dec_2017_scripts/live/sensor_Camera_on_motion_event.py"

the script is executable and works if run form a terminal window.
log entry as follows: 19:04:39 : on_motion_begin: - running: "python /home/pi/sensor_Camera_on_motion_event.py"

but does not trigger the script...
Maybe the python command needs the full path or just give the script as the command if it starts with #!/usr/bin/env python

To see what's going on, stop pikrellcam from the web page and then run pikrellcam from a terminal so you can see if any error messages are printed out when the command tries to run.

Rasilon
Posts: 101
Joined: Wed Mar 11, 2015 7:30 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Jan 06, 2018 10:01 pm

I have given up at this point. Although Motioneye is not as good as pikrellcam. it does have network storage. So I will be installing that.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Jan 06, 2018 10:53 pm

billw wrote:
Sat Jan 06, 2018 8:37 pm

Maybe the python command needs the full path or just give the script as the command if it starts with #!/usr/bin/env python

To see what's going on, stop pikrellcam from the web page and then run pikrellcam from a terminal so you can see if any error messages are printed out when the command tries to run.
figured it out, it was as simple as a misplaced ". So the command should have read as:
on_motion_begin python "/home/pi/Desktop/BirdCam2/Dec_2017_scripts/live/sensor_Camera_on_motion_event.py"

and not

on_motion_begin "python /home/pi/Desktop/BirdCam2/Dec_2017_scripts/live/sensor_Camera_on_motion_event.py"
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jan 07, 2018 2:20 am

Rasilon wrote:
Sat Jan 06, 2018 10:01 pm
I have given up at this point. Although Motioneye is not as good as pikrellcam. it does have network storage. So I will be installing that.
If you have nfs-kernel-server installed the archive directory can be mounted with a NFS filesystem. On the computer to be archived to, the /etc/exports file needs to have permission to export. This is what I've just done, maybe it can be a guide. On my gkrellm6 desktop (could be another Pi), I have /home mounted with a partition, so in /etc/exports on gkrellm6 I allow the export mount with a line:

Code: Select all

/home 192.168.0.0/25(rw,nohide,no_subtree_check,no_root_squash)
If you archive to another Pi, with /home under root, replace /home with / and export from / instead of /home., You need the no_root_squash because pikrellcam uses sudo to make directories. After editing /etc/exports, restart the nfs server:

Code: Select all

sudo systemctl restart nfs-kernel-server
I made a directory on my gkrellm6 to be archived to: /home/bill/archive. Then on the Pi running pikrellcam, I mount the nfs archive directory on the media/archive directory:

Code: Select all

cd ~/pikrellcam/media
sudo mount -t nfs gkrellm6:/home/bill/pikrellcam archive
The above works for me because I have gkrellm6 in the /etc/hosts file on my Pi running pikrellcam, otherwise I could use an IP address. Also, my home LAN is on 192.168.0.xxx Adjust the /etc/exports line appropriately for your LAN.

Restart pikrellcam and see if it works. The pikrellcam startup script could test if the archive directory is already mounted and if not do the nfs mount. The mount can be to somewhere besides ~/pikrellcam/media/archive if archive_dir is edited in pikrellcam.conf.

What's useful about this is I have multiple Pis running pikrellcam and each one of them can nfs mount the same gkrellm6 archive directory. So archiving from all Pis can go into one archive tree on my desktop.

Hoperfully I haven't missed any steps, but anyway this is the idea of it.

Rasilon
Posts: 101
Joined: Wed Mar 11, 2015 7:30 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jan 07, 2018 7:51 am

Thank you for the info. but I have no idea what to put on what pi. What do I do with the picam pi? what do i do with the server pi?

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jan 07, 2018 4:58 pm

Rasilon wrote:
Sun Jan 07, 2018 7:51 am
Thank you for the info. but I have no idea what to put on what pi. What do I do with the picam pi? what do i do with the server pi?
pikrellcam saves media files and archives videos to directories and has no concept of client/server. It only runs on the Pi doing the motion detect/recording. So to archive to a remote Pi, a directory on the remote Pi must be mounted on a directory on the Pi running pikrellcam.

pikrellcam can then archive to that remote directory thinking it is just a local directory. So the server you mention is the remote Pi where nfs-kernel-server is set up to allow that network mounting. No pikrellcam software runs there.

First look through this to be sure the nfs server is set up:
https://linuxconfig.org/how-to-configure-nfs-on-linux

Then on the Pi you want to archive videos to:
Edit /etc/exports as I described.
But use IP addresses as for your LAN and be more restrictive on the directory to be exported if you want.

On the Pi running pikrellcam:
Run the mount -t nfs command as above.
But use your remote host name or its IP if it is not in /etc/hosts.
And use a remote Pi directory you want (that is included under what you have exported) to mount on the "client" Pi pikrellcam archive directory. If the pikrellcam Pi archive directory is not /home/pi/pikrellcam/media/archive, edit archive_dir in pikrellcam.conf to match what you use.

There are many NFS tutorials on the web.

Rasilon
Posts: 101
Joined: Wed Mar 11, 2015 7:30 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jan 07, 2018 8:05 pm

does not matter what i do I can only get to. sudo systemctl restart nfs-kernel-server

Job for nfs-server.service failed because the control process exited with error code. I cannot even find those logs. I have not been able to find a tutorial that works, not even on this site.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jan 07, 2018 11:15 pm

Another probably basic question, this one regarding archiving.

The documentation shows how to archive today and yesterday:

Code: Select all

echo "archive_video day today" > ~/pikrellcam/www/FIFO
echo "archive_video day yesterday" > ~/pikrellcam/www/FIFO
How do I go about archiving in the following scenarios:
all videos older than 'x' days
all videos in media captured between x->y dates

I located jbeales archive script: viewtopic.php?f=43&t=115583&start=500

But wasnt sure if this functionality had been added withing the program since that was posted. Wanted to double check before dusting off my my basic shell scripting skills. I have >1600 vidoes in media and doing them a day at a time is somewhat tedious ;)

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

Rasilon
Posts: 101
Joined: Wed Mar 11, 2015 7:30 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jan 08, 2018 1:08 am

Massive progress! :D after decoding many, many,many tutorials, I have the pikrell media directory showing on my server. However all the directories(vidio, archive,ect) are empty, the files are not being sent :| So almost there, but nbo cigar yet.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jan 08, 2018 2:05 am

Nestboxtech wrote:
Sun Jan 07, 2018 11:15 pm
How do I go about archiving in the following scenarios:
all videos older than 'x' days
all videos in media captured between x->y dates

I located jbeales archive script: viewtopic.php?f=43&t=115583&start=500

But wasnt sure if this functionality had been added withing the program since that was posted. Wanted to double check before dusting off my my basic shell scripting skills. I have >1600 vidoes in media and doing them a day at a time is somewhat tedious ;)

Thanks, Chris
The built in archiving doesn't handle those kinds of date selections, so maybe it's scripting time. But you could put a brute force wrapper around calling the builtin archiving script. Not actually tested except for echoing what it would do, but something like:

Code: Select all

#!/bin/bash

#archive_script="echo /home/pi/pikrellcam/scripts-dist/_archive-video"
archive_script=/home/pi/pikrellcam/scripts-dist/_archive-video
archive_dir=/home/pi/pikrellcam/media/archive
media_dir=/home/pi/pikrellcam/media
log=/tmp/log-for-this-script

year=2017
days28="01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28"
days30="$days28 29 30"
days31="$days30 31"


for day in $days28
do
    $archive_script day $year/02/$day $archive_dir $media_dir /dev/null $log
done

for month in 01 03 05 07 08 10 12
do
    for day in $days31
    do
      	$archive_script day $year/$month/$day $archive_dir $media_dir /dev/null $log
    done
done


for month in 04 06 09 11
do
    for day in $days30
    do
      	$archive_script day $year/$month/$day $archive_dir $media_dir /dev/null $log
    done
done
If you use this, maybe you should try testing it on a smaller set of days first. A downside is it will create an archive directory structure for each of those days, but should then clean up dirs for empty days if no videos are actually archived for the day.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jan 08, 2018 2:11 am

Rasilon wrote:
Mon Jan 08, 2018 1:08 am
Massive progress! :D after decoding many, many,many tutorials, I have the pikrell media directory showing on my server. However all the directories(vidio, archive,ect) are empty, the files are not being sent :| So almost there, but nbo cigar yet.
If you quit pikrellcam running from the web page and then start a new pikrellcam from a terminal and then try an archive of a video from the web page, you can see any error messages from the commands the archive script is running. Also look at the log file to see what the archiving is trying to do.

If you still have problems, post the output you get and also how you set up for NFS (include /etc/exports you use and the mount command).

Ongelma
Posts: 113
Joined: Wed Dec 03, 2014 6:46 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Jan 09, 2018 1:26 pm

Hello!

Please help. I want to upload my photos from pikrellcam to a google drive. if theres some talk about it in this thread, im sorry but didnt find it. Mega sync is also an option or some other cloud drive. Dropbox has kind of low space in the free version.

I have no glue where to start...

Rasilon
Posts: 101
Joined: Wed Mar 11, 2015 7:30 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Jan 09, 2018 8:04 pm

:D All done and works tnx for assistence and motivation to finish the project. Any plans for a script for this. it was very hard for me, a total noob on linux.

User avatar
jbeale
Posts: 3518
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Jan 09, 2018 10:32 pm

Ongelma wrote:
Tue Jan 09, 2018 1:26 pm
Please help. I want to upload my photos from pikrellcam to a google drive.
Here is an article about Google Drive and Raspberry Pi:
viewtopic.php?t=109587

Google Drive has various general-purpose API examples, here are some in Python:
https://github.com/googledrive/PyDrive

Apparently, Google Photos still uses the old Google Picasa API, which is documented:
https://developers.google.com/picasa-we ... e_protocol

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

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Jan 09, 2018 10:48 pm

billw wrote:
Mon Jan 08, 2018 2:05 am
Nestboxtech wrote:
Sun Jan 07, 2018 11:15 pm
How do I go about archiving in the following scenarios:
all videos older than 'x' days
all videos in media captured between x->y dates

I located jbeales archive script: viewtopic.php?f=43&t=115583&start=500

But wasnt sure if this functionality had been added withing the program since that was posted. Wanted to double check before dusting off my my basic shell scripting skills. I have >1600 vidoes in media and doing them a day at a time is somewhat tedious ;)

Thanks, Chris
The built in archiving doesn't handle those kinds of date selections, so maybe it's scripting time. But you could put a brute force wrapper around calling the builtin archiving script. Not actually tested except for echoing what it would do, but something like:

Code: Select all

#!/bin/bash

#archive_script="echo /home/pi/pikrellcam/scripts-dist/_archive-video"
archive_script=/home/pi/pikrellcam/scripts-dist/_archive-video
archive_dir=/home/pi/pikrellcam/media/archive
media_dir=/home/pi/pikrellcam/media
log=/tmp/log-for-this-script

year=2017
days28="01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28"
days30="$days28 29 30"
days31="$days30 31"


for day in $days28
do
    $archive_script day $year/02/$day $archive_dir $media_dir /dev/null $log
done

for month in 01 03 05 07 08 10 12
do
    for day in $days31
    do
      	$archive_script day $year/$month/$day $archive_dir $media_dir /dev/null $log
    done
done


for month in 04 06 09 11
do
    for day in $days30
    do
      	$archive_script day $year/$month/$day $archive_dir $media_dir /dev/null $log
    done
done
If you use this, maybe you should try testing it on a smaller set of days first. A downside is it will create an archive directory structure for each of those days, but should then clean up dirs for empty days if no videos are actually archived for the day.
Okay I'll script it. For interest, if I select 'all' from the video screen then 'delete' this fails. No error in log, but works for a single day.
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Jan 10, 2018 12:50 am

Rasilon wrote:
Tue Jan 09, 2018 8:04 pm
:D All done and works tnx for assistence and motivation to finish the project. Any plans for a script for this. it was very hard for me, a total noob on linux.
Great! Glad you got it set up. I've a few changes to finish up in day or so, but after that I'll make it a priority to get a NFS archiving section into the help page that will have a step by step guide.

Ongelma
Posts: 113
Joined: Wed Dec 03, 2014 6:46 am

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Jan 18, 2018 1:28 pm

jbeale wrote:
Tue Jan 09, 2018 10:32 pm
Ongelma wrote:
Tue Jan 09, 2018 1:26 pm
Please help. I want to upload my photos from pikrellcam to a google drive.
Here is an article about Google Drive and Raspberry Pi:
viewtopic.php?t=109587

Google Drive has various general-purpose API examples, here are some in Python:
https://github.com/googledrive/PyDrive

Apparently, Google Photos still uses the old Google Picasa API, which is documented:
https://developers.google.com/picasa-we ... e_protocol
Cheers! Ill give it a go :)

arnauld
Posts: 21
Joined: Wed Oct 14, 2015 2:12 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Jan 20, 2018 5:56 pm

Hello,

I just received the ps3 eye camera and plug it in to get a stereo sound.

I changed this in the .conf file :
# Audio channels. A USB sound card probably supports only mono and
# setting 2 channels for this case would be reverted to 1 when the
# microphone is opened.
#
audio_channels 2
It's working fine. Do I have to change anything else ?

Also, could you tell me what I should change in the .conf file so that the camera and mic stop recording 30 seconds after the end of detecting the last motion. I record birds and sometimes I have videos that stop but the bird is still in front of the camera...

Thank you (and sorry for my bad english).

Return to “Camera board”