Tim Barker
Posts: 40
Joined: Sun Oct 05, 2014 5:02 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun May 01, 2016 12:37 pm

Gavinmc42 wrote:Perhaps some way to select a USB or network drive for storage?
Menu for setting up file copies to NAS?
Camera 1 copy at 1am, camera 2 at 2am etc.
Could probably do this with cron.

...
Use cron very successfully to transfer files across to a central server at various times but delay the start of the second until I know that the first will have finished - but then a simple single cron script is possible that does one and then the other, run once (or more times) a day. I use scp to transfer the files to the server using a ssh-private-key-pair with logging of the script.

stainy
Posts: 14
Joined: Thu Mar 08, 2012 1:29 pm
Location: Charlotte, NC

Re: PiKrellCam: motion vector detect + OSD web interface

Sun May 01, 2016 3:30 pm

Hi..

This is great!! just moved to this from RPI cam ( trying to fix writing to nas issue )
but..

I edited the config for the media_dir to point to /home/pi/nas ( my nas mount )

But in the log I get this
======= PiKrellCam 3.0.1 started at 2016-05-01 11:12:12
========================================================
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
11:12:12 : execl:[sudo mkdir -p /home/pi/pikrellcam/media /home/pi/nas/]
Make directory failed: /home/pi/pikrellcam/media /home/pi/nas/

Only once I revert the changes does it start working again

How can I fix it so that the images and media go straight to the nas share?

thanks

Darren

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun May 01, 2016 5:06 pm

stainy wrote:Hi..

This is great!! just moved to this from RPI cam ( trying to fix writing to nas issue )
but..

I edited the config for the media_dir to point to /home/pi/nas ( my nas mount )

But in the log I get this
======= PiKrellCam 3.0.1 started at 2016-05-01 11:12:12
========================================================
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
11:12:12 : execl:[sudo mkdir -p /home/pi/pikrellcam/media /home/pi/nas/]
Make directory failed: /home/pi/pikrellcam/media /home/pi/nas/

Only once I revert the changes does it start working again

How can I fix it so that the images and media go straight to the nas share?

thanks

Darren
Is your nas a windows fs (vfat or fat32)? If so it needs to be mounted with write permissions allowied.
See the "Media FIles" section in the help page. If the mounting is done by pikrellcam by editing
the ~/pikrellcam/scripts/startup script or by however you are doing the mounting, a umask should be
specified for the mount.

For example, if you want pikrellcam to do the mounting of a FAT32 filesystem on /dev/sda1,
uncomment the MOUNT_DISK=sda1 line in the startup script and change this line:

Code: Select all

sudo mount $DISK_DEVICE $MEDIA_DIR
to

Code: Select all

sudo mount -t vfat $DISK_DEVICE $MEDIA_DIR -o rw,user,umask=0002
Otherwise, however you are mounting the nas, you need the umask to be set.
But if the nas is a linux fs, what are the permissions of /home/pi/nas after it is mounted?

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon May 02, 2016 5:21 am

Still working through reading all 26 pages and the web page to get my head around all the settings and how I can set it for what I want.

Now setting up fourth camera with Pikrellcam, I like how it just works without reading the manual:)

What I want to do is not record the cars that pass through, just get ones that go slow and or stop.
Is it possible to have different motion setting for each region?
Cars going past go through all regions and I don't need to record those.
We get a bit of traffic on our road as it is a feeder to the main road.

Ignore motion with vectors above a set value?
Or set a min and max threshold?

Might have to get some bigger CD cards too.
Tried again with Jessie light, still got issues, Raspbian works but wastes 4GB.
Got lots of 4 and 8GB cards not many 16GB ones.
Need to get a Pi NAS working?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon May 02, 2016 8:45 am

Night time, time to tweak more settings.

Interesting, changing to 4 frames/sec etc means I get blurred headlights etc.
Videos are better if I leave video at 24fps, reflections are better too, sometimes enough to identify the vehicle makes.
I had no idea how many police and ambulance go up my street with lights on, sirens off.
The red and blue lights show up very clear in the thumbnails and videos.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: PiKrellCam: motion vector detect + OSD web interface

Tue May 03, 2016 1:57 am

Gavinmc42 wrote:Tried again with Jessie light, still got issues, Raspbian works but wastes 4GB.
What were the issues? I just installed on Jessie Light and it worked for me without issues. The only difference was I installed 'git' first because it wasn't there by default. It's nice to start with an 8 GB card only 18% used by the system, instead of over 50% used.

Code: Select all

cd /home/pi
sudo apt-get install git
git clone https://github.com/billw2/pikrellcam.git
cd pikrellcam
./install-pikrellcam.sh

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

Re: PiKrellCam: motion vector detect + OSD web interface

Tue May 03, 2016 3:29 am

I think my old SD cards are wearing out, lots of file errors.
Also tried Minibian last night for the first time without much luck.

Will retry on some newer cards.
Standard Raspbian just works.
Time to buy some 16GB class 10?, USB sticks cheaper sometimes.
Was hoping to use my old cards and a NAS.
Pikrellcam is new to me, still learning the tricks after using Motionpie variants with VGA sensors for 1 1/2 yrs.
File sizes are bigger with V1 ,V2 cameras so more storage is needed.

For long term permanent installs I normally use piCore as it only reads from the SD card and runs from RAM.
Minibian looks promising but need lots of tweaks, only played with it a few hours so far.
Jessie lite only a few days.

Wonder if anyone makes a USB sram stick, use it for daily storage before backing up to NAS?
My need for storage will change if I can figure out how to capture images below a threshold and not above it.
Still only up to page 18 out of 26:)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: PiKrellCam: motion vector detect + OSD web interface

Tue May 03, 2016 4:00 pm

Gavinmc42 wrote:My need for storage will change if I can figure out how to capture images below a threshold and not above it.
Does the extra data you get with motion_stats on in .pikrellcam/pikrellcam.conf help you make that decision?
You get one .csv file per event with data including time offset, (x,y) positions and (dx,dy) velocities.
viewtopic.php?f=43&t=115583&p=848379&hi ... sv#p848379

You can write your own script to run after each event that throws away events that don't meet your spec, and saves the ones that do. to a USB drive or other external memory. If the videos are short enough, they could be written to the Pi's ramdisk in the meantime, before that decision is made.

How to use tmpfs in RAM: http://www.zdnet.com/article/raspberry- ... e-sd-card/

rpiatf2f10
Posts: 27
Joined: Sat Apr 23, 2016 10:16 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed May 04, 2016 12:50 am

Hi,

Any one who has successfully done this?

1. mount a remote SMB and NFS share to pi
2. use that Mount as /pikrellcam/media (with all stills, videos, etc subfolder)
3. we still can use web interface to check the videios, thumnails, stills. same as on SD card.

Please help share your configurations if you can. I was trying to leverage remote SMB/NFS to avoid files being saved/deleted on local SD card.

So far I have this setup and I can manually copy file over.
pi@raspberrypi:~ $ cat /etc/fstab
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
//192.168.110.10/Recording /home/pi/nas cifs username=xxxx,password=yyyyy,workgroup=workgroup,users,auto,user_xattr 0 0


pi@raspberrypi:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.2G 1.8G 5.1G 26% /
devtmpfs 182M 0 182M 0% /dev
tmpfs 186M 0 186M 0% /dev/shm
tmpfs 186M 4.4M 182M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 186M 0 186M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 21M 40M 35% /boot
//192.168.110.10/Recording 871G 575G 297G 66% /home/pi/nas


Thanks in advance

Jasimo
Posts: 51
Joined: Mon Apr 27, 2015 11:50 am

Re: PiKrellCam: motion vector detect + OSD web interface

Wed May 04, 2016 6:18 am

rpiatf2f10 wrote:Hi,

Any one who has successfully done this?

1. mount a remote SMB and NFS share to pi
2. use that Mount as /pikrellcam/media (with all stills, videos, etc subfolder)
3. we still can use web interface to check the videios, thumnails, stills. same as on SD card.

Please help share your configurations if you can. I was trying to leverage remote SMB/NFS to avoid files being saved/deleted on local SD card.
Yes Iam doing it in that way,
1. I mounted my NAS (NFS) to /mnt/cam on the Pi2
2. Configure pikrellcam.conf parameter

Code: Select all

media_dir /mnt/cam/media
3. I can still use every feature of the Web-GUI, look thumbs, watch videos etc.

rgs
Jan

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

Re: PiKrellCam: motion vector detect + OSD web interface

Wed May 04, 2016 7:12 am

Hi Jbeale,

Yep page 16, csv vector files, looks like cool data.
Will turn them on tonight and start collecting data for the weekend's hacking.
Could run a script and only copy the files that are between set min/max thresholds.
Copy to a special folder or email, sms etc

Few more hints on using a NAS are popping up, so can fix that too.
Might have to reformat to ext4, seems the easiest thing to do.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: PiKrellCam: motion vector detect + OSD web interface

Wed May 04, 2016 8:30 am

Still working my way through all the page.
Found the triggered capture pages
echo "motion trigger 1 4 4 " > /home/pi/pikrellcam/www/FIFO
Is there a way to make that a network trigger?
One sensor to trigger and start recording on all cameras.
netcat could listen on a port and then run that motion trigger script.
Not sure if there is a global network message that will do that?
Could probably send a message to each camera but that takes more time.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: PiKrellCam: motion vector detect + OSD web interface

Wed May 04, 2016 6:56 pm

Gavinmc42 wrote:echo "motion trigger 1 4 4 " > /home/pi/pikrellcam/www/FIFO
Is there a way to make that a network trigger? One sensor to trigger and start recording on all cameras.
I think socat with 255.255.255.255 will broadcast to all units on that LAN (but will not go past any routers).

See for example: http://unix.stackexchange.com/questions ... esses?lq=1 and
http://unix.stackexchange.com/questions ... to-network
Open two terminals and type on both of them:

Code: Select all

nc -u -l 55555
Open a third terminal, install socat if necessary and type: (note, netcat does NOT support broadcast)

Code: Select all

echo -n "TEST" | socat - udp-datagram:255.255.255.255:55555,broadcast
You should see both terminals receiving the message.

rpiatf2f10
Posts: 27
Joined: Sat Apr 23, 2016 10:16 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 12:35 am

[quote="Jasimo"][quote="rpiatf2f10"]Hi,
Yes Iam doing it in that way,
1. I mounted my NAS (NFS) to /mnt/cam on the Pi2
2. Configure pikrellcam.conf parameter
[code]media_dir /mnt/cam/media[/code]
3. I can still use every feature of the Web-GUI, look thumbs, watch videos etc.

rgs
Jan[/quote][/quote]
HI Jan,

I tried your way of doing it and rebooted PI, I got into this situation as attached. I am using CIFS/SMB though for the moment.

I do see /archives and /media under newly mount. However, Pikrellcam seems not running failing to find out preview.

Is there anything else that I have to change?

Thanks in advance.
Attachments
Screenshot from 2016-05-04.jpg
Screenshot from 2016-05-04.jpg (40.95 KiB) Viewed 5464 times

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 1:48 am

rpiatf2f10 wrote: I tried your way of doing it and rebooted PI, I got into this situation as attached. I am using CIFS/SMB though for the moment.

I do see /archives and /media under newly mount. However, Pikrellcam seems not running failing to find out preview.

Is there anything else that I have to change?

Thanks in advance.
Check if pikrellcam is running and if so, contents of /run/pikrellcam

Code: Select all

ps -e | grep pikrellcam
ls -l /run/pikrellcam
Also, anything in the log file?
If pikrellcam is not running (and you did click start) run pikrellcam from a terminal to see if there's
any error messages.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 3:11 am

Hi Jbeale,

Not too reliable that broadcast address stuff, probably doing it wrong, testing with Windows, duh ;)
Probably best to have a list of known addresses.
Need to relearn PHP to add it as a menu setup for other cameras.
netcat listening to a port works no problem, get it to run script that tells camera to start recording via FIFO?

Later when I know what I am doing re networking, add a network scan script so cameras can find each other?
How many home cameras can you have before being declared paranoid? 1,2,3, 255?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 3:29 am

Just for fun- testing another PiKrellCam system, pointed the camera out the window up into the sky and left it running during the day. Expected to get some birds; which I did, plus this- some sort of aircraft I've not seen before.
Image

rpiatf2f10
Posts: 27
Joined: Sat Apr 23, 2016 10:16 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 11:30 am

billw wrote: Check if pikrellcam is running and if so, contents of /run/pikrellcam

Code: Select all

ps -e | grep pikrellcam
ls -l /run/pikrellcam
Also, anything in the log file?
If pikrellcam is not running (and you did click start) run pikrellcam from a terminal to see if there's
any error messages.
HI Billw,

This is right after reboot and we have same issue in above mentioned.
pi@raspberrypi:~ $ ps -e | grep pikrellcam
pi@raspberrypi:~ $ ls -l /run/pikrellcam
ls: cannot access /run/pikrellcam: No such file or directory
pi@raspberrypi:~ $ cat /tmp/pikrellcam.log

========================================================
======= PiKrellCam 3.0.0 started at 2016-05-05 07:26:34
========================================================
at_command_add [daily] at: sunset command: [@exposure_mode night]
at_command_add [daily] at: sunset+10 command: [@video_fps 4]
at_command_add [daily] at: sunset+10 command: [@video_mp4box_fps 4]
at_command_add [daily] at: sunset+10 command: [@mjpeg_divider 1]
at_command_add [daily] at: sunrise-10 command: [@video_fps 24]
at_command_add [daily] at: sunrise-10 command: [@video_mp4box_fps 24]
at_command_add [daily] at: sunrise-10 command: [@mjpeg_divider 4]
at_command_add [daily] at: sunrise command: [@exposure_mode auto]
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
pi@raspberrypi:~ $ cat /tmp/pikrellcam.log

========================================================
======= PiKrellCam 3.0.0 started at 2016-05-05 07:26:34
========================================================
at_command_add [daily] at: sunset command: [@exposure_mode night]
at_command_add [daily] at: sunset+10 command: [@video_fps 4]
at_command_add [daily] at: sunset+10 command: [@video_mp4box_fps 4]
at_command_add [daily] at: sunset+10 command: [@mjpeg_divider 1]
at_command_add [daily] at: sunrise-10 command: [@video_fps 24]
at_command_add [daily] at: sunrise-10 command: [@video_mp4box_fps 24]
at_command_add [daily] at: sunrise-10 command: [@mjpeg_divider 4]
at_command_add [daily] at: sunrise command: [@exposure_mode auto]
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg


This is after I clicked the "start" on web .
========================================================
======= PiKrellCam 3.0.0 started at 2016-05-05 07:27:06
========================================================
at_command_add [daily] at: sunset command: [@exposure_mode night]
at_command_add [daily] at: sunset+10 command: [@video_fps 4]
at_command_add [daily] at: sunset+10 command: [@video_mp4box_fps 4]
at_command_add [daily] at: sunset+10 command: [@mjpeg_divider 1]
at_command_add [daily] at: sunrise-10 command: [@video_fps 24]
at_command_add [daily] at: sunrise-10 command: [@video_mp4box_fps 24]
at_command_add [daily] at: sunrise-10 command: [@mjpeg_divider 4]
at_command_add [daily] at: sunrise command: [@exposure_mode auto]
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
pi@raspberrypi:~ $ ls -l /run/pikrellcam
ls: cannot access /run/pikrellcam: No such file or directory
pi@raspberrypi:~ $ ps -e | grep pikrellcam

What would be happening in this case? Is there some other setting we need to do to use CIFS/SMB or NFS, instead of /home/pi/pikrellcam/media, as storage place?

This is the log after reverting back to original "media" setting.
pi@raspberrypi:~ $ cat /tmp/pikrellcam.log

========================================================
======= PiKrellCam 3.0.0 started at 2016-05-05 07:32:19
========================================================
at_command_add [daily] at: sunset command: [@exposure_mode night]
at_command_add [daily] at: sunset+10 command: [@video_fps 4]
at_command_add [daily] at: sunset+10 command: [@video_mp4box_fps 4]
at_command_add [daily] at: sunset+10 command: [@mjpeg_divider 1]
at_command_add [daily] at: sunrise-10 command: [@video_fps 24]
at_command_add [daily] at: sunrise-10 command: [@video_mp4box_fps 24]
at_command_add [daily] at: sunrise-10 command: [@mjpeg_divider 4]
at_command_add [daily] at: sunrise command: [@exposure_mode auto]
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
07:32:19 : execl:[/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]
www/media link is already set to /home/pi/pikrellcam/media
www/archive link is already set to /home/pi/pikrellcam/media/archive
/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.
07:32:19 : execl:[/home/pi/pikrellcam/scripts/startup /home/pi/pikrellcam /home/pi/pikrellcam/media /tmp/pikrellcam.log]
MOUNT_DISK is not set.
07:32:19 : execl:[sudo chown pi.www-data /tmp/pikrellcam.log]
07:32:19 : execl:[sudo chmod 664 /tmp/pikrellcam.log]
07:32:19 : execl:[sudo mkdir -p /run/pikrellcam]
07:32:19 : execl:[sudo chown pi.www-data /run/pikrellcam]
07:32:19 : execl:[sudo chmod 775 /run/pikrellcam]
07:32:19 : circular buffer allocate: 26.25 MBytes (35 seconds at 6.0 Mbits/sec)
07:32:19 : Server: error binding
07:32:19 : Server running...waiting for connections.
07:32:19 : MJPEG server is listening on port '9999'
sunrise/sunset times: valid dawn/dusk times: valid
dawn: 5:29
sunrise: 6:01
sunset: 20:26
dusk: 20:58
07:32:21 : execl:[/home/pi/pikrellcam/scripts-dist/_log-lines 1000 /tmp/pikrellcam.log]
pi@raspberrypi:~ $

Do we have to touch ./scripts-dist/_init? Or ,do we have to change user/group to pi/pi?
pi@raspberrypi:~ $ ls /home/pi/ -la
total 404
drwxr-xr-x 6 pi pi 4096 May 2 18:46 .
drwxr-xr-x 3 root root 4096 Mar 18 04:09 ..
-rw------- 1 pi pi 5275 May 5 07:32 .bash_history
-rw-r--r-- 1 pi pi 220 Mar 18 04:09 .bash_logout
-rw-r--r-- 1 pi pi 3512 Mar 18 04:09 .bashrc
-rw-r--r-- 1 pi pi 363022 May 3 03:04 dead.letter
-rw------- 1 pi pi 32 May 2 18:50 .nano_history
drwxrwsrwx 4 root users 0 May 4 20:23 nas
drwxr-xr-x 10 pi pi 4096 Apr 23 11:57 pikrellcam
drwxr-xr-x 2 pi pi 4096 Apr 23 12:03 .pikrellcam
-rw-r--r-- 1 pi pi 675 Mar 18 04:09 .profile
drwx------ 2 pi pi 4096 Apr 16 17:23 .ssh

thanks in advance.

jefferyanderson
Posts: 4
Joined: Thu May 05, 2016 12:01 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 12:07 pm

I'm loving PiKrellCam, this is a fantastic application.
Great work by the author(s).

In my application time accuracy is extremely important. I had thought i could work backwards from the file-system mtime of the video file, and using the FPS derive an accurate timestamp for each frame.
What I'm finding though (based on a video capturing the RPI's time printing out on the screen) is that the file system's time is more than 2 seconds off from what the video captures.

FWIW, the time indicated in the video seems to match pretty close with the time overlaid by PIKrellCam.

So a few questions:
1. Is it possible to modify the annotation/overlay text to include fractional seconds?
2. While a "yes" to the above helps a bit, it doesn't really solve my issue - so does anyone have any good ideas on how to more accurately capture a sub-second timestamp (ideally +/-100ms) for the video file?
3. I could work directly off of the still images instead if that would somehow improve the situation, provided I can still get roughly the same sequence of images that I would have otherwise had in the video.

Thanks in advance.
Best Regards,
Jeff

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 1:41 pm

Hi Billw,

Now have converted 4 of my 7 cameras to Pikrellcam.
So much easier to use because I can read the code to understand how it works, sort of:)
It also looks hackable re gpio/pir/network triggering.
I even understand the FIFO method 8-) , reading it every 1/6sec?
Still only up to page 20 of 26. Have to reread it as a lot I did not understand at the time.

It looks like the code only has one compare?
pikrellcam.motion_magnitude_limit
What I want to do is set a min and max value and only record movement between these values.
At the moment my cards are filling up with fast cars.
Min/Max for limit count as well?

Trying some newer cards to install Jessie Lite to grab back 3GB.

Also trying to port the code to piCore as this is an OS <100MB, leaving 7.9GB for vids.
This will take a bit longer as default user is tc not pi.
Thinking about doing a cut down pikrellcam without the php webpage stuff so I don't need php/nginx
The binary runs but I get tc user errors.

Will also have to build a Pi NAS to archive the files to a drive.
But if I only got videos between two limits all the above is less urgent.
And I can spend the time on making a permanent enclosure and installation.

Yippee, running on Jessie Lite, got 3GB back, er rats now I have to update the1st four.
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 7546488 1349008 5862496 19% /

While waiting, I looked at some csv vector files, the csv does not tell me which region, but I can figure it out from the video and times.
Hmm, buses around 40, cars around 50, fast cars around 60.
Maybe just set magnitude to 60, get license plate and book them for speeding;)

Probably going to need magnitude scaled recording times, fast cars are gone off screen, buses vanish mid screen, walkers take two steps and are gone.

Love this software.

Copy files to different video folders for different speeds?

For anyone who does not know how yet.
Grab Jessie Lite, write to card.
sudo update
sudo apt-get install rpi-update - then reboot, need latest kernel for V2 camera
sudo apt-get install raspi-config - then expand file system etc, reboot
sudo apt-get install git
sudo apt-get install mc - optional but my preferred openssh remote editor, file manager

then the usual pikrellcam install

cd /home/pi
git clone https://github.com/billw2/pikrellcam.git
cd pikrellcam
./install-pikrellcam.sh

reboot
then go back to raspi-config and enable camera, duh.
reboot

No 5 is alive:)

Minibian next? no luck on 1st attempt
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 2:07 pm

Gavinmc42 wrote:I looked at some csv vector files, the csv does not tell me which region, but I can figure it out from the video and times.
Hmm, buses around 40, cars around 50, fast cars around 60.
The .csv tells you (x,y) coordinates of the event on each line, that is even more precise than simply which region. If you are using an aftermarket lens with narrow field of view, or you are close to the road, or the targets are very fast you won't get many data points per event, maybe just one. If you use a Pi3 you can run at 30 fps and/or take motion vector sample more often (lower value in pikrellcam.conf: mjpeg_divider x). In my case I use video_fps 24 and mjpeg_divider 4.

Here's a typical car event for me, with the stock camera, set back about 30 feet from the road. Car moves from right to left, as you see from decreasing X values. Road is not quite horizontal in the frame so there is some upwards vertical, as well as leftwards horizontal movement, and camera isn't square-on to the road so perspective causes car to appear smaller and slower in pixels-per-second as it travels farther towards the left edge of frame (X=0).

Code: Select all

time, x, y, dx, dy, magnitude, count
# width 82 height 61
 2.375,  60,  17, -36,   1,  36,  171
 2.708,  42,  18, -29,   0,  29,  153
 2.875,  38,  18, -28,   1,  28,  127
 3.208,  22,  19, -24,   0,  24,  110
 3.375,  18,  19, -24,   1,  24,  101
 3.708,   9,  19, -21,   1,  21,   63
 3.875,   6,  20, -18,   0,  18,   44
This record covers 1.5 seconds and at a processing rate of 24/4 = 6 readings per second, I would expect 9 or 10 lines of data, but there are only 7. Not sure if valid motion was not detected in a few frames, or PiKrellCam is just dropping some frames.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 11:17 pm

rpiatf2f10 wrote: This is right after reboot and we have same issue in above mentioned.
pi@raspberrypi:~ $ ps -e | grep pikrellcam
pi@raspberrypi:~ $ ls -l /run/pikrellcam
ls: cannot access /run/pikrellcam: No such file or directory
pi@raspberrypi:~ $ cat /tmp/pikrellcam.log

========================================================
======= PiKrellCam 3.0.0 started at 2016-05-05 07:26:34
========================================================
...
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
pi@raspberrypi:~ $ cat /tmp/pikrellcam.log
It's stopping right at the point where it checks the directories. It still may be a permission problem
though there should have been an error message logged. I still would like to see the output if you
run pikrellcam from a terminal. If that doesn't give any more info I may have to add some more
debugging output. Can you as user pi make directories in the media dir when mounted on nas?
This is the log after reverting back to original "media" setting.
pi@raspberrypi:~ $ cat /tmp/pikrellcam.log
...
That log seemed normal. Was pikrellcam running Ok in this case?
Do we have to touch ./scripts-dist/_init? Or ,do we have to change user/group to pi/pi?
pi@raspberrypi:~ $ ls /home/pi/ -la
...
thanks in advance.
If nas permissions and subdirs can be created/modified by user pi, then pikrellcam should be able
to take care of everything. I'll look at adding some more debugging if you can go ahead and run
from a terminal. I just want to make sure we aren't missing some error that would show up on a
console.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 05, 2016 11:33 pm

Gavinmc42 wrote:Hi Billw,

Now have converted 4 of my 7 cameras to Pikrellcam.
So much easier to use because I can read the code to understand how it works, sort of:)
It also looks hackable re gpio/pir/network triggering.
I even understand the FIFO method 8-) , reading it every 1/6sec?
Still only up to page 20 of 26. Have to reread it as a lot I did not understand at the time.

It looks like the code only has one compare?
pikrellcam.motion_magnitude_limit
What I want to do is set a min and max value and only record movement between these values.
At the moment my cards are filling up with fast cars.
Min/Max for limit count as well?
It reads the FIFO every 1/10 sec. For defaults of 24fps and mjpeg_divider 4, it samples for motion
detect every 1/6 sec

It's only one compare to a minimum threshold. To get the min/max compare you want I really think
jbeale is on the right track using the csv data as you want a decision based on final outcome of the
video and a post process with the on_motion_end command makes sense for that.

Post your tc user errors and I'll see if it can be fixed.

GPIO/PIR triggering should be straightforward with some Python code writting to the FIFO. A while
back in this topic there's a post with link to example code for that:
viewtopic.php?p=901047#p901047

rpiatf2f10
Posts: 27
Joined: Sat Apr 23, 2016 10:16 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Fri May 06, 2016 12:14 am

Apologises for posting again.

I would appreciate a detailed line by line configuration guide about how to ,
1. configure NFS on this PI, and CIFS on this PI (either through /etc/fstab or sudo mount in rc.local).
I tried in fstab and it seems PikrellCAM couldn't get it going.

#//192.168.110.10/Recording /home/pi/pikrellcam/nfs cifs username=cccccc,password=xxxxxx,workgroup=workgroup,users,auto,user_xattr 0 0
#192.168.110.10:/Recording /home/pi/pikrellcam/nfs nfs rw 0 0
2. places to configure Pikrellcam and let it using , instead of SD card, network drive (NFS or CIFS),
like, 192.168.110.10/Recording.

Many thanks.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Fri May 06, 2016 12:17 am

jefferyanderson wrote:I'm loving PiKrellCam, this is a fantastic application.
Great work by the author(s).

In my application time accuracy is extremely important. I had thought i could work backwards from the file-system mtime of the video file, and using the FPS derive an accurate timestamp for each frame.
What I'm finding though (based on a video capturing the RPI's time printing out on the screen) is that the file system's time is more than 2 seconds off from what the video captures.

FWIW, the time indicated in the video seems to match pretty close with the time overlaid by PIKrellCam.

So a few questions:
1. Is it possible to modify the annotation/overlay text to include fractional seconds?
2. While a "yes" to the above helps a bit, it doesn't really solve my issue - so does anyone have any good ideas on how to more accurately capture a sub-second timestamp (ideally +/-100ms) for the video file?
3. I could work directly off of the still images instead if that would somehow improve the situation, provided I can still get roughly the same sequence of images that I would have otherwise had in the video.
The annotation string overlay is updated once per second, but the code could be modified to
update it more frequently and a subsecond option added. But how would you use that since it's
just a visual overlay?
Videos are started on iframes which are requested each time a system time second increments and
the system time is sampled 10 times per second. So I don't know if 100 msec accuracy could be
relied on, but videos should start close to 1 second boundaries. If the start times were logged
somewhere, could that plus a frame rate calculation get close to what you want?

Return to “Camera board”