Picture Sequences

This chapter deals with sequences of single pictures in various formats. You need a recent version of ImageMagick installed to make the modules work. We will demonstrate how to make animations from a bunch of pictures as well as splitting a movie into individual frames.

- animations from picture sequences

- splitting a movie into frames

animations from picture sequences

-x imlist

There is a nice tool out there called motion that generates single picture snapshots from a video4linux device. We will use this tools as an example to generate the pictures and convert the pictures to a movie. Assuming we have a webcam on `/dev/video1`, try

motion -d /dev/video1 -Q

for a couple of seconds to generate snapshots in a directory try, that is based on time formats. The current year `2002/` is assumed to be the top level directory.
The import module -x imlist simply takes a list of frames that will make the final movie. One picture/frame per row. Generate the list with

find 2002/ ! -type d | sort > list

and start transcode to convert the sequence to a XviD codec movie with. But wait a second. There is no auto-probing for this mode. Use tcprobe on a single image and write down the frame parameter. We find

`andromeda:transcode>tcprobe -i 2002/04/24/23/04/39-03.jpg
[tcprobe] JPEG image
[tcprobe] summary for 2002/04/24/23/04/39-03.jpg, (*) = not default, 0 = not detected
import frame size: -g 352x288 [720x576] (*)
frame rate: -f 1.000 [25.000] frc=0 (*)
no audio track: use "null" import module for audio
`

which provides the required information to start

transcode -i list -x imlist,null -g 352x288 -y xvid,null -f 1 -o movie.avi -H 0

We choose a frame rate of one frame per second and switch auto-probing and audio (import/export) completely off. This will generate our fancy surveillance movie.

splitting a movie into frames

-y ppm

Native support for writing to uncompressed PPM pictures is provided by the "-y ppm" module.

transcode [...] -y ppm

will extract all video frames to `frame-00000.ppm, frame-00001.ppm, ...` but will quickly fill up your hard disk. Audio is discarded unless you provide a filename with option "-m". Other native support is available for PGM "rawbits" image data with option "-K" and file extension "png", which requires less space.

-y im

For writing compressed frames for a file format supported by ImageMagick and export module -y im we must provide an identifier with option "-F".

transcode [...] -y im -F tiff -c 0-20

writes 20 video frames as TIFF image format pictures to the files

`frame.000000.tiff, frame.000001.tiff, ..., frame.000019.tiff`.

Other possible and useful image formats are "jpg" and "png". Please see the ImageMagick documentation for supported image formats. It is possible to change the prefix with option "-o".

Last modified: Thu May 16 12:51:42 CEST 2002