mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-26 02:57:34 -06:00
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>