The Metadata in WEBP (.webp) files (Under construction)¶
Please note: Four bytes words in caps have special significance in this document, which are called Chunk headers, and appear exactly same in the original WebP file.
This page brief is about the WebP type image file container. The official specification is here: https://developers.google.com/speed/webp/docs/riff_container
What is WebP?¶
Webp is a structured image container format (similar to the RIFF video format) issued from Google based on technology it acquired from ON2 Technologies.
How it is structured?¶
Everything in WebP is structured in Chunk, sub-chunk hierarchy. Every chunk contains ChunkID, ChunkSize, and ChunkData. First four bytes of a WebP file type must be ASCII values corresponding to the letters RIFF followed at offset 8 (in bytes) by the ASCII values corresponding to the letters WEBP. This is the ChunkId parent of every other sub-chunk. Similar to the rules dominating RIFF structure which describe how a typical RIFF and WebP file are:
- Every chunk should have ChunkId(four bytes), ChunkSize(four bytes). Do not include size of ChunkId and ChunkSize in ChunkSize.
- ChunkData having odd number of bytes should be padded with one more dummy byte, and ChunkSize is always even.
- ChunkData can be simple data like animation frames, or another Chunk having similar structure as parent Chunk.
- Every chunk will have data which has to be decoded according to either predefined schema or variable size metadata chunks.
Recovering the metadata in a WebP file¶
Exiv2 seamlessly parses and presents the metadata in a WebP file in the same way that it does for JPEG, TIFF, PNG and other formats. For example:
509 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pa --grep Model/i test/data/exiv2-bug1199.webp Exif.Image.Model Ascii 12 NIKON D5300 510 rmills@rmillsmbp:~/gnu/exiv2/trunk $Options are provide by the exiv2 utility to insert, modify and delete delete metadata. See man (1) exiv2 for more information: http://www.exiv2.org/manpage.html
Examining the structure of a WebP file¶
Exiv2 supports the options -pS and -pR for WebP files. The option -pS reports the structure of a file. For example:
507 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pS test/data/exiv2-bug1199.webp STRUCTURE OF WEBP FILE: test/data/exiv2-bug1199.webp Chunk | Length | Offset | Payload RIFF | 187526 | 0 | WEBP VP8X | 10 | 12 | ,........ ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. EXIF | 12040 | 172614 | II*........................... . XMP | 2864 | 184662 | <?xpacket begin="..." id="W5M0MpThe options -pR prints the structure of a file and recursively descends into XMP, ICC, and EXIF chunks. For Example:
1202 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pR test/data/exiv2-bug1199.webp STRUCTURE OF WEBP FILE: test/data/exiv2-bug1199.webp Chunk | Length | Offset | Payload RIFF | 187526 | 0 | WEBP VP8X | 10 | 12 | ,........ ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. EXIF | 12040 | 172614 | II*........................... . STRUCTURE OF TIFF FILE (II): MemIo address | tag | type | count | offset | value 10 | 0x0100 ImageWidth | LONG | 1 | 1200 | 1200 22 | 0x0101 ImageLength | LONG | 1 | 800 | 800 ... 166 | 0x8769 ExifTag | LONG | 1 | 316 | 316 STRUCTURE OF TIFF FILE (II): MemIo address | tag | type | count | offset | value 318 | 0x829a ExposureTime | RATIONAL | 1 | 814 | 814/0 330 | 0x829d FNumber | RATIONAL | 1 | 822 | 822/0 ... 498 | 0x920a FocalLength | RATIONAL | 1 | 894 | 894/0 510 | 0x927c MakerNote | UNDEFINED | 3826 | 902 | Nikon.....II*.....9.+...$...... ... STRUCTURE OF TIFF FILE (II): MemIo address | tag | type | count | offset | value 10 | 0x002b | ASCII | 36 | 698 | 48 49 48 48 0 0 2 0 0 0 0 0 0 0 ... 22 | 0x002c | ASCII | 1157 | 734 | 48 49 48 49 35 0 128 2 170 1 0 0 ... ... 682 | 0x0024 | UNDEFINED | 4 | 65536 | ... END MemIo 522 | 0x9286 UserComment | UNDEFINED | 44 | 4728 | ........ ... ... 798 | 0xa420 ImageUniqueID | ASCII | 33 | 4788 | 090caaf2c085f3e102513b24750041aa ... END MemIo 178 | 0x8825 GPSTag | LONG | 1 | 4822 | 4822 ... 5144 | 0x0201 JPEGInterchangeFormat | LONG | 1 | 5178 | 5178 5156 | 0x0202 JPEGInterchangeFormatLeng | LONG | 1 | 6861 | 6861 END MemIo XMP | 2864 | 184662 | <?xpacket begin="..." id="W5M0Mp 1203 rmills@rmillsmbp:~/gnu/exiv2/trunk $
Metadata types in WebP¶
The current WebP specification current has metadata chunkIDs defined for EXIF, XMP, and ICC profiles. IPTC data structures are not normally found in WebP files. However the exiv2 utility is equipped with functions which convert XMP and EXIF metadata into equivalent IPTC Keys. These can be reported. For example:
511 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pi test/data/exiv2-bug1199.webp Iptc.Application2.ObjectName String 10 Stonehenge Iptc.Envelope.CharacterSet String 3 G Iptc.Application2.Byline String 11 Robin Mills Iptc.Application2.BylineTitle String 10 Stonehenge Iptc.Application2.Caption String 12 Classic View 512 rmills@rmillsmbp:~/gnu/exiv2/trunk $Please be aware that this is an artefact of the exiv2 utility. The IPTC metadata reported above is not stored in the file and therefore not displayed by metadata applications which do not use libexiv2. For example: Adobe Bridge has metadata inspectors which will not present those IPTC tags.
WebP Specifications Links¶
Webp container specification https://developers.google.com/speed/webp/docs/riff_container
VP8 format specification https://tools.ietf.org/html/rfc6386
VP8L format specification https://chromium.googlesource.com/webm/libwebp/+/master/doc/webp-lossless-bitstream-spec.txt
Updated by Ben Touchette over 5 years ago · 11 revisions