Stop-Motion with ffmpeg
I recently wanted to do some stop motion video with my children and looked around for some suitable software. There were a couple of packages. The open-source options didn’t work too well for me and the commercial options were a bit expensive for some short-term Sunday afternoon fun. Instead I decided to try to use ffmpeg
which (of course) has the ability to splice together a series of images into a video.
The camera we used was an old Canon point-and-click fixed into a tripod. The camera was set to no-flash and a two-second delay. This way, when pressing the button, should there be any movement, the camera has enough time to settle-down before it takes the shot.
I plugged in the camera and then downloaded the photos using the Linux gphoto2
tool. gphoto2
is able to remote-drive a camera, but our camera is not able to do this unfortunately. Instead I just took many photos to the internal card and then connected the camera and downloaded to a directory.
The photos’ filenames are in lexical as well as chronological order so it is easy to lace them together into a video using ffmpeg
.
ffmpeg -framerate 10 \
-pattern_type glob -i '*.JPG' \
-vf scale=640:-1 -c:v libx264 -pix_fmt yuv420p \
out.mp4
The scale argument means you get a 640 x ??? output and the framerate controls how many of the stills are shown per second.
This produces something like this;