Fraps

From MultimediaWiki
Revision as of 21:26, 8 March 2008 by Multimedia Mike (talk | contribs) (header section)
Jump to navigation Jump to search

The Fraps video codec is used to store in real-time data that is captured from high frame-rate computer games played on Windows PCs. There are 5 known versions of the codec: 0, 1, 2, 4, and 5; version 3 might exist but no samples have been seen in the wild. All versions occur with the same FourCC.

Header Section

Version 0

Version 1

Version 2

All data is stored in 32-bit little-endian words. If frame size is 8 bytes long then repeat previous frame otherwise proceed to frame decoding.

Frame header

 bytes  0- 7 - should be ignored
 bytes  8-11 - 'FPSx'
 bytes 12-15 - offset to the Y plane (minus 8), should be always 16
 bytes 16-19 - offset to the U plane (minus 8)
 bytes 20-23 - offset to the V plane (minus 8)

Huffman tree construction

Huffman tree is built by canonical algorithm: sort symbols by their counts in ascending order, create node by joining two first nodes (or leaves), and place it just before the node with count greater than this new node.

WARNING If symbols have zero count they should also be included into the tree. So Huffman tree for this codec always has 256 leaves.

Plane format

First 256 words (1 kB) of plane data are symbol frequencies used to construct Huffman tree. The rest of data represents bitstream packed into 32-bit words, MSB first.

Lines are coded as difference to the previous lines. For Y plane the line with index -1 should contain all zeroes, for chroma planes - all 128.

Version 4

Version 5