Ouba
Posts: 12
Joined: Sun Jan 01, 2017 4:12 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Sep 15, 2018 2:07 pm

I would also appreciate this feature. Only still when motion is detected.

I think that I find a bug. When the fonction "on startup loop" is ON, the timing for the loop limite is not good.

600 is read as an hour not 600sec ...

Thanks

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Nov 04, 2018 8:00 pm

I also wanted the option to take only stills, mainly to avoid having to separately purge the videos and stills directories.

Now instead, I take a still at the start of each motion event, then at motion end rename the still to match its associated motion file, so the media archive script could be easily modified to delete this associated still whenever a video is deleted.

Specifically,

Set these variables in pikrellcam.conf:
on_motion_begin @still
on_motion_end mv $s `dirname $s`/`basename $v .mp4`.jpg

Add these commands to the else block in function delete_file of media-archive.php:
// Delete associated still, too
$still = str_replace(".mp4", ".jpg", $fname);
unlink("$media_dir/stills/$still");

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 05, 2018 7:39 pm

Hello,

Have you seen this camera board?

Image

https://www.kubii.fr/cameras-accessoire ... 12516.html

Do you think it is possible to have the 4 cameras at the same time using Pikrellcam?

tropho
Posts: 55
Joined: Mon Feb 26, 2018 11:36 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 05, 2018 8:05 pm

arnauld wrote:
Mon Nov 05, 2018 7:39 pm
Hello,

Have you seen this camera board?

Image

https://www.kubii.fr/cameras-accessoire ... 12516.html

Do you think it is possible to have the 4 cameras at the same time using Pikrellcam?
I'm not sure about PiKrellCam accessing more than one camera per Raspberry Pi, but no matter what software is used it is not possible to access more than one camera simultaneously using this board. Per the manufacturer, this Arducam multi-camera board only allows access to one camera at a time, which might be useful if you wanted to build a 3D scanner or something similar where you wanted to take photos from multiple cameras and various angles. As a surveillance option, the best you could do with it would be to have it access each camera for a period of time (e.g. five seconds), cycling among the cameras but you could not record from say, camera #1 while viewing any of the other three cameras. In that case camera placement would also be limited to the length of each camera cable. There are flat camera cable-to-HDMI converters that allow very long cable runs using HDMI cables, but for the cost of four of those you would be better off buying multiple Raspberry Pi computers with their own cameras and have no limitation on placement (besides a power supply of course). I would recommend multiple Raspberry Pi's if you want multiple cameras. I have done this and it works well.

One more thing to note: this board is limited to the older 5 megapixel Raspberry Pi camera modules. The newer 8 megapixel version (v2.1) camera module is not compatible with this board.

tropho
Posts: 55
Joined: Mon Feb 26, 2018 11:36 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 05, 2018 8:12 pm

tropho wrote:
Mon Nov 05, 2018 8:05 pm
arnauld wrote:
Mon Nov 05, 2018 7:39 pm
Hello,

Have you seen this camera board?

Image

https://www.kubii.fr/cameras-accessoire ... 12516.html

Do you think it is possible to have the 4 cameras at the same time using Pikrellcam?
I'm not sure about PiKrellCam accessing more than one camera per Raspberry Pi, but no matter what software is used it is not possible to access more than one camera simultaneously using this board. Per the manufacturer, this Arducam multi-camera board only allows access to one camera at a time, which might be useful if you wanted to build a 3D scanner or something similar where you wanted to take photos from multiple cameras and various angles. As a surveillance option, the best you could do with it would be to have it access each camera for a period of time (e.g. five seconds), cycling among the cameras but you could not record from say, camera #1 while viewing any of the other three cameras. In that case camera placement would also be limited to the length of each camera cable. There are flat camera cable-to-HDMI converters that allow very long cable runs using HDMI cables, but for the cost of four of those you would be better off buying multiple Raspberry Pi computers with their own cameras and have no limitation on placement (besides a power supply of course). I would recommend multiple Raspberry Pi's if you want multiple cameras. I have done this and it works well.

One more thing to note: this board is limited to the older 5 megapixel Raspberry Pi camera modules. The newer 8 megapixel version (v2.1) camera module is not compatible with this board.
Actually, I am wrong! I was thinking about the other Arducam multicamera board (this one: https://www.amazon.com/Arducam-Camera-A ... B012UQWOOQ), which has the limitation I described. The one you linked to apparently takes pictures from four 5 megapixel cameras simultaneously, then stitches them into a panoramic picture for a 360-degree photograph. This still may not be ideal or compatible for video purposes though.

The manufacturer Arducam states the following regarding simultaneously accessing the cameras: "The micro-controller will issue capture command at the same time, then the four camera start capture process automatically and save to their own onboard frame buffer. You micro-controller will read back the image data one by one from each camera module."

Good luck!

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Nov 05, 2018 10:05 pm

This still may not be ideal or compatible for video purposes though.
This other board is compatible for video purposes:
Now Arducam team designed upgrade V2.1 multi-camera adapter board for both 5MP and 8MP pi cameras
http://www.arducam.com/arducam-v2-1-mul ... ra-imx219/

tropho
Posts: 55
Joined: Mon Feb 26, 2018 11:36 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Nov 06, 2018 1:15 pm

arnauld wrote:
Mon Nov 05, 2018 10:05 pm
This still may not be ideal or compatible for video purposes though.
This other board is compatible for video purposes:
Now Arducam team designed upgrade V2.1 multi-camera adapter board for both 5MP and 8MP pi cameras
http://www.arducam.com/arducam-v2-1-mul ... ra-imx219/
That is awesome, thank you for sharing the link! I'm happy to see there is a new version.

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

script to trigger still & upload to weather site

Fri Nov 09, 2018 10:09 pm

I haven't kept current on this thread, so it's likely been done before- but anyway, in case it's helpful, here is a script I use to trigger PiKrellCam to take a still image every 5 minutes, resize, and upload it to a weather-camera site. I'm using a 3rd-party fisheye variant of the standard Pi camera, pointed up to the sky so you can see (nearly) 360 degrees, well apart from all the trees.

https://github.com/jbeale1/DataAcq/blob ... -upload.sh

Photo of the camera, a temporary install as you see:
https://photos.app.goo.gl/Xn9GJUpAkHGGPWDz6

User avatar
Realizator
Posts: 29
Joined: Thu Jul 14, 2016 12:53 pm
Contact: Website Twitter

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Dec 11, 2018 11:22 am

tropho wrote:
Mon Nov 05, 2018 8:05 pm

... but no matter what software is used it is not possible to access more than one camera simultaneously using this board. ...

One more thing to note: this board is limited to the older 5 megapixel Raspberry Pi camera modules. The newer 8 megapixel version (v2.1) camera module is not compatible with this board.
Sorry for off-topic, but may be it will be interesting for you to know about our approach. For taking 2 pictures at a moment we used our StereoPi board, based on Raspberry Pi Compute Module 3 Lite. It supports 2 cameras simultaneously. Also works with V2 cameras, but, as I know, there are no wide-angle V2 cameras on market now.
Here is our setup and two photos taken from V1 cameras and 200-degree lenses (Waveshare cameras). Photos were taken at maximum resolution of this camera (5MPix). Then we stitched them manually.

Image

Here you can see panorama we got after stitching in online viewer: https://theta360.com/s/oXGtqTFlBIjTSodAQ9mTYqWmG

We did not played with video yet, technically it is possible. But, of course, not in 5MPix - somwhere near FullHD (if we are talking about simultaneous picture taking from both cameras).

p.s. you can not buy this board right now, it's a prototypes only, but we plan to manufacture it, and preparing for crowdfunding now.

tropho
Posts: 55
Joined: Mon Feb 26, 2018 11:36 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Dec 11, 2018 1:06 pm

Realizator wrote:
Tue Dec 11, 2018 11:22 am
tropho wrote:
Mon Nov 05, 2018 8:05 pm

... but no matter what software is used it is not possible to access more than one camera simultaneously using this board. ...

One more thing to note: this board is limited to the older 5 megapixel Raspberry Pi camera modules. The newer 8 megapixel version (v2.1) camera module is not compatible with this board.
Sorry for off-topic, but may be it will be interesting for you to know about our approach. For taking 2 pictures at a moment we used our StereoPi board, based on Raspberry Pi Compute Module 3 Lite. It supports 2 cameras simultaneously. Also works with V2 cameras, but, as I know, there are no wide-angle V2 cameras on market now.
Here is our setup and two photos taken from V1 cameras and 200-degree lenses (Waveshare cameras). Photos were taken at maximum resolution of this camera (5MPix). Then we stitched them manually.

Image

Here you can see panorama we got after stitching in online viewer: https://theta360.com/s/oXGtqTFlBIjTSodAQ9mTYqWmG

We did not played with video yet, technically it is possible. But, of course, not in 5MPix - somwhere near FullHD (if we are talking about simultaneous picture taking from both cameras).

p.s. you can not buy this board right now, it's a prototypes only, but we plan to manufacture it, and preparing for crowdfunding now.
That is an awesome project and the output looks great, even if it required a little manual work. I look forward to seeing it in action soon!

VoiceOgraph
Posts: 1
Joined: Tue Dec 11, 2018 8:33 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Dec 11, 2018 8:53 pm

Hi all, I'm now 2 weeks into the raspberry pi world, and totally fascinated. By day I am a Patent Attorney - this is for a hobby I have restoring vintage vinyl record-making booths.

My question is somewhat related to the recent thread posts: Can PiKrellCam, running on one rpi, be modified to switch among four cameras using the multiple camera board, sort of like going between presets but instead of panning and tilting it would just switch input to another camera and continue on with the same recording so that only one file is created?

I want to be able to automatically create 3 minute music videos inside a vintage 1940s vinyl record recording booth, sequencing among different angle cameras and/or video effects, and end up with a single video file that I would post to youtube.

I have a great need for that capability, and also am looking for a programmer to get me there!

Thank you!
[email protected]

User avatar
Realizator
Posts: 29
Joined: Thu Jul 14, 2016 12:53 pm
Contact: Website Twitter

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Dec 14, 2018 9:11 am

tropho wrote:
Tue Dec 11, 2018 1:06 pm
...

That is an awesome project and the output looks great, even if it required a little manual work. I look forward to seeing it in action soon!
Image

tropho, we ported stitching onboard. We also did a step-by-step manual and ready-to-use code, but it appears to be TL;DR. So we put it as a separate article here. Hope it helps :-)

BTBarney
Posts: 1
Joined: Fri Jan 04, 2019 4:16 am

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Jan 04, 2019 4:25 am

Newbie, so I apologize for what is probably an obvious question.

I have the software setup 'out of the box' with no real changes, other than starting the system and clicking enable:motion. The camera will capture a video perfectly if there is catastrophic motion (i.e. picking up and moving the pi and camera together), but does not capture video when I walk in front of it or waggle my fingers in front of the camera module.

Is there a setting I am missing? I haven't changed the motion regions at all.

Setup>Preset>Settings> Vector_Count = 4
Setup>Preset>Settings> Vector_Magnitude = 5

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

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Jan 04, 2019 3:43 pm

BTBarney wrote:
Fri Jan 04, 2019 4:25 am
Newbie, so I apologize for what is probably an obvious question.

I have the software setup 'out of the box' with no real changes, other than starting the system and clicking enable:motion. The camera will capture a video perfectly if there is catastrophic motion (i.e. picking up and moving the pi and camera together), but does not capture video when I walk in front of it or waggle my fingers in front of the camera module.

Is there a setting I am missing? I haven't changed the motion regions at all.

Setup>Preset>Settings> Vector_Count = 4
Setup>Preset>Settings> Vector_Magnitude = 5
Vector count and magnitude are settings tuned for smaller motion more at a distance from the camera and will actually
filter out the large motions of walking and fingers in front of the camera lens. Those are larger motion events covered
better with the burst settings.
Try setting Preset->Settings->Burst_Count low to say 50 and Preset->Settings->Burst_Frames to 2
Those could be too low for what you finally want, but should give results for your initial testing.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jan 13, 2019 5:21 pm

I've run into a problem running Pikrellcam, which I think may be due to running it in Raspbian Lite vs the full distro.

I have several Raspi Zero W's running pikrellcam. They are setup headless running the full Stretch image.
I wanted to run it on Stretch Lite to get the most free space for local video file storage (worth approx 3-4Gb extra space)

For my 'lite clone' I downloaded Raspian Lite (Stretch) and installed Pikrellcam as per the instructions.
I copied over pikrellcam.conf from a working Zero W pikrellcam setup which is running the full Stretch distro.
Both Pis are running Pikrellcam v4.1.6

pikrellcam.conf is set to start motion on startup (motion_enable on)

The problem is motion activation wont start automatically and I cant activate motion in the webpage.

if motion button is set to 'enable' the message at the bottom LHS says:
Motion OFF (off preset)
RED (Stop)

If motion button is switched to 'disable', the bottom LHS message says:
Motion hold (off preset)
RED (Stop)

There are no error messages in the log
I can still manually trigger video or image capture via the buttons under the video stream, so the capture works, just the motion bit of seems not to.

? Am I missing something obvious, any help would be appreciated,

Thanks,

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

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

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Jan 15, 2019 4:20 pm

Nestboxtech wrote:
Sun Jan 13, 2019 5:21 pm
The problem is motion activation wont start automatically and I cant activate motion in the webpage.

if motion button is set to 'enable' the message at the bottom LHS says:
Motion OFF (off preset)
RED (Stop)

If motion button is switched to 'disable', the bottom LHS message says:
Motion hold (off preset)
RED (Stop)
When "Off Preset" motion is disabled until servos are moved
back onto a preset position. Or if you want motion enabled when
off preset, then enable Setup->Servo->Motion_Off_Preset.

If your 'lite clone' has servos just click a Preset arrow on the web
page to move to a servo position. If it does not have servos, then edit
pikrellcam.conf to disable servos (set servo_pan_gpio and servo_tilt_gpio
to -1).

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

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Jan 15, 2019 10:10 pm

billw wrote:
Tue Jan 15, 2019 4:20 pm
Nestboxtech wrote:
Sun Jan 13, 2019 5:21 pm
The problem is motion activation wont start automatically and I cant activate motion in the webpage.

if motion button is set to 'enable' the message at the bottom LHS says:
Motion OFF (off preset)
RED (Stop)

If motion button is switched to 'disable', the bottom LHS message says:
Motion hold (off preset)
RED (Stop)
When "Off Preset" motion is disabled until servos are moved
back onto a preset position. Or if you want motion enabled when
off preset, then enable Setup->Servo->Motion_Off_Preset.

If your 'lite clone' has servos just click a Preset arrow on the web
page to move to a servo position. If it does not have servos, then edit
pikrellcam.conf to disable servos (set servo_pan_gpio and servo_tilt_gpio
to -1).
I'm not using servos, the camera is fixed in a birdbox, so havent needed to modify the servo settings from default.
I'm a bit confused where to find the options you've described as Setup->Servo->Off_Preset, I cant see that on the GUI.

Could pikrellcam be inferring the presence of servos based on the current state of GPIOs? I am using some to shift an IR filter and and also switch leds on and off using a transistor i/c

pikrellcam.conf has the following settings
servo_pan_gpio -1
servo_tilt_gpio -1
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Jan 16, 2019 2:24 am

Nestboxtech wrote:
Tue Jan 15, 2019 10:10 pm
I'm not using servos, the camera is fixed in a birdbox, so havent needed to modify the servo settings from default.
I'm a bit confused where to find the options you've described as Setup->Servo->Off_Preset, I cant see that on the GUI.

Could pikrellcam be inferring the presence of servos based on the current state of GPIOs? I am using some to shift an IR filter and and also switch leds on and off using a transistor i/c

pikrellcam.conf has the following settings
servo_pan_gpio -1
servo_tilt_gpio -1
Pikrellcam is supposed to never be off preset if servos are not enabled, so I thought you must have enabled servos and would then
have a Setup->Servo section.

So something in the config must be causing a problem to make pikrellcam have no presets. Can you save copies of config files
and post them so I can check it out (but delete out your latitude and longitude from pikrellcam.conf if you have set them):
~/.pikrellcam/pikrellcam.conf
~/.pikrellcam/preset-no-servos.conf
~/.pikrellcam/preset-no-servos.state

Then you can try:
1) Create a new preset from the web config:
Setup->Preset->New
2) If that has no effect or do this anyway to clean things up, stop pikrellcam and then delete the two preset-no-servos files in ~/.pikrellcam.

After both 1) and/or 2) restart pikrellcam.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Jan 17, 2019 12:08 am

billw wrote:
Wed Jan 16, 2019 2:24 am
Nestboxtech wrote:
Tue Jan 15, 2019 10:10 pm
I'm not using servos, the camera is fixed in a birdbox, so havent needed to modify the servo settings from default.
I'm a bit confused where to find the options you've described as Setup->Servo->Off_Preset, I cant see that on the GUI.

Could pikrellcam be inferring the presence of servos based on the current state of GPIOs? I am using some to shift an IR filter and and also switch leds on and off using a transistor i/c

pikrellcam.conf has the following settings
servo_pan_gpio -1
servo_tilt_gpio -1
Pikrellcam is supposed to never be off preset if servos are not enabled, so I thought you must have enabled servos and would then
have a Setup->Servo section.

So something in the config must be causing a problem to make pikrellcam have no presets. Can you save copies of config files
and post them so I can check it out (but delete out your latitude and longitude from pikrellcam.conf if you have set them):
~/.pikrellcam/pikrellcam.conf
~/.pikrellcam/preset-no-servos.conf
~/.pikrellcam/preset-no-servos.state

Then you can try:
1) Create a new preset from the web config:
Setup->Preset->New
2) If that has no effect or do this anyway to clean things up, stop pikrellcam and then delete the two preset-no-servos files in ~/.pikrellcam.

After both 1) and/or 2) restart pikrellcam.
Many thanks Bill, I deleted both preset-no-servos files and it is now working :)
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Feb 01, 2019 11:39 pm

Hi,

I wanted to use the motion detect functionality to log motion events without necessarily triggering a video recording -is his possible?

The scenario is... I have a bird roosting overnight in a nest box. I have a theory that the colder it is at night, the more it moves to generate body heat. I wanted to log some sort of metric to represent how active the sleepy bird is. I've tried using:
on_motion_begin python "my_script_that_logs.py" however I get one event, then a recording, which I dont want as I dont want a full SD card, and also all the disk writing isnt very helpful. Ideally, I want to generate a metric that represents motion events, and possibly their magnitude in a given period (say 1 minute), then write that to a file/database.
I have set motion_stats on, this generates a potentially potentially output. Can I generate this minus the video?

Thanks,

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

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Feb 02, 2019 12:50 am

Nestboxtech wrote:
Fri Feb 01, 2019 11:39 pm
Hi,

I wanted to use the motion detect functionality to log motion events without necessarily triggering a video recording -is his possible?

The scenario is... I have a bird roosting overnight in a nest box. I have a theory that the colder it is at night, the more it moves to generate body heat. I wanted to log some sort of metric to represent how active the sleepy bird is. I've tried using:
on_motion_begin python "my_script_that_logs.py" however I get one event, then a recording, which I dont want as I dont want a full SD card, and also all the disk writing isnt very helpful. Ideally, I want to generate a metric that represents motion events, and possibly their magnitude in a given period (say 1 minute), then write that to a file/database.
I have set motion_stats on, this generates a potentially potentially output. Can I generate this minus the video?

Thanks,

Chris
Videos can't be avoided. Let me give that some thought, maybe I can come up with a solution for you.

As for collecting motion stats to write to a database, take a look at using ~/pikrellcam/scripts-dist/example-motion-events
as a starting point for your on_motion_begin script. The script processes motion events in real time and could be modified
to write to database/file. As is, it will print output you can see only if you run pikrellcam from a terminal.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Feb 02, 2019 8:13 am

billw wrote:
Sat Feb 02, 2019 12:50 am
Nestboxtech wrote:
Fri Feb 01, 2019 11:39 pm
Hi,

I wanted to use the motion detect functionality to log motion events without necessarily triggering a video recording -is his possible?

The scenario is... I have a bird roosting overnight in a nest box. I have a theory that the colder it is at night, the more it moves to generate body heat. I wanted to log some sort of metric to represent how active the sleepy bird is. I've tried using:
on_motion_begin python "my_script_that_logs.py" however I get one event, then a recording, which I dont want as I dont want a full SD card, and also all the disk writing isnt very helpful. Ideally, I want to generate a metric that represents motion events, and possibly their magnitude in a given period (say 1 minute), then write that to a file/database.
I have set motion_stats on, this generates a potentially potentially output. Can I generate this minus the video?

Thanks,

Chris
Videos can't be avoided. Let me give that some thought, maybe I can come up with a solution for you.

As for collecting motion stats to write to a database, take a look at using ~/pikrellcam/scripts-dist/example-motion-events
as a starting point for your on_motion_begin script. The script processes motion events in real time and could be modified
to write to database/file. As is, it will print output you can see only if you run pikrellcam from a terminal.
thanks Bill, I'll have alook at example-motion-events.
re your suggestion about capturing output if run from a terminal, pikrellcam is set to run at boot, headless (up a tree). is it possible to capture this output to pipe it to some other process? would I have to start it differently?

re the videos, would it be possible to add some sort of switch to bypass the video generation? one thing I wold like to do is have motion running all the time, but only generate videos during the day, the easiest way (for me!) woul be to have a FIFO command the enabled/disabled the camera while will having motion running all the time to generate an equivalent to the output from motion_stats. that way I could still capture videos during the day (low activity and more interesting when it happens) versus all night (sleeping bird = less interesting & full SD card.

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

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Feb 02, 2019 8:57 pm

Nestboxtech wrote:
Sat Feb 02, 2019 8:13 am
thanks Bill, I'll have alook at example-motion-events.
re your suggestion about capturing output if run from a terminal, pikrellcam is set to run at boot, headless (up a tree). is it possible to capture this output to pipe it to some other process? would I have to start it differently?

re the videos, would it be possible to add some sort of switch to bypass the video generation? one thing I wold like to do is have motion running all the time, but only generate videos during the day, the easiest way (for me!) woul be to have a FIFO command the enabled/disabled the camera while will having motion running all the time to generate an equivalent to the output from motion_stats. that way I could still capture videos during the day (low activity and more interesting when it happens) versus all night (sleeping bird = less interesting & full SD card.

Thanks very much, Chris
If you can ssh into your headless pi, just quit pikrellcam from the web page, then start it by running "pikrellcam" in the ssh terminal.
Otherwise you would need to modify the example-motion-events script to write to a file.

There is a lot of interaction with various parts of the program when motion starts a video, so I don't think I want to overload that with
a mode where videos are suppressed. But there could be a separate and independent interface for writing motion events to a fifo.
Motion videos functions would remain unchanged and if you don't want videos, just turn them off/on at say sunset and sunrise
with an at-commands.conf "@motion_enable off" or "@motion_enable on"

Then separately I can add a fifo interface for reading motion events that works independently of motion enabled and this could also be
controlled with at-commands.conf commands. A python script would read from a motion events fifo for as long as it wants and
get all motion events. The script would not be started as an on_motion_begin command but would be started externally by hand
or by at-commands.conf or even cron. This would give pikrellcam the option of being a motion detect front end for some other
app that wants to do something besides generate videos - which is what you want.

Offhand, I would say it would write the events in the same format as is written to the /var/run/motion-events
file except it would be a continuous stream of events for as along as the interface is on and would not have begin/end states
associated with videos. Your python app would read the stream for as long as it wants - probably there should be a way to tell
your app to terminate so it could be set up to run only at night via an at-commands.conf command.

So I'll look into this. I think it would be nice to have the option for pikrellcam to be a general purpose motion detect front end.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Feb 02, 2019 11:16 pm

billw wrote:
Sat Feb 02, 2019 8:57 pm
Nestboxtech wrote:
Sat Feb 02, 2019 8:13 am
thanks Bill, I'll have alook at example-motion-events.
re your suggestion about capturing output if run from a terminal, pikrellcam is set to run at boot, headless (up a tree). is it possible to capture this output to pipe it to some other process? would I have to start it differently?

re the videos, would it be possible to add some sort of switch to bypass the video generation? one thing I wold like to do is have motion running all the time, but only generate videos during the day, the easiest way (for me!) woul be to have a FIFO command the enabled/disabled the camera while will having motion running all the time to generate an equivalent to the output from motion_stats. that way I could still capture videos during the day (low activity and more interesting when it happens) versus all night (sleeping bird = less interesting & full SD card.

Thanks very much, Chris
If you can ssh into your headless pi, just quit pikrellcam from the web page, then start it by running "pikrellcam" in the ssh terminal.
Otherwise you would need to modify the example-motion-events script to write to a file.

There is a lot of interaction with various parts of the program when motion starts a video, so I don't think I want to overload that with
a mode where videos are suppressed. But there could be a separate and independent interface for writing motion events to a fifo.
Motion videos functions would remain unchanged and if you don't want videos, just turn them off/on at say sunset and sunrise
with an at-commands.conf "@motion_enable off" or "@motion_enable on"

Then separately I can add a fifo interface for reading motion events that works independently of motion enabled and this could also be
controlled with at-commands.conf commands. A python script would read from a motion events fifo for as long as it wants and
get all motion events. The script would not be started as an on_motion_begin command but would be started externally by hand
or by at-commands.conf or even cron. This would give pikrellcam the option of being a motion detect front end for some other
app that wants to do something besides generate videos - which is what you want.

Offhand, I would say it would write the events in the same format as is written to the /var/run/motion-events
file except it would be a continuous stream of events for as along as the interface is on and would not have begin/end states
associated with videos. Your python app would read the stream for as long as it wants - probably there should be a way to tell
your app to terminate so it could be set up to run only at night via an at-commands.conf command.

So I'll look into this. I think it would be nice to have the option for pikrellcam to be a general purpose motion detect front end.
I had a go at making the modifications detailed in the example-motion-events script and then pikrellcam.conf for the
on_motion_begin $C/motion_events $e modification, then running pikrellcam from a terminal window, and get:
sh: 1: /home/pi/pikrellcam/scripts/motion_events: Permission denied
I created the motion-events folder as the pi user, I've probably made a stupid mistake, but am struggling to figure out what I've done, I thought that as I ran pikrellcam from the pi user terminal as you said.
http://nestboxtech.blogspot.co.uk/

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Feb 03, 2019 12:25 am

Nestboxtech wrote:
Sat Feb 02, 2019 11:16 pm
I had a go at making the modifications detailed in the example-motion-events script and then pikrellcam.conf for the
on_motion_begin $C/motion_events $e modification, then running pikrellcam from a terminal window, and get:
sh: 1: /home/pi/pikrellcam/scripts/motion_events: Permission denied
I created the motion-events folder as the pi user, I've probably made a stupid mistake, but am struggling to figure out what I've done, I thought that as I ran pikrellcam from the pi user terminal as you said.
When you copied it, does it still have execute permission?
In your ssh terminal, run

Code: Select all

[email protected]: ~/pikrellcam$ ls -l ~/pikrellcam/scripts/motion_events 
-rwxr-xr-x 1 pi pi 1496 Oct 13 11:53 /home/pi/pikrellcam/scripts/motion_events*
You should be able to run the script by hand and it will report the motion events for the last motion video:

Code: Select all

cd ~/pikrellcam/scripts
./motion_events test-run
Output will be like:

Code: Select all

on_motion_begin triggered by: test-run
  motion event number: 1
    motion direction - region: 0
  motion event number: 2
    motion direction - region: 0
    ...

Return to “Camera board”