pkavanau
Posts: 1
Joined: Wed May 02, 2018 9:13 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed May 02, 2018 9:27 pm

I’m really enjoying this excellent software.
Is there a way to directly emit a full-resolution still to standard output from a shell script?
I currently execute the “still” FIFO command and cat the resulting file, but would rather not have to do the intermediate write.
There are mjpeg.jpg and mjpeg_read.php, but they are not full-res.

cyclops1982
Posts: 2
Joined: Wed Apr 04, 2018 8:00 am

Re: PiKrellCam: motion vector detect + OSD web interface

Wed May 16, 2018 10:11 am

arnauld wrote:
Sun Apr 15, 2018 3:53 pm
cyclops1982 wrote:
Wed Apr 04, 2018 8:04 am
As i'm now looking for a second option, i was wondering if the camera needs to be specific, or if other raspberry pi camera's will also work.
Currently looking at this: https://raspberrypi.dk/en/product/zerocam-fisheye/ or https://thepihut.com/collections/raspbe ... berry-pi-3
It works, I am using the https://thepihut.com/collections/raspbe ... berry-pi-3 to record hedgehogs at night and it is working fine.
Oh great. Can you share some footage of that?!
And maybe a picture or so of how you've put it together? See these have no mouning options :(

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu May 17, 2018 11:16 am

I can only delete 999 files if I select all files.
As sometimes i get ~3000 files per day it can take a while to click on each file and delete them until there is only 999 files left
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sat May 19, 2018 10:19 pm

I've got an h264 file generated by pikrellcam that failed to get converted to an mp4 file, I think because I rebooted the Raspi Zero that was generating the original file at the time. What is the command that I need to use to convert this to mp4, to essentially complete the process that I interrupted?
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun May 20, 2018 5:27 pm

Nestboxtech wrote:
Sat May 19, 2018 10:19 pm
I've got an h264 file generated by pikrellcam that failed to get converted to an mp4 file, I think because I rebooted the Raspi Zero that was generating the original file at the time. What is the command that I need to use to convert this to mp4, to essentially complete the process that I interrupted?
In the videos dir you would need to run: MP4Box -add filename.h264 filename.mp4

But you still need a thumb generated, so the easiest is to send the "fix_thumbs" command to the FIFO.
Do an upgrade first because I just added to the fix_thumbs script a rerun of MP4Box on stray h264 files.
Then do a fix_thumbs test and check the log file before trying a fix_thumbs fix. Search for the fix_thumbs description in the help page.

Probably save that h264 somewhere first just in case. Also, audio can't be recovered since mp3 intermediate files are
in a tmpfs which has been lost if you rebooted.

Edit: you need to send the fix_thumbs command twice, first it will run MP4Box on any h264 files and the second run is to generate
thumbs if MP4Box succeeded in generating new mp4 files.
Last edited by billw on Sun May 20, 2018 6:21 pm, edited 2 times in total.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun May 20, 2018 5:40 pm

pkavanau wrote:
Wed May 02, 2018 9:27 pm
I’m really enjoying this excellent software.
Is there a way to directly emit a full-resolution still to standard output from a shell script?
I currently execute the “still” FIFO command and cat the resulting file, but would rather not have to do the intermediate write.
There are mjpeg.jpg and mjpeg_read.php, but they are not full-res.
The program can take a still only when a command is sent to the FIFO.

You could increase the mjpeg.jpg resolution in pikrellcam.conf, all the way up to what your video resolution is and then
use mjpeg_read.php, but then the web page preview is huge and uses more bandwiidth.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun May 20, 2018 5:44 pm

Gavinmc42 wrote:
Thu May 17, 2018 11:16 am
I can only delete 999 files if I select all files.
As sometimes i get ~3000 files per day it can take a while to click on each file and delete them until there is only 999 files left
Could be an argument list size limitation somewhere and might need a custom delete script to work around it.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun May 20, 2018 5:54 pm

siddyboy wrote:
Tue Apr 24, 2018 11:30 am
Liking this sw a lot so far.
Trying to set up to take stills on motion detect but I'm obviously missing something really simple. I can set up to capture video but not stills. What settings do I need to change?
I have Pi0W+PicamV2. Using Kweb (Chromium way too slow.)
Hoping to set up headless eventually - although the virtual VNC desktop does not work for me.
Any help gratefully received.

Edit: is it as simple as commenting out the timelapse -> mp4 converter line in the .conf?
Still commands could be sent in an on_motion_begin script. The script could watch the /run/pikrellcam/motion-events
file and take period stills or stills only on motion detects until it sees an <end>. Start with the scripts/example-motion-events
file

There's always a motion video so you can't just take stills with no video. I might look at adding that possibility.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun May 27, 2018 4:27 pm

Oh great. Can you share some footage of that?!
And maybe a picture or so of how you've put it together? See these have no mounting options :(
Sorry for the late reply @cyclops1982.
Here is a video of a hedgehog at night at my home: https://www.youtube.com/watch?v=whIuWqDA5B0

As for the mounting, I just use elastics to fix the camera on top of the raspberry case.

ABianchi
Posts: 3
Joined: Fri Jun 08, 2018 7:04 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Jun 08, 2018 7:26 pm

I am exploring the possibility to use PikrellCam to count the N° of car passing by my busy road and possibly measuring their speed (the latter less critical). I understand that with motion_stats_on I can get some motion info in CSV but I am still confused in regards to its content.
Is that for each event? Not a single file with all the stats?

Also, no video recording is really needed. Can I still create the stats CSV file without enabling the video recording?
Anybody who went down this path willing to share some hints?

Thank-you.

And thanks to the creator of this great SW!

ABianchi
Posts: 3
Joined: Fri Jun 08, 2018 7:04 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jun 10, 2018 1:12 pm

Looks to me that parsing and graphing out some key log file entries might be the simpler option for cars (events) counting.
For now I did extract and manipulated the file in XLS. Not elegant but works.

Is there any way to define the log entry values and for example get a detection entry for each region separately?

Thanks.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jun 10, 2018 2:22 pm

ABianchi wrote:
Sun Jun 10, 2018 1:12 pm
Looks to me that parsing and graphing out some key log file entries might be the simpler option for cars (events) counting.
For now I did extract and manipulated the file in XLS. Not elegant but works.

Is there any way to define the log entry values and for example get a detection entry for each region separately?

Thanks.
To process detection by regions, you can use the /run/pikrellcam/motion-events file. It's intended for an on_motion_begin script to
process this file in real time for motion events and events you are interested in can be processed right then or saved to some
intermediate file as you need..

Search for motion-events in the help page and look at example-motion-events and example-motion-send-alarm2 in the scritpts-dist
directory.. You could start by setting example-motion-events as the on_motion_begin command, run pikrellcam from a terminal to
see the output, and then edit the script to add looking at regions or whatever.

All detects by motion region (x,y coord and vector mag/counts) can be seen as well as the overall frame motion vector that you get
from the csv files.

ABianchi
Posts: 3
Joined: Fri Jun 08, 2018 7:04 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jun 11, 2018 7:38 pm

Thanks Bill. Time to do some more reading.

motosx
Posts: 2
Joined: Sun Jun 17, 2018 7:20 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jun 17, 2018 7:24 pm

Hey guys!
I'm using Compute Module, to which I'm able to connect two cameras via CSI port and I wonder if there is a way to define which camera is PiKrellCam using? Is somewhere in the code a parameter responsible for selecting which camera input to use, which I could change? Somewhere at the camera initialization?

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jun 18, 2018 2:45 am

motosx wrote:
Sun Jun 17, 2018 7:24 pm
Hey guys!
I'm using Compute Module, to which I'm able to connect two cameras via CSI port and I wonder if there is a way to define which camera is PiKrellCam using? Is somewhere in the code a parameter responsible for selecting which camera input to use, which I could change? Somewhere at the camera initialization?
Right now there's no config for this but I should add it. If you want to try experimenting, you would need to add the lines of code shown
in the "Software Support" section at:
https://www.raspberrypi.org/documentati ... -camera.md

In the pikrellcam src directory, add those (not quite exactly) lines to mmalcam.c in the camera_create() function so that the start of the function looks like:

Code: Select all

#define CAMERA_NUMBER 1

boolean
camera_create(void)
    {
    MMAL_PORT_T	    *port;
    MMAL_STATUS_T   status;
    char	    *msg   = "mmal_component_create";

    camera.name = "RPi camera";
    if ((status = mmal_component_create(MMAL_COMPONENT_DEFAULT_CAMERA,
                    &camera.component)) == MMAL_SUCCESS)
	{
        MMAL_PARAMETER_INT32_T camera_num = {{MMAL_PARAMETER_CAMERA_NUM, sizeof(camera_num)}, CAMERA_NUMBER};
	status = mmal_port_parameter_set(camera.component->control, &camera_num.hdr);
	if (status != MMAL_SUCCESS)
            {
            log_printf("setting camera_number failed. Status: %s\n", mmal_status[status]);
            return FALSE;
            }
	msg = "mmal_port_enable";
	camera.control_port = camera.component->control;
	status = mmal_port_enable(camera.control_port,
                            camera_control_callback);
	}
	
Set the #define CAMERA_NUMBER to the camera you want, and run "make" after saving your edits.

I'll see about adding a configuration for this.

motosx
Posts: 2
Joined: Sun Jun 17, 2018 7:20 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Jun 21, 2018 11:54 am

billw wrote:
Mon Jun 18, 2018 2:45 am
motosx wrote:
Sun Jun 17, 2018 7:24 pm
Hey guys!
I'm using Compute Module, to which I'm able to connect two cameras via CSI port and I wonder if there is a way to define which camera is PiKrellCam using? Is somewhere in the code a parameter responsible for selecting which camera input to use, which I could change? Somewhere at the camera initialization?
Right now there's no config for this but I should add it. If you want to try experimenting, you would need to add the lines of code shown
in the "Software Support" section at:
https://www.raspberrypi.org/documentati ... -camera.md

In the pikrellcam src directory, add those (not quite exactly) lines to mmalcam.c in the camera_create() function so that the start of the function looks like:

Code: Select all

#define CAMERA_NUMBER 1

boolean
camera_create(void)
    {
    MMAL_PORT_T	    *port;
    MMAL_STATUS_T   status;
    char	    *msg   = "mmal_component_create";

    camera.name = "RPi camera";
    if ((status = mmal_component_create(MMAL_COMPONENT_DEFAULT_CAMERA,
                    &camera.component)) == MMAL_SUCCESS)
	{
        MMAL_PARAMETER_INT32_T camera_num = {{MMAL_PARAMETER_CAMERA_NUM, sizeof(camera_num)}, CAMERA_NUMBER};
	status = mmal_port_parameter_set(camera.component->control, &camera_num.hdr);
	if (status != MMAL_SUCCESS)
            {
            log_printf("setting camera_number failed. Status: %s\n", mmal_status[status]);
            return FALSE;
            }
	msg = "mmal_port_enable";
	camera.control_port = camera.component->control;
	status = mmal_port_enable(camera.control_port,
                            camera_control_callback);
	}
	
Set the #define CAMERA_NUMBER to the camera you want, and run "make" after saving your edits.

I'll see about adding a configuration for this.

Thank you billw! It works, I just had to delete this line

Code: Select all

 mmal_port_parameter_set(camera.control_port, &camera_config.hdr); 

dburg
Posts: 2
Joined: Tue Jul 03, 2018 2:06 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Jul 03, 2018 2:50 am

billw, in December you mentioned that when motion_preview_save_mode is "first", there can be complications with on_preview_save, so it is probably best to do everything in the on_motion_end command. In addition to the complication that you mentioned, I've noticed that on_preview_save might not even be called when the mode is "first". I see that thumb_convert() only calls the motion_preview_save command "if ( (vcb->state & VCB_STATE_MOTION_RECORD) && ...". I added a few print statements and noticed that sometimes vcb->state is VCB_STATE_MOTION_RECORD, and sometimes it is VCB_STATE_MOTION_RECORD_START. I'm guessing that there's a race between calling thumb_convert() (which is called from mjpeg_callback) and setting "vcb->state = VCB_STATE_MOTION_RECORD" in video_h264_encoder_callback(). I don't understand all of the code, so this is just a guess. And, I'm also guessing that the motion_preview_save command might be more reliably called if thumb_convert() tested for "if ((vcb->state & VCB_STATE_MOTION) && ...", instead of VCB_STATE_MOTION_RECORD. A similar change might also be interesting when choosing the "fmt" string for the call to the "_thumb" script. Of course, the problems that you mentioned with the moving thumb files would still exist. Perhaps motion_preview_save shouldn't be supported when motion_preview_save_mode is "first". Just some ideas. :)

jit
Posts: 33
Joined: Fri Apr 18, 2014 2:52 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Jul 03, 2018 6:48 pm

We've had some pretty great (sunny) weather in the UK over the past few weeks. I've noticed that my cameras have had their motion detection triggered a very large number of times each day as the pi camera auto adjusts exposure. At least I think it's the exposure. Has anyone else noticed anything similar and is there a way to prevent or reduce this?

dburg
Posts: 2
Joined: Tue Jul 03, 2018 2:06 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Jul 03, 2018 7:39 pm

Yes, I had quite a bit of trouble with triggers due to exposure adjustment... especially when there was snow on the ground. At the bottom of my pikrellcam.conf file, I set "metering_mode matrix". It seems to be working pretty well for me.

jit
Posts: 33
Joined: Fri Apr 18, 2014 2:52 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Jul 05, 2018 7:19 pm

dburg wrote:
Tue Jul 03, 2018 7:39 pm
Yes, I had quite a bit of trouble with triggers due to exposure adjustment... especially when there was snow on the ground. At the bottom of my pikrellcam.conf file, I set "metering_mode matrix". It seems to be working pretty well for me.
Thanks for the tip. This has made a tremendous improvement, far fewer triggers! In addition, the recordings are a lot more colour balanced in direct sunlight.

Teknor
Posts: 3
Joined: Fri Apr 14, 2017 4:35 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Aug 07, 2018 12:17 pm

I really appreciate PiKrellCam, and I have three installations.

My last installation is a camera pointed in the direction of a reef/rock in the water where boats frequently crash, even though there are plenty of navigation marks. There were a couple of boats hitting the rock last week, but no detection/video from PiKrellCAm. My settings were default last week.
PiKrellCam_Reef.png
PiKrellCam_Reef.png (242.78 KiB) Viewed 356 times
I have adjusted the values slightly:
[*] Vector_Magnitude = 5 --> New value = 3
[*] Vector_Count = 4 --> New value = 2
[*] Burst_Count = 400
[*] Burst_Frame = 3

Are there other configuration changes recommended to adjust the sensitivity? Increase number of motion areas? All tips are highly appreciated.

rnlg
Posts: 2
Joined: Wed Aug 29, 2018 6:20 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Aug 29, 2018 6:30 pm

Hi, I've installed PiKrellCam on a couple of Raspberry PIs and it is great, thanks!


On one PI I've left the media directory as default and all is fine. On the other I've pointed it to an NFS mounted file system. Everything appears to work, the symbolic links are created OK under ~/pikrellcam/www:

lrwxrwxrwx 1 pi pi 25 Aug 29 17:58 media -> /mnt/raspberry/pikrellcam

and videos, thumbnails and stills are all stored in the appropriate sub-folders under there, but if I try and view media from the web interface I see nothing:

Videos StillsLoop /videos 0.0B Free: 0.0B (NaN %) List View
No files.

Any clues?

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 30, 2018 2:24 am

rnlg wrote:
Wed Aug 29, 2018 6:30 pm
Hi, I've installed PiKrellCam on a couple of Raspberry PIs and it is great, thanks!


On one PI I've left the media directory as default and all is fine. On the other I've pointed it to an NFS mounted file system. Everything appears to work, the symbolic links are created OK under ~/pikrellcam/www:

lrwxrwxrwx 1 pi pi 25 Aug 29 17:58 media -> /mnt/raspberry/pikrellcam

and videos, thumbnails and stills are all stored in the appropriate sub-folders under there, but if I try and view media from the web interface I see nothing:

Videos StillsLoop /videos 0.0B Free: 0.0B (NaN %) List View
No files.

Any clues?
The permissions should have www-data for group, it should be:

lrwxrwxrwx 1 pi www-data 25 Aug 29 17:58 media -> /mnt/raspberry/pikrellcam

Does your /home/pi/pikrellcam/www directory have "pi www-data" permission?

If you somehow lost the www-data permission on the www directory, then the links inside won't create with www-data permission.
If www is wrong, stop pikrellcam, do a sudo chown pi.www-data /home/pi/pikrellcam/www, delete the ~/pikrellcam/www/media link and restart pikrellcam.

rnlg
Posts: 2
Joined: Wed Aug 29, 2018 6:20 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 30, 2018 6:30 pm

Thanks, that didn't solve the problem, but I examined the permissions down the tree and discovered that the /mnt/raspberry folder had no permissions:

[email protected]:/mnt $ ls -l
total 0
d--------- 1 root root 126 Aug 26 12:17 raspberry

which must have stopped the web service from viewing the folders underneath, even though pikrellcam itself was happy to access the subfolders underneath that mount point (/mnt/raspberry/pikrellcam/...)

I've changed the permissions on /mnt/raspberry to 555 and all is good now :)

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Sep 09, 2018 9:04 am

billw wrote:
Sun May 20, 2018 5:54 pm
There's always a motion video so you can't just take stills with no video. I might look at adding that possibility.
That would be great, bill! I use pikrellcam mainly for identifying who is entering an area and there videos take up lots of space but pictures have a much higher resolution (and still need less space). For me, this would be still sufficient and in fact better.

Or is there a detour so that I can record several high resolution pictures and only a very short video?
raspberry B, Noir camera, Mac Book Air, iPhone, Bezzera

Return to “Camera board”

Who is online

Users browsing this forum: neilgl and 10 guests