#762: import animated WebP as footage with its frames

Problem: an animated WebP (e.g. ffmpeg -c:v libwebp_anim) imported as a
still and showed only its first frame; probe_bytes handed every WebP to
the still path. Found while measuring #719.

Fix: a webp_anim module, following the animated GIF path. Probing reads
the RIFF chunk headers (VP8X animation and alpha flags, one ANMF per
frame) and describes a WebP with two or more frames as Video footage
(codec "WebP", alpha Straight or Ignore from VP8X). Frame delays give the
rate: delays within 1 ms of each other read as the standard rate they
round to (24, 25, 29.97...), else 1000 / gcd of the delays so uneven
timing is exact; delays of 10 ms or less count as 100 ms as in browsers.
Frames are decoded once with the image crate's WebP AnimationDecoder and
cached in the pool's existing GIF slot; gif_anim::Anim now keeps frame
starts as Ticks and serves both formats. Canvas x frames beyond the
existing memory cap is refused before decoding; a damaged tail keeps the
frames before it; a file without frames is a clear decode error. Still
WebP stays a still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vangel76
2026-10-11 12:29:26 +02:00
co-authored by Claude Opus 5.5
parent 9a7d3e7699
commit 5ba0c60a15
6 changed files with 372 additions and 30 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ trips and renders, checked by tests, not against After Effects), **partial** (na
| SVG | R | yes | — | good; pasting SVG/AI as shape layers (26.3) missing |
| GIF | R/W | yes | yes (animated) | good |
| BMP | R | yes | — | good |
| WebP | — | yes | — | beyond After Effects |
| WebP | — | yes (still; animated WebP as footage with its frames, timing and alpha, #762) | — | beyond After Effects |
| Targa `.tga` | R/W | none | none | Media Browser lists it but import refuses (gap 17) |
| DPX / Cineon `.dpx` `.cin` | R/W | none | none | Same; common in film VFX |
| Radiance `.hdr` | R/W | none | none | Same |