Animation Magic ANI
- Company: Animation Magic Inc.
This is an animation format containing paletted video and raw PCM.
Container format
The animation files has the following parts:
- container header
- frame offsets (from the palette end)
- palette in RIFF Palette format
- video and audio chunks interleaved
Container header (all integer values are little-endian):
4 bytes "ANI " 4 bytes total data size 4 bytes "hdr " 4 bytes unknown, should be always one? 4 bytes version (1 or 2) 2 bytes frames per second (usually 10) 4 bytes audio sampling rate 2 bytes (version 2 only) number of channels (always 1 for version 1) 2 bytes (version 2 only) bits per sample (8 or 16, always 8 for version 1) 2 bytes frame width 2 bytes frame height 4 bytes total number of frames 4 bytes unknown 4 bytes audio chunk size (for version 1 it should be sampling rate divided by fps) 4 bytes unknown
The header is followed by 32-bit start offsets for the frame (frame contains both video and audio part), the offsets are calculated from the end of palette.
RIFF Palette format is specified in RIFF specification section "Palette File Format".
Frames contain the following data: 32-bit video chunk size, video chunk payload, 32-bit audio chunk size, audio chunk payload (raw PCM).
Video compression
Video compression is intra-only and RLE-based with number of possible colours limited to 128. Colour 0 is always transparency colour.
The compression is simple: read input byte, if its value is below 0x80
then output it as is, otherwise the actual colour value is low 7 bits and you need to read a run value in the following byte (run value of zero means to fill the rest of the current line with the colour).