Saturday, 8 June 2013

Need script: latest JPEGs to video, then delete old JPEGs

Need script: latest JPEGs to video, then delete old JPEGs

I have an IP cam which uploads JPEG pictures to an FTP folder on my Arch Linux box whenever it detects movement in the room it is looking in. It uploads a JPEG every second until all motion activity stops.
It names the JPEG files in the following way:
Disected, it means: name-of-camera(inside)_1_YEAR-MONTH-DATE-TIME-SECONDS_imagenumber.jpg
I want a script that can make a 1 frame-per-second video from them (easy with ffmpeg I know), BUT, it must be clever enough to only make the video from the images that are within 2 seconds of each other, then delete those jpegs that it used. I say "2 seconds of each other" in-case of network latency where it misses one frame.
Any future images that are within 2 seconds of being taken, should become its own video. So it should basically be able to make videos from each 'event' of motion the camera saw.
I know programs like zoneminder and motion can do this, but I want to design a script instead. Any ideas much appreciated.

No comments:

Post a Comment