Merge multiple JPEGs into one Video

I am capturing images from a web came in 1 second intervals. I would like to find a way to create a video of these images. Since the camera is still and there can be long periods of time when the picture will not change, I'd like to be able to discard what are essentially duplicate images to be able to shorten my resulting video.


This will take all .jpeg files in the directory and create an AVI video.

mencoder "mf://*.jpeg" -mf fps=20 -o out.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=640

Detecting "duplicate" images adds some complication. The findimagedupes program may be an option.