IIRC, WebP uses VP8 to encode images (in lossy mode). I forget how it encodes in non-lossy mode.
The container of a WebP is a RIFF container (see WebP Container Specification).
The MIME type is “image/webp
”.
Converting to a WebP file
You can convert images fairly easily with FFmpeg.
ffmpeg -hide_banner -i $FILE -quality 80 -preset photo -compression 6 -y out.webp
You might use the -preset text
or -preset picture
for digital images.
ffmpeg -hide_banner -i $FILE -lossless 1 -compression 6 -y out.webp
The official converter I think is cwebp
, but I don’t really use that.
Set XMP metadata
webpmux -set xmp metadata.xmp image.webp -o output.webp
I think this doesn’t inspect the contents of metadata.xmp
at all, and just embeds it directly.
You may want to gzip the file afterward, if only to compress the XMP metadata.
Todos for this page
- Show how I make animated WebP files using FFmpeg
- Show an animated WebP and a static WebP