The FLI format is intended for storing an animated sequence in the resolution 320*200 with 256 colors. The newest version of FLC can utilize also higher resolutions (640*480 or more). Each individual frame can have its own pallet. For achieving a higher compression of the file, there is used the so-called delta compression for coding differences between two subsequent frames. This method is effective for small dynamic changes (where the changes in subsequent frames are small); in case the following frame is different, differences can be even bigger than the frame itself, and thus it is stored a non-compressed frame. In the end, the frames are still coded using RLE compression.

Description of the FLI format

     The FLI file contains a 128-bit header, after which follows a sequence of images. The first image is compressed by the RLE compression. Other frames are coded only against the previous part. There is also here a special frame reflecting the changes between the last frame and the first frame.

Header of the FLI file:

Offset Length Meaning
0 4 The real length of the FLI file.
4 2 Set on AF11 (hexadecimal).
6 2 The number of frames in the FLI file, maximally 4000.
8 2 The width of the screen (e.g., 320).
10 2 The height of the screen (e.g., 200).
12 2  The depth of color in bits per pixel (e.g., 8 means that the number of colors is 2 to 8, meaning 256).
14 2  Set on 0.
16 2  The speed of animation, meaning the time between two frames
18 4  Set on 0.
22 4  Set on 0.
26 1  left for later amendments.

Later on follow the individual frames, with each frame having its extra Frame Header

Offset Length Meaning
0 4  The size in bytes of this frame. It should not be less than 640 KB.
4 2  Always F1FA (hexadecimal).
6 2  The number of parts in the frame.
8 8  Reserved for the future, now only zeros.

After the Frame Header, follows a section containing the data of the frame. First goes the color bitmap from the previous frame. Then goes the data part containing the changed pixels. If the frame is absolutely identical to the previous one, then there are no parts here.
The following sections have this header :

Offset Length Meaning
0 4  The size of this section in bytes
4 2  The type of the section

The FLI files have the following types of sections :

11 FLI_COLOR Compressed color bitmap
12 FLI_LC  (Line compressed) -- coding the difference of pixels from the previous frame
13 FLI_BLACK Set the whole screen to the color 0 (can only be in the first frame).
15 FLI_BRUN The bytewise run-length compression only the first frame
16 FLI_COPY Identifies the non-compressed 64000 bytes in the case that in the compression we got a larger file than the given number of bytes; so we store the non-compressed frame.


     The first two bytes specify the number of colors in this section. These follow immediately after them. The first byte says how many colors have to be omitted. The other two bytes say how many colors are changed. If the byte is zero, it is interpreted as 256. The following three bytes are for every changed color (R, G, B).


     This is the most frequently occurring section. The first 16 bits specify from which line of the upper corner of the screen we start (e.g., if the change is only in the bottom part of a frame with 200 lines, so here it is the number 100). The following two bytes specify the number of changed lines, after that there follows the series of data of the changed lines. Each line is compressed separately. The first byte of the compressed line is the number of packets of the line. If the line is unchanged (meaning: equal to the previous frame), this number is equal to 0. The format of an individual packet is as follows:

Offset  Meaning
1 skip_count
1 size_count

     Skip count has the size 1 byte. If the line is longer than 255 pixels, it is split into two packets size_count is also 1 byte, specifying the size of the following data.

     In the worst case, the image can have an FLI_LC of 70 KB. However, this exceeds 60000 bytes, compression is not effective, and we store this frame as FLI_COPY.


     This section is very simple. No data is associated with it, and only the first frame can have this section.


     Similarly as with the FLI_LC, this section is without jumps. In this section, they follow data of the first line, and then line by line the others. The first byte specifies the number of packets in the line. The format of the packet is as follows:


Ofset  Meaning
1 size_count

     If the size_count is bigger than 0, then the data comprises bytes with a length of size_count times. If the size_count is zero, then there is here the size_count bytes which are copied to the screen. In the Autodesk Animator, if the compressed data are bigger than 60000 bytes, then they are stored as FLI_COPY.


     Here is a sequence of 64000 bytes for direct writing on to the screen.

FLI_DELTA has the number 7.

    The first two bytes (words) specify the number of subsequent compressed lines. After this there go the data of the changed lines, always starting with the first line. Each line is compressed individually. The first two words for each compressed line specify the number of packets in the line. If the number of packets is negative, then we skip over the line. If the number of packets is positive, then we decode the packets as in FLI_LC.

FLI_256_COLOR has the number 4.

    The first two words specify the number of packets in this section. The first byte of the packet specifies the number of omitted colors. The following byte specifies how many colors are to be changed. If the value is 0, then it means 256. Next, there are a group of three bytes for all the colors (one for red, one for green, one for blue). The difference between the FLI_256_COLOR (number 4) and the FLI_COLOR  (number 11) is the range, where at the value of number 4 the range is from 0 to 256, and at the value of number 11, the range is from 0 to 63.