Preview Shots Patch
Some people have built nice frontends to present their images created by motion on a web site for easy access. I would actually like to have a simmilar feature for my mpeg movies. The only drawback is: there's no way to know what is behind a movie unless you start the playback.
Description of Patch
This is where PreviewShotsPatch
steps in. This patch creates a jpeg image at the beginning of an event - right after pre_capture (if configured) to make sure the actual motion event is visible on the image. This image can be used as a thumbnail for the mpeg movie that is beeing created during the current event.
Now we are able to present our mpeg movies on a nice web-page. The visitor can see at a glance what he can expect when playing back a video.
I have not introduced a new config parameter. 'Output_normal'
is used instead. This paramteer has changed from boolean to text. 'On'
does the same as before. A new option 'First'
activates the preview shot mode where only the first picture of an event is saved. The user can configure the path and filename for the shots by using the existing option 'jpeg_filename'
Installation of Patch
The patch is available for motion-3.1.18_snap7 only.
Just copy the patch into the source directory and do a 'zcat preview_shot-3.1.18_snap7.diff.gz | patch -p1'.
Make sure 'output_normal' is set to 'on', 'off', or 'first'. Otherwise it will default to 'on'.
Nice patch Per , but there's an easy way to extract images from videos saved by motion using ffmpeg i.ex:
ffmpeg -y -t 00:00:00.01 -f singlejpeg -i /var/www/apache2-default/motion/cam2/01-20041015074115.mpg -f singlejpeg 'image.jpg'
So it can be trigger by onffmpegclose.
- 29 Nov 2004
Angel, we have had this idea on ML already. If pre_capture is turned on, you cannot know anymore where the actual motion has started and may miss what you intended to see.
- 29 Nov 2004
I've been looking at something like this, I'm trying to find something that will tell me how long a movie file is, I expect ffmpeg can do this, then using a command line like the one above to extract a frame from the middle of the movie, it's not perfect but it should give a better indication of what's going on in the movie that the first frame.
- 10 Dec 2004
I have decided to accept the feature as implemented now. It is simple and does an OK job without eating too many resources. If people want something more fancy it should be done outside Motion using a script that runs from onmpegclose.
I have changed the status of the patch to ReleasedSnapshot
. Note that it is included in MotionRelease3x1x18snap8
- 03 Jan 2005