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.
In order to analise the similarities between your still images you can use the
compare command from
imagemagick package. You will probably need a
-metric parameter. I personally didn't play much with it, but you can read about it here:
-metric type Output to STDERR a measure of the differences between images according to the type given metric.
To make a video you are also able to do this with the
libav package. The only possible downside of it is that it requires for all the files to be named sequentially, without any gaps and they have to start with 1. You you will need a script to prepare the directory, before you are able to run the command.
sequential-link (Script !not! written by me)
#!/usr/bin/python """ Create symlinks from a set of paths returned by glob for FFmpeg to read. Thanks to: http://programmer-art.org/articles/tutorials/ffmpeg-time-lapse """ import os import glob import sys files = sorted(glob.glob("/home/txoof/temp/779OLYMP/*.JPG")) outdir = "/home/txoof/temp/output/" if not os.path.exists(outdir): os.makedirs(outdir) for i, f in enumerate(files): os.symlink(f, os.path.join(outdir, "%06d.jpg" % (i + 1)))
You'll need to edit the directories in this script by hand, just set the directory where your files are, and directory where the links will be (that can be a temp directory, and will then be deleted).
After that is done you will have a directory full of files starting with 000001.jpg and you can run the following command:
avconv -i /home/txoof/temp/output/%06d.jpg -c:v copy -an video.avi