Can I disable frame dispose at already exsisting animated webp file via webpmux?

219 views
Skip to first unread message

Aru

unread,
Jul 22, 2023, 2:13:57 PM7/22/23
to WebP Discussion
Hello, I'm trying to disable frame dispose on  pre-made animated webp file. I am relatively ignorant to programming, and there are no guide for webpmux and frame disposing so I'm asking for a help here. i tried to navigate the method and checked webpmux document several times, but the option related to  frame dispose seemed like only working per frame. Can I disable frame dispose on every frame from premade animated webp file? Thank you.

Yannis Guyon

unread,
Jul 24, 2023, 4:18:17 AM7/24/23
to WebP Discussion, Aru
Hi,
You are correct, the webpmux binary has no flag for changing the dispose method of an already animated WebP file.
I suggest uncompressing your WebP animation to one PNG per frame using the anim_dump binary, and then using webpmux with the -frame +[ms]+0+0+[dispose] flag to set the dispose method to 0 or 1 for each frame.
Unless your WebP animation was compressed without loss (cwebp -lossless), I strongly recommend starting from the original files used to generate your first animation instead of recompressing it. It will avoid forwarding compression artifacts.

James Zern

unread,
Jul 24, 2023, 1:40:56 PM7/24/23
to webp-d...@webmproject.org
Hi,
On Mon, Jul 24, 2023 at 1:18 AM 'Yannis Guyon' via WebP Discussion <webp-d...@webmproject.org> wrote:
Hi,
You are correct, the webpmux binary has no flag for changing the dispose method of an already animated WebP file.
I suggest uncompressing your WebP animation to one PNG per frame using the anim_dump binary, and then using webpmux with the -frame +[ms]+0+0+[dispose] flag to set the dispose method to 0 or 1 for each frame.

You can extract the individual (compressed) frames from an animation with webpmux, then set the flags as Yannis describes.
In bash something like the following should work, where $file is the file you want to extract the frames from:

for i in $(seq 1 $(webpmux -info $file \
  | awk '/^Number of frames:/ {print $NF}')); do
  webpmux -get frame $i $file -o frame$(printf "%03d" $i).webp || break
done
Reply all
Reply to author
Forward
0 new messages