Extracting Digital Camera Multi-burst Images

Multi-burst image of trebuchet firing
Multi-burst image of trebuchet firing

Digital camera, at least the ones I have, include a “multi-burst” (Sony DSC-H5 and DSC-F717) or “multi-continuous” (Casio EX-Z850) shutter mode that takes a bunch of pictures in quick succession, then combines them into a single JPG image file.

The Sony cameras create a 4×4 array. This image of a small trebuchet comes from the F717 and is 1280×960, so each sub-image is 320×240. The time between images is 1/30 second and the shutter speed is 1/125 second.

Extracting the sub-images is trivially easy with the ImageMagick convert function:

convert -crop 320x240 dsc02594.jpg shot-%02d.jpg
Sub-image shot-11.jpg from the sequence
Sub-image shot-11.jpg from the sequence

You must specify the size of the sub-images to extract, which you can determine by RTFM or simple division, and convert extracts all the tiles into files named, in this case, shot-00.jpg through shot-15.jpg. The files appear in left-to-right, top-to-bottom order, which is most likely the sensible way for cameras to store them.

The C printf-style format string %02d forces two-digit sequence numbers. You can omit that and the sequence will start with shot-0.jpg, but you must then contend with the usual hassles of shot-1.jpg and shot-10.jpg.

Can you tell the designers were computer geeks?

With 16 separate images in hand, you can have your way with them, using all your usual image-manipulation tools.

ImageMagick can convert the images into an animated GIF:

convert -delay 50 shot-*jpg shot-ani.gif
Animated GIF from separate images
Animated GIF from separate images

That’s nigh onto 7 MB of image, which seems excessive for what it is, but there you have it. Obviously, you can de-res the images to fit the space available.

The -delay 50 option should set the frame delay to 50 ticks at the default 100 ticks per second, but some display software ignores the frame rate within the file. Assuming, that is, that the usual spam filters don’t swat animated GIFs right out of the bitstream.

You can also convert the images into a movie, as I discussed in more detail there. The ffmpeg program does a fine job of it:

ffmpeg -r 3 -i shot-%02d.jpg shot.mp4

Actually, convert can do that all by itself if you install mpeg2encode.

One cannot upload movies to one’s free WordPress blog without buying a space expansion, so you’ll have to take my word that it works.

The Sony cameras provide control over the interval between the images, allowing 1/30, 1/15, and 1/7.5 second intervals, but the Casio evidently just does the best it can. If you know the interval, you can determine interesting things like velocity and acceleration, so that’s something to look for when you’re buying a camera.

Perhaps you can calibrate your camera using a pendulum?

Memo to Self: Use the tripod!