The Filmstrip file format
A "Filmstrip" is a graphic file format that contains multiple images with the same size. More accurately, it contains multiple frames of an animation sequence. The Filmstrip file format was introduced with Adobe Premiere and it is supported by several other products by Adobe (notably After Effects and Photoshop). Filmstrip files usually have the extension .FLM (under Microsoft Windows).
At the right is a section of a filmstrip file with three frames. You can click on the image to get a larger view (use the browser's "Back" button to return to this page).
Note that Adobe also documents the Filmstrip file format. When going into details, their document is different than mine. I think Adobe's description is inaccurate, although the images in their examples are correct (which means that, methinks, their description does not match their pictures).
The record that describes the size of all the frames is at the end of the Filmstrip file (I refrain from calling it a "trailer" because the Filmstrip file format uses this term for something completely different). To access this definition record, you need to seek to the end of the file, go back 36 bytes and read in the 36 last bytes of the file.
Each frame contains a 32-bit true-colour uncompressed image, plus an optional fixed size "leading area" (more on this below). This design allows you to directly seek to (and read) any frame from the Filmstrip file, without any need for an "index" with the file offsets of each frame. It also means that a Filmstrip file is typically very large.
The image in each frame is a sequence of pixels, there are width × height pixels in a frame. Each pixel holds four bytes for the Red, Green, Blue and Alpha channels, in that order.
Following each image is an arbitrarily sized "leading area". The leading area is a 32-bit uncompressed image with the same width as that of a frame and a height that can be read from the definition record. The leading area may be absent (i.e., zero-height). For Adobe Premiere, the leading area is a 16 pixels high light grey bar which contains a timecode and a frame number (in SMPTE format). "Leading", by the way, is a printer's term that specifies the space that is added between two lines of text. In traditional typesetting with lead type, lines of text were spaced by inserting strips of lead between two rows of packed letters. With a font of 10 pt (points), the base lines of two consecutive lines are usually 12 pt apart, meaning that there is 2 pt "leading". In the context of the Filmstrip format, the term "leading" may be confusing: the "leading area" is below every image, not between two images. That is, there is another "leading area" below the last image.
To locate a particular frame:
- seek to: (frame × width × (height+leading) × 4)
- then read: (width × height × 4) bytes
As said before, the Filmstrip ends with a definition record (36-bytes in size), whose definition is below:
typedef struct tagFLMRECORD { char signature[4]; // must contain the letters 'Rand' long numFrames; // number of frames in file short packing; // packing method, should be 0 short reserved; // reserved, should be 0 short width; // width of a frame (in pixels) short height; // height of a frame (in pixels) short leading; // height of leading area (in pixels) short framesPerSec; // frame rate (fps) char spare[16]; // undefined, should be zero } FLMRECORD;
All 2-byte and 4-byte words are stored in Big Endian format (High Byte First, Motorola format, or whatever one calls it).
The signature field is used to test the validity of a Filmstrip file. Only one packing method is defined: zero (which stands for "no packing"). All sizes (width, height, leading) are in pixels. The frame rate is purely informational, but it relates (of course) to the timecode values in de leading areas. Note that the filmstrip format cannot store fractional frame rates, such as the common rate of 29.97 FPS (for NTSC); instead a fractional rate is rounded to the nearest integer value.
For the experimenters amongst you, a small program that converts a Filmstrip file to a ZSoft PCX file is available here (10 KiB). The program is pre-compiled for DOS (so it runs on any Microsoft OS and it should run in a DOS emulator like dosemu or xdosemu in Linux) and it comes with source code in ANSI C. Note that the code assumes a Little Endian machine (that is, an Intel 80x86 compatible processor, for example).
Adobe's specification says that there is a "trailer" frame with the same width as a frame and a height of 16 rows below the "leading area" of the last frame (but before the definition record). This trailer would contain a diagonal yellow & black pattern —at least, if the Filmstrip file was made with Adobe Premiere. I have never seen this pattern though, so perhaps it was dropped from more recent versions of Adobe Premiere.