Dranoweb
Posts: 147
Joined: Thu Mar 20, 2014 3:01 pm

Motion MMAL - Custom Text Stamp from text file.

Sun Sep 21, 2014 1:45 pm

Logic tells me this shouldn't be a difficult task, but it appears from a great deal of research (a very great deal), that no-one seems to have done it.

I would like to inject extra information into the "Text Display Settings" area of the motion (or motion-mmalcam.conf) file.

To clarify, I would like motion to add to the text stamp on the file - information from a text file.
I have a DHT22 sensor collecting and logging temp and humidity info to a text file already, but would like to have motion add this info into the text stamp as well.

At present, I have a script that databases my images against sensor logs, in an attempt to correlate conditions with motion events (for a research project) - but this task would be far more efficient if all the info was in one place.

My setup:
raspberry Pi B+ module.
running rasbian (version unknown after last apt-get upgrade 24hrs before this post)
NoIR cam module.

currently running motion-mmal API, from the latest build I could dredge up.

I acknowledge that this may not be a feature of motion at present, but it's something I would like to work towards.

Dranoweb
Posts: 147
Joined: Thu Mar 20, 2014 3:01 pm

Re: Motion MMAL - Custom Text Stamp from text file.

Tue Sep 23, 2014 9:50 am

any response would be appreciated - even a "I don't know how" type response might lead me in the direction of self discovery.

User avatar
dozencrows
Posts: 172
Joined: Sat Aug 04, 2012 6:02 pm

Re: Motion MMAL - Custom Text Stamp from text file.

Thu Sep 25, 2014 12:58 pm

This is probably more of a general motion feature request than one specific for the Pi camera. However if it was available, it would need integrating.

It could be done by providing the name of a file that is read for the text stamp context by motion when each image is captured - however that may have synchronisation and performance issues (e.g. reading from SD card while trying to maintain a good framerate).

It would be better done via other more direct methods of Linux inter-process communication. Unfortunately I'm not able to spend any time on Motion MMAL for the forseeable future, so can't say when or if I would try this feature.

Have you looked into the database features in Motion? http://www.lavrsen.dk/foswiki/bin/view/ ... _Databases

You might be able to use this to create records for image capture, and have your sensor capture also add records into the same database - then craft suitable SQL queries to bring that all together. That might be a neater solution than a scripted approach. It would certainly give you a more flexible way of processing and presenting the data than baking in text to the images themselves. E.g. you could use ImageMagick to overlay the text onto the images as a post-processing operation.

Dranoweb
Posts: 147
Joined: Thu Mar 20, 2014 3:01 pm

Re: Motion MMAL - Custom Text Stamp from text file.

Thu Sep 25, 2014 3:09 pm

Some food for thought. Ill look into the SQL options when I'm back at a desktop pc. Thanks for taking time to reply.

RpiName
Posts: 712
Joined: Sat Jul 06, 2013 3:14 am

Re: Motion MMAL - Custom Text Stamp from text file.

Thu Sep 25, 2014 7:39 pm

Dranoweb wrote:Logic tells me this shouldn't be a difficult task, but it appears from a great deal of research (a very great deal), that no-one seems to have done it.

I would like to inject extra information into the "Text Display Settings" area of the motion (or motion-mmalcam.conf) file.

To clarify, I would like motion to add to the text stamp on the file - information from a text file.
I have a DHT22 sensor collecting and logging temp and humidity info to a text file already, but would like to have motion add this info into the text stamp as well.
So you want to overlay text from a file when a motion event occurs? You can do exactly that with UV4L + raspicam driver + original Motion: keep your file updated with the data you want to overlay and configure motion to dynamically enable or disable the driver text-overlay functionality (the driver can be configured to read the text overlay informations from that file). For more informations look at Example #9 here:
http://www.linux-projects.org/modules/s ... e&artid=16

lowflyer
Posts: 78
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion MMAL - Custom Text Stamp from text file.

Fri Sep 26, 2014 6:47 am

Hi!

You might look at adding exif metadata to the jpg images after they have been saved by motion. This doesn't help for adding data directly to movies, but using the "output_pictures best" and "picture_filename preview" options in your motion config, you can use the still as a preview for the movie and extract the exif data as well. Using exif does have the advantage that you can pre-encode the secondary buffer and save even more cpu :).

If you use php this should do the job... https://github.com/lsolesen/pel/blob/ma ... elJpeg.php

I haven't tried it, but https://wiki.gnome.org/Projects/gexiv2/PythonSupport looks as is it should work in Python.

Hope this helps.

Dranoweb
Posts: 147
Joined: Thu Mar 20, 2014 3:01 pm

Re: Motion MMAL - Custom Text Stamp from text file.

Fri Sep 26, 2014 7:30 am

Thanks - more food for thought. As I'm self employed, I have not had time to sit down and read through all the suggestions. But they sound promising and I should find a few hours this weekend to test them all out.
I have retreived my camera box from the test site and will experiment.

Return to “Camera board”