7. Handling Video Files
Sometimes it is necessary to read a sequence of images from a standard video file, such as .avi and .mov files.
In a scientific context, it is usually better to avoid these formats in favor of a simple directory of images or a multi-dimensional TIF. Video formats are more difficult to read piecemeal, typically do not support random frame access or research-minded meta data, and use lossy compression if not carefully configured. But video files are in widespread use, and they are easy to share, so it is convenient to be equipped to read and write them when necessary.
Tools for reading video files vary in their ease of installation and use, their disk and memory usage, and their cross-platform compatibility. This is a practical guide.
7.1. A Workaround: Convert the Video to an Image Sequence
For a one-off solution, the simplest, surest route is to convert the video to a
collection of sequentially-numbered image files, often called an image
sequence. Then the images files can be read into an ImageCollection by
skimage.io.imread_collection. Converting the video to frames can be done
easily in ImageJ, a cross-platform, GUI-based
program from the bio-imaging community, or FFmpeg, a
powerful command-line utility for manipulating video files.