close
The Wayback Machine - https://web.archive.org/web/20120212055401/http://code.google.com/speed/webp/docs/riff_container.html
WebP - Google Code
My favorites | English | Sign in

RIFF Container

RIFF Container

This section provides information about the WebP file format for users who want to be able to save or parse these files. WebP uses a RIFF container. Currently, a WebP file consists of a RIFF header and one VP8 key frame. We are working on a more complete specification that will include more features, like metadata.

Current requirements for a valid WebP file (RIFF + VP8) are:

  • The "RIFF" chunk comes first, carrying the "WEBP" identifier for fileType.
  • Inside the RIFF chunk, the "VP8 " chunk must be the first chunk (we require it to be the first one, so that we may introduce new codecs features and check for them using magic number comparison at fixed position). The VP8 chunk must contain the VP8 bitstream for a single key frame - the raw image data. For compatibility with older programs, if the size of the VP8 bitstream is odd, a padding byte (preferably 0) should be appended inside the chunk, to make the chunk size even.
  • There may be other chunks in the RIFF chunk (e.g., added by a newer specification) that the decoder should ignore.
  • The RIFF specification requires that chunks starts at even offsets. If a size of a chunk is odd, it should be followed by a padding byte (preferably 0) for the next one to start at an even offset. Note that this padding is not included in the chunk size field.

The byte-level layout is:

0ffset Description
0 "RIFF" 4-byte tag
4 size of image data (including metadata) starting at offset 8
8 "WEBP" the form-type signature
12 "VP8 " 4-bytes tags, describing the raw video format used
16 size of the raw VP8 image data, starting at offset 20; should be even
20 the VP8 bytes

Note: All 32-bit sizes are in little-endian order.

For more information about RIFF container see the Wikipedia RIFF description or the RIFF specification.

1