UMV

From MultimediaWiki
Jump to navigation Jump to search

UMV is a full motion video file format used in several DOS games like Are You Afraid of the Dark? The Tale of Orpheo's Curse and Dracula Unleashed.

The format is split into individual packets, with no special header. Each packet starts with 4 bytes packet size (big-endian, including the 4 bytes for the size itself), followed by the size value of the previous packet (0 if there is no previous one). The following 4 bytes are packet type.

Packets are grouped together, each group starting with packet type 2 and usually ending with packet type 0x80 (which usually has reported size 0 and occupies all the space until the next packet group or file end). Additionally there may be alternative scenes stored after the main video. Alternative scenes data has different chunk types but video compression remains the same.

There are the following packet types known:

  • 0x01 -- video header
  • 0x02 -- packet group header, its first 32-bit value is an offset to the start of the next packet group
  • 0x04 -- delta frame
  • 0x10 -- intra frame for alternative scenes
  • 0x20 -- intra frame
  • 0x40 -- global palette
  • 0x80 -- PCM audio
  • 0x100 -- probably alternative scenes header
  • 0x200 -- probably offsets for alternative scene frames

Video header usually consists of ten 32-bit words:

  • unknown
  • unknown
  • video width (160)
  • video height (100)
  • framerate?
  • audio sample rate
  • unknown
  • unknown
  • offset to alternative scenes data (or 0 if not present)
  • unknown

Palette chunk format:

  • 32-bit start colour
  • 32-bit number of colours to update (for Dracula value 255 actually means 256 colours)
  • full-scale palette data

Frame data starts with 32-bit frame number, 32-bit local offset to audio data (local means offset inside the packet group) and some additional fields: intra frames (type 0x20) have palette data offset, alternative intra frames (type 0x10) have three additional fields, delta frames have no additional information.

Intra frames are stored in raw form (i.e. usually 16000 bytes for 160x100 frame) followed by palette change data (the same as palette chunk).

Delta frames employ rather simple compression for conveying pixel change information: at first a byte is read and treated as a bitmask (MSB first) telling to update the following 0-8 pixels with the values read from the bitstream. E.g. 02 2A will skip 6 pixels, set the following pixel to 0x2A and skip one more pixel. There's a special case though: code 0x05 may be used to signal long skip, so 05 00 aa bb means updating two pixels and 05 nz aa bb means skipping (aa * 256 + bb) * 8 pixels.