Nightlong FMV

From MultimediaWiki
Jump to navigation Jump to search

This is the video format used by Amiga version of Nightlong: Union City Conspiracy game.

Video comes in two flavours: 320x180 (with .fmv extension) and 640x360 (with .fmv2 extension). Frame is split into tiles (4x4 for 320x180 resolution, 8x8 for 640x360) and each tile can be either skipped or coded/updated with raw pixels.

Container format

FMV/FMV2 starts with 32-bit little-endian number telling the number of frames and a table of 32-bit numbers telling the frame sizes.

Frame data

Frame data for FMV is stored unpacked and FMV2 frames are packed with PowerPacker and can be distinguished by PP20 magic word at the start of the frame (it cannot happen in the ordinary frame data and thus can be used to detect FMV2 by content).

Frame data consists of several opcodes:

  • 0x80 (should be the first one if present and there's at most one such code) - palette update. Next byte is palette entries count minus one followed by the actual palette triplets. Only low 5 bits are used;
  • 0x20 signals this is a skip frame and no image data is coded;
  • 0x21 signals a row skip. The following byte tells how many lines starting from the current one should be skipped (including the current row). For either variant of FMV this value assumes 8-pixel rows (so for 320x180 video it should be halved);
  • 0x00 signals that current tile should be skipped;
  • 0x42 signals a raw tile with the following 16 or 64 bytes being raw pixels
  • 0x43 signals a sub-divided and partially updated tile. Each quarter starts either with 0x42 opcode signalling it is a raw sub-block and the following 4 or 16 pixels should be read from the stream, or the opcode is a combination of flags telling which quarter of sub-block (1 or 4 pixels) should be updated.