Motion - Preview Shots Patch

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' and 'Off' 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'.

Discussion and Comments

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.

-- AngelCarpintero - 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.

-- JoergWeber - 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.

-- WillCooke - 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.

-- KennethLavrsen - 03 Jan 2005
Topic revision: r10 - 27 Jun 2005, KennethLavrsen
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.