I can't find a way to specify loop_count for WebpAnimEncoder.
The following in Google libwebp seems to be undefined in pywebp:
290 // Animation parameters.
291 struct WebPMuxAnimParams {
292 uint32_t bgcolor; // Background color of the canvas stored (in MSB order) as:
293 // Bits 00 to 07: Alpha.
294 // Bits 08 to 15: Red.
295 // Bits 16 to 23: Green.
296 // Bits 24 to 31: Blue.
297 int loop_count; // Number of times to repeat the animation [0 = infinite].
298 };
...
433 // Global options.
434 struct WebPAnimEncoderOptions {
435 WebPMuxAnimParams anim_params; // Animation parameters.
436 int minimize_size; // If true, minimize the output size (slow). Implicitly
437 // disables key-frame insertion.
438 int kmin;
439 int kmax; // Minimum and maximum distance between consecutive key
From an email:
See also: https://developers.google.com/speed/webp/docs/container-api#webpmuxsetanimationparams