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

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Nov 05, 2016 9:24 pm

AdrianM wrote: Well, I just sudo mkdir thumbs and timelapse in media and that worked without a hitch. Peculiar.
So after creating those dirs by hand, does pikrellcam still seg fault or output anything more. Run verbose:

Code: Select all

pikrellcam -v

AdrianM
Posts: 25
Joined: Sun Mar 27, 2016 12:50 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Nov 05, 2016 9:30 pm

I had deleted the two folders I made by hand so I started by re-creating them (which worked OK) and then ran it:

Code: Select all

pi@raspberrypi:~ $ sudo mkdir -p /home/pi/NAS/pikrellcam/media/thumbs
pi@raspberrypi:~ $ sudo mkdir -p /home/pi/NAS/pikrellcam/media/timelapse
pi@raspberrypi:~ $ pikrellcam -v

========================================================
======= PiKrellCam 3.1.1 started at 2016-11-05 21:27:04
========================================================
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
21:27:04 : execl:[sudo chown pi.www-data /home/pi/NAS/pikrellcam/media]
chown: changing ownership of ‘/home/pi/NAS/pikrellcam/media’: Operation not permitted
21:27:04 : execl:[sudo chmod 775 /home/pi/NAS/pikrellcam/media]
chmod: changing permissions of ‘/home/pi/NAS/pikrellcam/media’: Operation not permitted
21:27:04 : execl:[sudo chown pi.www-data /home/pi/NAS/pikrellcam/archive]
chown: changing ownership of ‘/home/pi/NAS/pikrellcam/archive’: Operation not permitted
21:27:04 : execl:[sudo chmod 775 /home/pi/NAS/pikrellcam/archive]
chmod: changing permissions of ‘/home/pi/NAS/pikrellcam/archive’: Operation not permitted
21:27:04 : execl:[/home/pi/pikrellcam/scripts-dist/_init /home/pi/pikrellcam /home/pi/NAS/pikrellcam/archive /home/pi/NAS/pikrellcam/media /run/pikrellcam/mjpeg.jpg /home/pi/pikrellcam/www/FIFO /tmp/pikrellcam.log servos_off]
21:27:04 : execl:[/home/pi/pikrellcam/scripts/startup /home/pi/pikrellcam /home/pi/NAS/pikrellcam/media /tmp/pikrellcam.log]
21:27:04 : execl:[sudo chown pi.www-data /home/pi/NAS/pikrellcam/media]
chown: changing ownership of ‘/home/pi/NAS/pikrellcam/media’: Operation not permitted
21:27:04 : execl:[sudo chmod 775 /home/pi/NAS/pikrellcam/media]
chmod: changing permissions of ‘/home/pi/NAS/pikrellcam/media’: Operation not permitted
21:27:04 : execl:[sudo chown pi.www-data /home/pi/NAS/pikrellcam/archive]
chown: changing ownership of ‘/home/pi/NAS/pikrellcam/archive’: Operation not permitted
21:27:04 : execl:[sudo chmod 775 /home/pi/NAS/pikrellcam/archive]
chmod: changing permissions of ‘/home/pi/NAS/pikrellcam/archive’: Operation not permitted
21:27:04 : execl:[sudo chown pi.www-data /home/pi/NAS/pikrellcam/archive]
chown: changing ownership of ‘/home/pi/NAS/pikrellcam/archive’: Operation not permitted
21:27:04 : execl:[sudo chmod 775 /home/pi/NAS/pikrellcam/archive]
chmod: changing permissions of ‘/home/pi/NAS/pikrellcam/archive’: Operation not permitted
Segmentation fault
pi@raspberrypi:~ $ 

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 06, 2016 6:58 pm

AdrianM wrote:I had deleted the two folders I made by hand so I started by re-creating them (which worked OK) and then ran it
Can you upgrade your pikrellcam and try running again from the command line verbose: pikrellcam -v
I added some more verbose output which should narrow down where the problem is.

AdrianM
Posts: 25
Joined: Sun Mar 27, 2016 12:50 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 06, 2016 8:23 pm

OK, great, here's the terminal output:

Code: Select all

pi@raspberrypi:~ $ pikrellcam -v

========================================================
======= PiKrellCam 3.1.2 started at 2016-11-06 20:20:26
========================================================
  check_modes(/home/pi/pikrellcam/www)
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
make_dir(/home/pi/NAS/pikrellcam/media)
  make_dir(/home/pi/NAS/pikrellcam/media) dir already exists.
  check_modes(/home/pi/NAS/pikrellcam/media)
Segmentation fault
pi@raspberrypi:~ $ 
Edit: the media folder was already on the NAS from a previous session so I just deleted all the pikrellcam folders and ran again so you get the full picture:

Code: Select all

pi@raspberrypi:~ $ pikrellcam -v

========================================================
======= PiKrellCam 3.1.2 started at 2016-11-06 21:06:27
========================================================
  check_modes(/home/pi/pikrellcam/www)
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
make_dir(/home/pi/NAS/pikrellcam/media)
  make_dir() execing sudo mkdir -p /home/pi/NAS/pikrellcam/media
21:06:27 : execl:[sudo mkdir -p /home/pi/NAS/pikrellcam/media]
  make_dir(/home/pi/NAS/pikrellcam/media) succeeded.
  check_modes(/home/pi/NAS/pikrellcam/media)
Segmentation fault
pi@raspberrypi:~ $ 

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 07, 2016 1:28 am

AdrianM wrote:OK, great, here's the terminal output:

Code: Select all

  check_modes(/home/pi/NAS/pikrellcam/media)
Segmentation fault
Thanks, I added checking for some possible errors in the check_modes() function, so now you can try another upgrade.

AdrianM
Posts: 25
Joined: Sun Mar 27, 2016 12:50 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 07, 2016 8:55 am

After this upgrade it doesn't crash out, it starts - but the motion detection doesn't start any recording nor does the snapshot take any stills. Here's the output anyway:

Code: Select all

pi@raspberrypi:~ $ pikrellcam -v

========================================================
======= PiKrellCam 3.1.3 started at 2016-11-07 08:48:29
========================================================
  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(/home/pi/NAS/pikrellcam/media)
  make_dir(/home/pi/NAS/pikrellcam/media) dir already exists.
  check_modes(/home/pi/NAS/pikrellcam/media) 775
    getgrgid() failed: Success
    getpwuid() failed: Success
    Access mode 775 already OK.
make_dir(/home/pi/NAS/pikrellcam/archive)
  make_dir(/home/pi/NAS/pikrellcam/archive) dir already exists.
  check_modes(/home/pi/NAS/pikrellcam/archive) 775
    getgrgid() failed: Success
    getpwuid() failed: Success
    Access mode 775 already OK.
08:48:29 : execl:[/home/pi/pikrellcam/scripts-dist/_init /home/pi/pikrellcam /home/pi/NAS/pikrellcam/archive /home/pi/NAS/pikrellcam/media /run/pikrellcam/mjpeg.jpg /home/pi/pikrellcam/www/FIFO /tmp/pikrellcam.log servos_off]
08:48:29 : execl:[/home/pi/pikrellcam/scripts/startup /home/pi/pikrellcam /home/pi/NAS/pikrellcam/media /tmp/pikrellcam.log]
  check_modes(/home/pi/NAS/pikrellcam/media) 775
    getgrgid() failed: Success
    getpwuid() failed: Success
    Access mode 775 already OK.
  check_modes(/home/pi/NAS/pikrellcam/archive) 775
    getgrgid() failed: Success
    getpwuid() failed: Success
    Access mode 775 already OK.
  check_modes(/tmp/pikrellcam.log) 664
    getgrgid() current group name: pi
    getpwuid() current user name: pi
  check_modes() execing: sudo chown pi.www-data /tmp/pikrellcam.log
08:48:29 : execl:[sudo chown pi.www-data /tmp/pikrellcam.log]
  check_modes() (100644) execing: sudo chmod 664 /tmp/pikrellcam.log
08:48:29 : execl:[sudo chmod 664 /tmp/pikrellcam.log]
make_dir(/run/pikrellcam)
  make_dir(/run/pikrellcam) dir already exists.
  check_modes(/run/pikrellcam) 775
    getgrgid() current group name: www-data
    getpwuid() current user name: pi
    User and group names already OK.
    Access mode 775 already OK.
make_dir(/home/pi/NAS/pikrellcam/archive)
  make_dir(/home/pi/NAS/pikrellcam/archive) dir already exists.
  check_modes(/home/pi/NAS/pikrellcam/archive) 775
    getgrgid() failed: Success
    getpwuid() failed: Success
    Access mode 775 already OK.
make_dir(/home/pi/NAS/pikrellcam/media/videos)
  make_dir(/home/pi/NAS/pikrellcam/media/videos) dir already exists.
  check_modes(/home/pi/NAS/pikrellcam/media/videos) 775
    getgrgid() failed: Success
    getpwuid() failed: Success
    Access mode 775 already OK.
make_dir(/home/pi/NAS/pikrellcam/media/thumbs)
  make_dir(/home/pi/NAS/pikrellcam/media/thumbs) dir already exists.
  check_modes(/home/pi/NAS/pikrellcam/media/thumbs) 775
    getgrgid() failed: Success
    getpwuid() failed: Success
    Access mode 775 already OK.
make_dir(/home/pi/NAS/pikrellcam/media/stills)
  make_dir(/home/pi/NAS/pikrellcam/media/stills) dir already exists.
  check_modes(/home/pi/NAS/pikrellcam/media/stills) 775
    getgrgid() failed: Success
    getpwuid() failed: Success
    Access mode 775 already OK.
make_dir(/home/pi/NAS/pikrellcam/media/timelapse)
  make_dir(/home/pi/NAS/pikrellcam/media/timelapse) dir already exists.
  check_modes(/home/pi/NAS/pikrellcam/media/timelapse) 775
    getgrgid() failed: Success
    getpwuid() failed: Success
    Access mode 775 already OK.
make_fifo(/home/pi/pikrellcam/www/FIFO)
  make_fifo(/home/pi/pikrellcam/www/FIFO) FIFO already exists.
  check_modes(/home/pi/pikrellcam/www/FIFO) 664
    getgrgid() current group name: www-data
    getpwuid() current user name: pi
    User and group names already OK.
    Access mode 664 already OK.
08:48:29 : circular buffer allocate: 30.62 MBytes (35 seconds at 7.0 Mbits/sec)
top status area:    x:0 y:0 dx:800 dy:47
inform area:        x:0 y:47 dx:800 dy:498
adj_control area:   x:0 y:498 dx:800 dy:47
bottom status area: x:0 y:545 dx:800 dy:47
Event count down add [preset notify] count=22
08:48:29 : Server: error binding
08:48:29 : Server running...waiting for connections.
08:48:29 : MJPEG server is listening on port '9999'
sunrise/sunset times: valid  dawn/dusk times: valid
  dawn:    12:26
  sunrise: 12:51
  sunset:  23:39
  dusk:    0:03
08:48:30 : execl:[/home/pi/pikrellcam/scripts-dist/_log-lines 500 /tmp/pikrellcam.log]
child exit: ret=-1 pid=0 No child processes
Event func -> [preset notify] period=0


AdrianM
Posts: 25
Joined: Sun Mar 27, 2016 12:50 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 07, 2016 9:02 am

Permissions again :-( From the log:

Code: Select all

08:51:51 : command_process: motion_enable toggle
08:51:54 : Could not create video file /home/pi/NAS/pikrellcam/media/videos/motion_2016-11-07_08.51.49_0.mp4.h264.  Permission denied
08:51:54 : event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2016-11-07_08.51.49_0.jpg
08:51:54 : Could not create video file /home/pi/NAS/pikrellcam/media/videos/motion_2016-11-07_08.51.49_1.mp4.h264.  Permission denied
08:51:55 : event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2016-11-07_08.51.49_1.jpg
08:51:55 : Could not create video file /home/pi/NAS/pikrellcam/media/videos/motion_2016-11-07_08.51.50_2.mp4.h264.  Permission denied
08:51:55 : event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2016-11-07_08.51.50_2.jpg
08:52:06 : Could not create video file /home/pi/NAS/pikrellcam/media/videos/motion_2016-11-07_08.52.00_3.mp4.h264.  Permission denied
08:52:06 : Could not create video file /home/pi/NAS/pikrellcam/media/videos/motion_2016-11-07_08.52.01_4.mp4.h264.  Permission denied
08:52:06 : event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2016-11-07_08.52.01_4.jpg
08:52:06 : event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2016-11-07_08.52.01_4.jpg
08:52:06 : Could not create video file /home/pi/NAS/pikrellcam/media/videos/motion_2016-11-07_08.52.01_5.mp4.h264.  Permission denied
Edit: Should have shown you the permissions:

Code: Select all

pi@raspberrypi:~ $ ls -lR /home/pi/NAS
/home/pi/NAS:
total 0
drwxrwxrwx+ 1 99 99 24 Nov  7 09:14 pikrellcam

/home/pi/NAS/pikrellcam:
total 0
drwxrwxr-x+ 1 99 99  0 Nov  7 08:42 archive
drwxrwxr-x+ 1 99 99 54 Nov  7 08:42 media

/home/pi/NAS/pikrellcam/archive:
total 0

/home/pi/NAS/pikrellcam/media:
total 0
drwxrwxr-x+ 1 99 99 0 Nov  7 08:42 stills
drwxrwxr-x+ 1 99 99 0 Nov  7 08:42 thumbs
drwxrwxr-x+ 1 99 99 0 Nov  7 08:42 timelapse
drwxrwxr-x+ 1 99 99 0 Nov  7 08:42 videos

/home/pi/NAS/pikrellcam/media/stills:
total 0

/home/pi/NAS/pikrellcam/media/thumbs:
total 0

/home/pi/NAS/pikrellcam/media/timelapse:
total 0

/home/pi/NAS/pikrellcam/media/videos:
total 0
Edit: pikrellcam is writing the permissions for Unknown owner:

Code: Select all

pi@raspberrypi:~ $ stat /home/pi/NAS/pikrellcam/media
  File: ‘/home/pi/NAS/pikrellcam/media’
  Size: 54        	Blocks: 0          IO Block: 65536  directory
Device: 21h/33d	Inode: 235783      Links: 1
Access: (0775/drwxrwxr-x)  Uid: (   99/ UNKNOWN)   Gid: (   99/ UNKNOWN)
Access: 2016-11-06 21:06:27.621884676 +0000
Modify: 2016-11-07 08:42:31.927707046 +0000
Change: 2016-11-07 09:41:17.656858120 +0000
 Birth: -
When stored on the SD card the media owner is Pi. I can chmod the NAS folders to give write permission to others and get pikrellcam saving to the NAS but it resets the permissions each time it starts.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 07, 2016 4:50 pm

AdrianM wrote:Permissions again :-( From the log:
Try another upgrade. Now it shouldn't try to set the modes. But show pikrellcam -v output if
there's still a problem.

AdrianM
Posts: 25
Joined: Sun Mar 27, 2016 12:50 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 07, 2016 5:58 pm

That seems to have done the trick, fantastic! Mounting with NFS seems to be marginally more sane than using cifs so I think I'll stick with it now it's working. The media folder and subfolders ownership & permissions now look like this:

Code: Select all

pi@raspberrypi:~ $ stat /home/pi/NAS/pikrellcam/media
  File: ‘/home/pi/NAS/pikrellcam/media’
  Size: 54        	Blocks: 0          IO Block: 65536  directory
Device: 21h/33d	Inode: 235783      Links: 1
Access: (0777/drwxrwxrwx)  Uid: (   99/ UNKNOWN)   Gid: (   99/ UNKNOWN)
Access: 2016-11-06 21:06:27.621884676 +0000
Modify: 2016-11-07 12:32:43.830071653 +0000
Change: 2016-11-07 12:50:53.249094770 +0000
 Birth: -

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

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Nov 08, 2016 12:09 pm

A bit offtopic but i think it is worth mentioning.
AdrianM wrote:That seems to have done the trick, fantastic! Mounting with NFS seems to be marginally more sane than using cifs so I think I'll stick with it now it's working.
I also used NFS in the past but had a few problems with it. When the NFS Server is not reachable (shut down or network unreachable) i couldn't unmount the NFS share and the umount process hung up. Don't know if there is no timeout implemented or what went wrong. But this also prevented my computer from shutting down because it waited forever for an unmount of the NFS share and i had to do a hard shutdown. :shock:

With CIFS i don't have such problems and it gets just in a timeout when the server is not reachable. So i stick by CIFS by the moment because i don't see any disadvantages compared to NFS.

User avatar
DougieLawson
Posts: 39619
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

Tue Nov 08, 2016 12:24 pm

Fox Mulder wrote:A bit offtopic but i think it is worth mentioning.
AdrianM wrote:That seems to have done the trick, fantastic! Mounting with NFS seems to be marginally more sane than using cifs so I think I'll stick with it now it's working.
I also used NFS in the past but had a few problems with it. When the NFS Server is not reachable (shut down or network unreachable) i couldn't unmount the NFS share and the umount process hung up. Don't know if there is no timeout implemented or what went wrong. But this also prevented my computer from shutting down because it waited forever for an unmount of the NFS share and i had to do a hard shutdown. :shock:

With CIFS i don't have such problems and it gets just in a timeout when the server is not reachable. So i stick by CIFS by the moment because i don't see any disadvantages compared to NFS.
That's no longer a problem if you add your NFS shares as

Code: Select all

192.168.nfs.nfs:/shared /shared nfs defaults,noatime,x-systemd.automount 0 0
With that I've not had any hangs since Jessie went generally available a year ago. There are some additional timeout parms you can add if the network isn't stable enough. https://linux.die.net/man/5/nfs
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
underwhelmd
Posts: 94
Joined: Fri Jul 08, 2016 10:05 pm
Location: East Coast, Canada

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Nov 24, 2016 6:12 pm

I've got my setup working very well and it's reliable. I really like the at-commands. I'm using them to change settings at sunrise/sunset and it runs ds18b20.py every 15min as well. In the attached picture, you can see when FPS is changed by the cpu temp going up or down. (4fps to 24fps)

My question is: ....

edit: sorry, I found the answer staring me in the face in the documentation. duh.




Image

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 28, 2016 10:50 am

Hi all,

Not sure if this has been requested in the past? Would it be possible to have a guest account for viewing the stream?

I would like to share one of my pikrellcam streams with family and friends but I don't want them to be able to tinker with the settings. Is this possible?

Thanks

ste

LucidEye
Posts: 84
Joined: Sun Aug 04, 2013 2:20 pm

Any tests on a Pi Zero? And some other questions...

Sun Dec 04, 2016 1:36 am

I know someone asked this a while back, but I never saw any definitive answer.

Will Pikrellcam run on the new Pi Zero v1.3 using the older 5MP Pi camera? (I think the new 8MP camera would be too much data) Would love to have such a tiny camera setup like the Zero running Pikrellcam... would be the ideal setup for my dashboard cam project!

Also... are you aware of these Pi cameras being sold with built-in IR-cut filters and IR LEDs?
http://www.ebay.com/itm/Raspberry-Pi-IR ... 3641.l6368

Does Pikrellcam have GUI support for turning on and off IR LEDs? It looks like the IR-cut filter is on the same circuit as the IR night-lights... so if Pikrellcam supports turning on and off IR lights via GPIO for the Pi NOIR camera, this camera should work as both night and day camera very nicely....

Which I guess brings up another question... is there any way to automatically schedule when motion detection turns on and off? For instance, I would like to leave the camera running, but turn off motion detection at night so it doesn't just record headlights moving across the frame.

Also, has there been any progress on making Pikrellcam capable of motion tracking with servos? Just curious, last time I was on here you had said it was something that you were working on. You wouldn't really need something as complicated as full object tracking or facial recognition... Would be nice to have Pikrellcam pass vector direction information to the servo control and just simply tell it to snap to the next servo preset in the direction of the motion, then once no motion is detected snap back to the center preset and wait for the next motion event. This, in my opinion, would make the ultimate security cam software for the Pi... motion tracking would allow people to use just one camera for covering a wider area... and without having to use wide angle lenses which degrade picture and video resolution and detail.

Thanks :-)

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

Re: Any tests on a Pi Zero? And some other questions...

Sun Dec 04, 2016 5:20 pm

LucidEye wrote: Will Pikrellcam run on the new Pi Zero v1.3 using the older 5MP Pi camera? (I think the new 8MP camera would be too much data) Would love to have such a tiny camera setup like the Zero running Pikrellcam... would be the ideal setup for my dashboard cam project!
A Zero has as much CPU power as a B+ where pikrellcam runs fine, so there should be no
problem. But others with experience may have more comments.
Also... are you aware of these Pi cameras being sold with built-in IR-cut filters and IR LEDs?
http://www.ebay.com/itm/Raspberry-Pi-IR ... 3641.l6368

Does Pikrellcam have GUI support for turning on and off IR LEDs? It looks like the IR-cut filter is on the same circuit as the IR night-lights... so if Pikrellcam supports turning on and off IR lights via GPIO for the Pi NOIR camera, this camera should work as both night and day camera very nicely....
You can add controls to the webpage with a custom php file. For example, I've set up a Pi to
to toggle a gpio pin to turn a water valve on and off for filling a swimming pool. You just have to
write a python or C program to do the actual GPIO controlling. I wrote a "pool" program to control
the GPIO and I added a custom-control.php into the ~/pikrellcam/www directory that puts ON and
OFF buttons on the pikrellcam web page. My custom-control.php file is:

Code: Select all

<?php
if (isset($_POST['poolon']))
    {
    $CMD = "sudo -u pi /usr/local/bin/pool on  > /tmp/pool &";
    exec($CMD);
    }
if (isset($_POST['pooloff']))
    {
    $CMD = "sudo -u pi /usr/local/bin/pool off  > /tmp/pool &";
    exec($CMD);
    }

echo "<div class='text-center top-margin'>";
echo "<form method='post'>";
echo "<span style=\"color: $default_text_color; margin-left:25px;\">Pool:</span>
    <button type='submit' name='poolon' class='btn-control'>On</button>
    <button type='submit' name='pooloff' class='btn-control'>Off</button>";
echo "</form>";
echo "</div>";
?>
My pool program is a C program that toggles GPIOs via sysfs. I could post that if you want?

Also, I have GPIO controlling functions inside of pikrellcam but they aren't exposed yet,. So at some
point I'm thinking of putting in GPIO toggling by writting commands to the FIFO. For now if you want
the IR GPIO toggling to be done automatically, put commands into at-commands.conf to run your
GPIO toggling script.
Which I guess brings up another question... is there any way to automatically schedule when motion detection turns on and off? For instance, I would like to leave the camera running, but turn off motion detection at night so it doesn't just record headlights moving across the frame.
Put into the at-commands.conf file commands like:

Code: Select all

daily sunset+10 "@motion_enable off"
daily sunrise-10 "@motion_enable on"
Also, has there been any progress on making Pikrellcam capable of motion tracking with servos? Just curious, last time I was on here you had said it was something that you were working on. You wouldn't really need something as complicated as full object tracking or facial recognition... Would be nice to have Pikrellcam pass vector direction information to the servo control and just simply tell it to snap to the next servo preset in the direction of the motion, then once no motion is detected snap back to the center preset and wait for the next motion event. This, in my opinion, would make the ultimate security cam software for the Pi... motion tracking would allow people to use just one camera for covering a wider area... and without having to use wide angle lenses which degrade picture and video resolution and detail.
The mechanism to do that is there, just a control program needs to be written. In the short term I
don't have the confidence to cover all installation variations with a single built in motion tracking
algorithm, so for now it will have to be done with an external program, I just haven't done that yet.
It could be complicated based on motion in specific regions or simple based on the overall motion
vector. The simple case could be done by writing an on_motion_begin Python script that reads the
/run/pikrellcam/motion-events file and looks for full frame motion vectors as they occur (these are
'f' lines in the file, eg: f 10 35 0 -23 23 18)
If that vector show motion in the right or left side of the frame with a direction pointing out of the
frame, then a FIFO command could be executed to move the servos to the next right or left preset
position. Or it could move the servos by a set distance amount (as long as motion off of preset is
enabled).

Beyond that, the control algorithm could get as complicated as you want and it's why for now I'm
leaving it as an external on_motion_begin script add on. I'll write at least a proof of concept of this
at some point, but the mechanism is there for anybody to experiment right now. Look at the
example-motion-send-alarm2 script for an example on_motion_begin script that reads the
/run/pikrellcam/motion-events file. A motion tracking script would have a similar structure, it would
just look at the vectors to decide when to send move to preset or servo movement commands to
the FIFO.

User avatar
lpsw
Posts: 228
Joined: Thu Jun 25, 2015 4:45 pm
Location: USA

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Dec 11, 2016 2:44 pm

What an amazing piece of work Bill. Thanks to you I just ordered my 10th and 11th Pi Cameras :)
I'm having just one minor issue that I can't seem to figure out. I'm trying to send an email using on_motion_preview_save. From looking at the log all looks OK but I never get an email (1 yahoo and 1 gmail account tested so far).
Here's what I have in pikrellcam.conf:

Code: Select all

# Example command to email the motion detect preview jpeg:
#     on_motion_preview_save mpack -s pikrellcam@$H $F myuser@gmail.com
# Or, example command to run the default preview-save script which you
# can edit to enable emailing or copying the jpeg.
#     on_motion_preview_save $C/preview-save  $F $m $P $G $A
#
#on_motion_preview_save mpack -s pikrellcam@$H $F xxxx@gmail.com
on_motion_preview_save  $C/preview-save  $F $m $P $G
And in scripts/preview_save:

Code: Select all

# To configure emailing a jpeg for a motion event, uncomment one EMAIL_JPG
# line, edit the MY_EMAIL line, and uncomment the mpack line:

# If you want to email the full mjpeg_width preview jpg, uncomment this line:
EMAIL_JPEG=$PREVIEW_JPEG
# OR, to email the smaller motion area thumb jpg, uncomment this line:
# EMAIL_JPEG=$THUMB_JPEG

# Edit MY_EMAIL to your email address to email the preview jpeg.
#
MY_EMAIL=xxxx@gmail.com
mpack -s pikrellcam@$HOSTNAME $EMAIL_JPEG $MY_EMAIL

echo "mpack -s pikrellcam@$HOSTNAME $PREVIEW_JPEG $MY_EMAIL" >> $LOG_FILE
I upgraded the code today, and restarted Pikrellcam after restart and making the changes.
Other than this glitch it's downright stellar. Thank you Bill for sharing.
lpsw

Edit: forgot to append the log:

Code: Select all

========================================================
======= PiKrellCam 3.1.4 started at 2016-12-11 09:29:41
========================================================
using FIFO: /home/pi/pikrellcam/www/FIFO
using mjpeg: /run/pikrellcam/mjpeg.jpg
09:29:41 : 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.
09:29:41 : execl:[/home/pi/pikrellcam/scripts/startup /home/pi/pikrellcam /home/pi/pikrellcam/media /tmp/pikrellcam.log]
  MOUNT_DISK is not set.
09:29:41 : execl:[sudo chown pi.www-data /tmp/pikrellcam.log]
09:29:41 : execl:[sudo chmod 664 /tmp/pikrellcam.log]
09:29:41 : circular buffer allocate: 26.25 MBytes (35 seconds at 6.0 Mbits/sec)
09:29:41 : Server: error binding
09:29:41 : Server running...waiting for connections.
09:29:41 : MJPEG server is listening on port '9999'
sunrise/sunset times: valid  dawn/dusk times: valid
  dawn:    6:33
  sunrise: 7:06
  sunset:  16:04
  dusk:    16:36
09:29:42 : execl:[/home/pi/pikrellcam/scripts-dist/_log-lines 500 /tmp/pikrellcam.log]
09:29:47 : command_process: motion_enable toggle
09:29:53 : Video record: /home/pi/pikrellcam/media/videos/motion_2016-12-11_09.29.48_0.mp4.h264 ...
09:29:53 : event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2016-12-11_09.29.48_0.jpg
09:29:54 : event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2016-12-11_09.29.48_0.jpg
09:30:24 : Video motion record stopped. Header size: 29  h264 file size: 8903811
09:30:24 :     first detect: burst  totals - direction: 1  burst: 3  max burst count: 6976
09:30:24 : execl:[(MP4Box -quiet -tmp /tmp -fps 24 -add /home/pi/pikrellcam/media/videos/motion_2016-12-11_09.29.48_0.mp4.h264 /home/pi/pikrellcam/media/videos/motion_2016-12-11_09.29.48_0.mp4 2> /dev/null && rm /home/pi/pikrellcam/media/videos/motion_2016-12-11_09.29.48_0.mp4.h264 )]
09:30:24 : execl:[/home/pi/pikrellcam/scripts-dist/_thumb /run/pikrellcam/motion_2016-12-11_09.29.48_0.jpg /home/pi/pikrellcam/media /home/pi/pikrellcam/www/FIFO /tmp/pikrellcam.log 496 458 386 230]
  convert /run/pikrellcam/motion_2016-12-11_09.29.48_0.jpg -crop 496x496+138+0 -resize 150x150\! /home/pi/pikrellcam/media/thumbs/motion_2016-12-11_09.29.48_0.th.jpg
09:30:24 : execl:[/home/pi/pikrellcam/scripts/preview-save  /run/pikrellcam/motion_2016-12-11_09.29.48_0.jpg /home/pi/pikrellcam/media /home/pi/pikrellcam/www/FIFO /tmp/pikrellcam.log]
mpack -s pikrellcam@pib-1 /run/pikrellcam/motion_2016-12-11_09.29.48_0.jpg xxxx@gmail.com
09:30:24 : event_preview_dispose(); removing /run/pikrellcam/motion_2016-12-11_09.29.48_0.jpg
Last edited by lpsw on Sun Dec 11, 2016 8:23 pm, edited 1 time in total.
Self-education is, I firmly believe, the only kind of education there is - Isaac Asimov

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Dec 11, 2016 3:42 pm

lpsw wrote:... pikrellcam.conf:

Code: Select all

# Example command to email the motion detect preview jpeg:
#     on_motion_preview_save mpack -s pikrellcam@$H $F myuser@gmail.com
# Or, example command to run the default preview-save script which you
# can edit to enable emailing or copying the jpeg.
#     on_motion_preview_save $C/preview-save  $F $m $P $G $A
#
#on_motion_preview_save mpack -s pikrellcam@$H $F lpsw82@gmail.com
on_motion_preview_save  $C/preview-save  $F $m $P $G
And in scripts/preview_save:

Code: Select all

# To configure emailing a jpeg for a motion event, uncomment one EMAIL_JPG
# line, edit the MY_EMAIL line, and uncomment the mpack line:

# If you want to email the full mjpeg_width preview jpg, uncomment this line:
EMAIL_JPEG=$PREVIEW_JPEG
# OR, to email the smaller motion area thumb jpg, uncomment this line:
# EMAIL_JPEG=$THUMB_JPEG

# Edit MY_EMAIL to your email address to email the preview jpeg.
#
MY_EMAIL=xxxx@gmail.com
mpack -s pikrellcam@$HOSTNAME $EMAIL_JPEG $MY_EMAIL

echo "mpack -s pikrellcam@$HOSTNAME $PREVIEW_JPEG $MY_EMAIL" >> $LOG_FILE
At least in pikrellcam.conf you missed the $A parameter for the script. It should be like in the comment a few lines above:

Code: Select all

on_motion_preview_save $C/preview-save  $F $m $P $G $A
Because in the preview_save script the line EMAIL_JPEG=$THUMB_JPEG corresponds to the fifth parameter (THUMB_JPEG=$5) for the jpeg file. So maybe this helps you for your email problem. I also use this script for sending a telegram message with a preview on my handy and it works very well.

Ciao,
Rainer

User avatar
lpsw
Posts: 228
Joined: Thu Jun 25, 2015 4:45 pm
Location: USA

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Dec 11, 2016 8:41 pm

Rainer, thanks for your reply.
Definitely an oversight on my part. Unfortunately there's still something amiss.
I've tested sending email to my yahoo and gmail accounts using Python 's SMTPLib package, that works fine from the same Pi.
There's got to be another typo somewhere; I'm pretty sure that's all I think it is. Probably time these old eyes got new spectacles.
Self-education is, I firmly believe, the only kind of education there is - Isaac Asimov

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Dec 11, 2016 10:00 pm

Try for example

Code: Select all

mpack -s subject testfile.jpg youremail@gmail.com
to send testfile.jpg to youremail@gmail.com from the console. If this doesn't work you haven't configured the raspberry to send emails to your provider.

Here is one very simple example how to do this but there are many more possible ways:
http://ozzmaker.com/send-email-from-the ... tachments/

Ciao,
Rainer

User avatar
lpsw
Posts: 228
Joined: Thu Jun 25, 2015 4:45 pm
Location: USA

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Dec 11, 2016 11:34 pm

Thank you Rainer, you put me in the right direction. When I tried command line mpack it failed because ssmtp was not installed on this Pi. Thanks again to you and Bill.
Self-education is, I firmly believe, the only kind of education there is - Isaac Asimov

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Dec 12, 2016 9:34 am

lpsw wrote:Thank you Rainer, you put me in the right direction. When I tried command line mpack it failed because ssmtp was not installed on this Pi. Thanks again to you and Bill.
ssmtp is just one way of configuring email sending in the console. There are other possible software like exim4 or postfix but i think ssmtp is a very easy way.

User avatar
lpsw
Posts: 228
Joined: Thu Jun 25, 2015 4:45 pm
Location: USA

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Dec 12, 2016 2:44 pm

Indeed, wicked easy. I usually clone Jessie lite for new Pis, with the stuff I need (like ssmtp) but this time I built from scratch (11-25 version) on a Pi3 booting from USB SSD. Let's just say I missed more than few things :). Thanks again.
Self-education is, I firmly believe, the only kind of education there is - Isaac Asimov

barry914
Posts: 48
Joined: Sat Aug 20, 2016 7:40 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Dec 13, 2016 5:14 pm

Fox Mulder wrote: Here is one very simple example how to do this but there are many more possible ways:
And here's another: http://naelshiab.com/tutorial-send-email-python/

I use these methods in my IOT monitors for various alarm conditions, like leak detection, access monitoring, etc.

snperry85
Posts: 4
Joined: Sat Dec 17, 2016 6:00 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Dec 17, 2016 6:09 pm

Im having issues getting the RTSP feed up and running. I followed Tom's instructions listed here. viewtopic.php?p=862399#p862399 I cannot see any gst-gateworks-apps-master folder. When I try to connect to the stream with VLC it tells me it can't open the MRL. I further installed that last "optional" part to test the stream and it throws erros.

Code: Select all

root@camzero1:~/gst-rpicamsrc# gst-launch-1.0 rpicamsrc bitrate=1000000 ! filesink location=test.h264
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
ERROR: from element /GstPipeline:pipeline0/GstRpiCamSrc:rpicamsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2933): gst_base_src_loop (): /GstPipeline:pipeline0/GstRpiCamSrc:rpicamsrc0:
streaming task paused, reason error (-5)
Execution ended after 0:00:00.154780223
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Caught SIGSEGV
#0  0xb6cadef8 in __libc_waitpid (pid=5042, stat_loc=0xbe9beba8, options=0)
#1  0xb6ce0ec8 in g_on_error_stack_trace ()
#2  0x00014c08 in fault_spin () at gst-launch.c:99
#3  fault_handler_sighandler (signum=<optimized out>) at gst-launch.c:90
#4  <signal handler called>
#5  __GI___pthread_mutex_lock (mutex=0x666e6a5c) at pthread_mutex_lock.c:66
#6  0xb67a3d14 in mmal_component_disable () from /opt/vc/lib/libmmal_core.so
Spinning.  Please run 'gdb gst-launch-1.0 5027' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.
gdb gst-launch-1.0 5027
^C
root@camzero1:~/gst-rpicamsrc# gst-launch-1.0 rpicamsrc bitrate=1000000 ! h264parse !  rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=0.0.0.0 port=5000
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
ERROR: from element /GstPipeline:pipeline0/GstRpiCamSrc:rpicamsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2933): gst_base_src_loop (): /GstPipeline:pipeline0/GstRpiCamSrc:rpicamsrc0:
streaming task paused, reason error (-5)
Execution ended after 0:00:00.142401282
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
root@camzero1:~/gst-rpicamsrc#
I'm using the latest version of Jessie Lite with the newest version of PiKrellCam on a RPi Zero v1.3 and camera v2.1. Any ideas of whats wrong or where I should look to solve these errors. If I stop PiKrellCam then the test feeds don't throw an error when started. I was under the impression they were suppose to work together. I'm not very apt at *nix.

LucidEye
Posts: 84
Joined: Sun Aug 04, 2013 2:20 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Dec 22, 2016 1:15 am

If it hasn't been mentioned yet, make sure you are using an adequate power supply and a good USB cable. I have had almost identical problems with pikrellcam on a few different PIs because of inadequate power.

Also, try re-seating all of your connectors... remove/reinsert SD card, both ends of the camera cable, and the power supply. I've had a couple of flaky connections cause these issues as well.

Also, if you are using servos connected directly to the PIs GPIO pins, use the 3v rail instead of the 5v rail to help prevent sudden voltage drops from the servo's DC motor breakaway point. I had one of my PIs always freeze when I panned the camera left for some reason... switched to the 3v rail and a better power supply and the problem went away.

If you are running headless and don't need the HDMI circuitry powered up, you can reallocate about 30mA to other resources by adding this line

Code: Select all

/usr/bin/tvservice -o
to your /etc/rc.local file. You can also gain another 10mA by disabling the PIs power and act LEDs by adding the following to your /boot/config.txt file

Code: Select all

# Disable the ACT LED.
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

# Disable the PWR LED.
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off
Also disable the sound in your /boot/config.txt file since you aren't really using it and it just uses more power and memory that the pi can use elsewhere.

Hope this helps :-)

Tashman wrote:
billw wrote:
Tashman wrote: Symptoms are 1 no emails, 2 rpi is up (I can ssh in & reboot) 3 if I goto that pikrellcam Web page I can look at the video archive, click about etc BUT the camera picture is frozen (presumably at the time whatever happened happened). If I click on "preset" nothing happens, nor do any camera parameter settings appear on the OSD.
4 after a reboot via ssh all is well until a few days later and same thing happens.
When this happens, is pikrellcam still running?

If not, can you restart pikrellcam without having to reboot?
If the restart fails, do the restart from the ssh terminal to see any messages. If the restart works, then if you
could run pikrellcam from the ssh terminal for the duration of the time it takes for the problem to
happen again there could be an exit reason printed that could give a clue.

If if is still running when things stop working, is the /run/pikrellcam/mjpeg.jpg file getting updated (look at ls -l time).
Yes its still running but the 'live' camera picture on the Pikrellcam web page is frozen, displaying an old camera image from presumably when it went wrong.

The osd overlays (eg Setup,Config,Video Res) don't appear either.

Next time I'll check the mjpeg.jpg file as you suggest & report back.

Is this likely to be a camera problem?

Thanks

Return to “Camera board”