Replies: 15 comments
-
Do you have a corresponding motion log? |
Beta Was this translation helpful? Give feedback.
-
I do sorry forgot to post it this morning. This was run at log level 7:
|
Beta Was this translation helpful? Give feedback.
-
Was your motion running just for few seconds? That's not what I wanted. I'd like to see your motion detecting events and saving files |
Beta Was this translation helpful? Give feedback.
-
Apologies, here is a log from this morning with 3 captured events. One thing I noted in this log pull was this entry:
https://gist.github.com/ipyakuza/8f3620a299abdb1f4593b07799b2f011 |
Beta Was this translation helpful? Give feedback.
-
Did some additional testing today by testing externally using |
Beta Was this translation helpful? Give feedback.
-
Ok, thanks, I will try to verify it |
Beta Was this translation helpful? Give feedback.
-
I have tested
Script I used was:
Result:
|
Beta Was this translation helpful? Give feedback.
-
Strange. In my setup I have the |
Beta Was this translation helpful? Give feedback.
-
Reproducing the test you have done it does seem to work via an external script using |
Beta Was this translation helpful? Give feedback.
-
Will check sql now |
Beta Was this translation helpful? Give feedback.
-
Well looks like it works using |
Beta Was this translation helpful? Give feedback.
-
Ok, so you have been affected by the same confusion as some other users: #879 (comment) Meanwhile I have tested which variables are available by running this query: sql_query_start insert into a values ('%Y year %m month %d day %H hour %M minute %S second %T HH:MM:SS %v event %q frame number %t camera id number %D changed pixels %N noise level %w width of the image %h height of the image %i width of motion area %J height of motion area %K X coordinates of motion center %L Y coordinates of motion center %C value defined by text_event %f filename with full path %n number indicating filetype %o threshold %Q Number of labels from despeckle %{dbeventid} See sql_query_start %$ camera name %{fps} current frames per second %{host} name of computer running Motion %{ver} The version of Motion') Got this result: | 2019 year 01 month 12 day 18 hour 42 minute 47 second 18:42:47 HH:MM:SS 01 event 11 frame number 0 camera id number 1810 changed pixels 73 noise level 1280 width of the image 720 height of the image 64 width of motion area 100 height of motion area 926 X coordinates of motion center 636 Y coordinates of motion center 20190112184247 value defined by text_event filename with full path number indicating filetype 1500 threshold 9 Number of labels from despeckle 0 See sql_query_start camera name 0 current frames per second motion name of computer running Motion 4.2.1+git20181209-7bd179c The version of Motion | Indeed, %f seems to be the only one missing. And I see no reason why the filename is not available for the event start sql query. Adding @Mr-Dave for comment whether this is a bug or a feature request |
Beta Was this translation helpful? Give feedback.
-
What it looks like is happening is that the I don't run a database so do not know the ultimate root reason why users would want to use this query trigger instead of the usual 'sql_query'. My general thought is that the start/stop should be the on the edges of the event to allow for preparing and cleaning up any activity from sql_query. (PR are welcome for the documentation.) |
Beta Was this translation helpful? Give feedback.
-
We should probably rename those sql statements to avoid future confusion. Marking as "enhancement" for backlog |
Beta Was this translation helpful? Give feedback.
-
I just noticed the same thing! I added an enhancement to the formatting, %F (capital) that stripped the path away, so that if you were dumping the filenames into a directory that was in a WWW path, you could give people a database listing, and have them click and download without any additional shenanigans :) However, it was null a lot! I think all we have to do is update the docs. It would save a lot of hair pulling. I have also noticed that %{dbeventid} seems to be the same, and 'one off' or zero. Still doing some testing. I've also noticed that .jpg files get written to with sql_query. You can't do a sql insert for jpg without also doing one for a movie. Same statement. == John == |
Beta Was this translation helpful? Give feedback.
-
Version: 4.2.1+git20181209-7bd179c (built from scratch)
Video Stream: rtsp (Lorex IP Camera)
Hardware: X86
OS: ArchLinux x86_64 latest updates
Running MariaDB (mysql fork) and attempting to insert/update a recording table:
CREATE TABLE recordings (id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, camera_id VARCHAR(6), camera_name VARCHAR(32), filename VARCHAR(256), width INT, height INT, fps INT, start_time DATETIME, end_time DATETIME, event VARCHAR(16));
Query for 'sql_query_start':
sql_query_start INSERT INTO recordings (camera_id, camera_name, filename, width, height, fps, start_time, event) VALUES ('%t', '%$', "%f", '%w', '%h', '%{fps}', '%Y-%m-%d %H:%M:%S', '%v')
Query for 'sql_query_stop':
sql_query_stop UPDATE recordings SET end_time = '%Y-%m-%d %H:%M:%S' WHERE filename = "%f"
SQL RESULTS:
ISSUE:
The results show the first 6 entries were NULL only because I wasn't inserting the filename at the time. From rows 7 onward the conversion specifier '%f' doesn't seem to be outputting a value (or if it is its just a blank since it's not coming through as NULL). I read the docs and it was noted could use '' or "" around values both yield the same results. Expected result is the absolute path to the recording filename. My target as defined by my configuration is: target_dir /sec/media/cameras/frontdoor which works as recordings work just fine. As for the path itself it's a an external USB hard drive (formatted as ext4) mounted to /sec/media.
Beta Was this translation helpful? Give feedback.
All reactions