Difference between revisions of "AMF"

From MultimediaWiki
Jump to: navigation, search
m (mention another AMF format)
 
Line 1: Line 1:
 
* Extension: amf
 
* Extension: amf
 
* Samples: [http://samples.mplayerhq.hu/game-formats/amf/ http://samples.mplayerhq.hu/game-formats/amf/]
 
* Samples: [http://samples.mplayerhq.hu/game-formats/amf/ http://samples.mplayerhq.hu/game-formats/amf/]
 +
 +
 +
''Not to be confused with [[Asylum Music Format]]''
 +
  
 
AMF is a very simple video file format used in the game [http://www.mobygames.com/game/dos/manic-karts Manic Karts].
 
AMF is a very simple video file format used in the game [http://www.mobygames.com/game/dos/manic-karts Manic Karts].
Line 25: Line 29:
 
  u8  firstcolor                -- first color of palette to update (always 64)
 
  u8  firstcolor                -- first color of palette to update (always 64)
 
  RGB palette[256-firstcolor]  -- new palette entries (always 256-64 = 192 triplets), 6-bits [[DAC]] values
 
  RGB palette[256-firstcolor]  -- new palette entries (always 256-64 = 192 triplets), 6-bits [[DAC]] values
* 0x3F - video frame chunk (a video file has total num_frames chunks of this type) Contains compressed video data
+
* 0x3F - video frame chunk (a video file has total numframes chunks of this type) Contains compressed video data
 
* all other chunk types are ignored/skipped.
 
* all other chunk types are ignored/skipped.
  

Latest revision as of 12:45, 23 July 2011


Not to be confused with Asylum Music Format


AMF is a very simple video file format used in the game Manic Karts. Contains only RLE-encoded palettized video.

File Format

All numbers are little-endian. File begins with an 8-byte header:

u16  numframes    -- number of frames
u16  width        -- frame width
u16  height       -- frame height
u16  unknown      -- unknown/unused, always 2

and is followed by at least numframes + 1 frame chunks. Each frame chunk begins with a short header:

u8   type         -- chunk type
u16  size         -- chunk payload size (w/o this header)

and then followed by a chunk payload.

Observed chunk types:

  • 0x3E - palette chunk (always first chunk in file) Payload format:
u8  firstcolor                -- first color of palette to update (always 64)
RGB palette[256-firstcolor]   -- new palette entries (always 256-64 = 192 triplets), 6-bits DAC values
  • 0x3F - video frame chunk (a video file has total numframes chunks of this type) Contains compressed video data
  • all other chunk types are ignored/skipped.

Note: palette can not be changed during playback. Playback rate is about 10 fps.

Video Decompression

while input buffer is not exhausted
  tag = next byte of input
  tag is:
    <  0x20 : skip (tag) pixels
    == 0x20 : skip (DecodeLength) pixels
    <  0x3F : fill (tag - 0x21 + 2) pixels with the next byte of input
    == 0x3F : fill (DecodeLength) pixels with the next byte of input
    >= 0x40 : draw (tag)


DecodeLength loads variable-sized length value:

 length = 32
 repeat
   delta = next byte of input
   length += delta
 until delta != 0xFF

Trivia

The MANIC.AMF file has several BMP files attached at the end.