Extracting Animated Webp

2,865 views
Skip to first unread message

Julian Lugod

unread,
Aug 18, 2017, 10:05:26 AM8/18/17
to WebP Discussion
Hi, noob question. How do I extract all sequential frames  from an Animated Webp to PNG. 

Vincent Rabaud

unread,
Aug 21, 2017, 12:12:47 PM8/21/17
to webp-d...@webmproject.org
Hi Julian,

what you are looking for is the webpmux utility in the examples folder: https://developers.google.com/speed/webp/docs/webpmux

The following example is given to get the 2nd frame from an animated WebP file:

webpmux -get frame 2 anim_container.webp -o frame_2.webp

On Fri, Aug 18, 2017 at 4:05 PM, Julian Lugod <anamar...@gmail.com> wrote:
Hi, noob question. How do I extract all sequential frames  from an Animated Webp to PNG. 

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss+unsubscribe@webmproject.org.
To post to this group, send email to webp-d...@webmproject.org.
Visit this group at https://groups.google.com/a/webmproject.org/group/webp-discuss/.
For more options, visit https://groups.google.com/a/webmproject.org/d/optout.

Pascal Massimino

unread,
Aug 28, 2017, 10:10:04 AM8/28/17
to WebP Discussion
Hi,

On Mon, Aug 21, 2017 at 6:12 PM, Vincent Rabaud <vincent...@gmail.com> wrote:
Hi Julian,

what you are looking for is the webpmux utility in the examples folder: https://developers.google.com/speed/webp/docs/webpmux

The following example is given to get the 2nd frame from an animated WebP file:

webpmux -get frame 2 anim_container.webp -o frame_2.webp

Actually, this will save the raw .webp data, which may not be what you expect. In particular, it will
not reconstruct the frames (taking the DISPOSE method into account).

It's actually relatively easy to reconstruct and extract the frames with the API. This is what the
small tool 'anim_diff' is doing, for instance. But using anim_diff to dump frames, even if possible,
feels a bit awkward.

So, out of simplicity, i just went ahead and quickly coded a small tool to call the API and dump
the reconstructed frames from an animation. It's called 'anim_dump', and the patch is here:


You just need to call './examples/anim_dump my_anim.webp' to get the frames 'dump_xxxx.png'.

hope it helps,
skal/

Phil Warren

unread,
Nov 8, 2022, 4:25:44 AM11/8/22
to WebP Discussion, pascal.m...@gmail.com
Hello,

Was curious how to apply the patch?  New to this, thank you in advance!

On Monday, August 28, 2017 at 7:10:04 AM UTC-7 pascal.m...@gmail.com wrote:
Hi,

On Mon, Aug 21, 2017 at 6:12 PM, Vincent Rabaud <vincent...@gmail.com> wrote:
Hi Julian,

what you are looking for is the webpmux utility in the examples folder: https://developers.google.com/speed/webp/docs/webpmux

The following example is given to get the 2nd frame from an animated WebP file:

webpmux -get frame 2 anim_container.webp -o frame_2.webp

Actually, this will save the raw .webp data, which may not be what you expect. In particular, it will
not reconstruct the frames (taking the DISPOSE method into account).

It's actually relatively easy to reconstruct and extract the frames with the API. This is what the
small tool 'anim_diff' is doing, for instance. But using anim_diff to dump frames, even if possible,
feels a bit awkward.

So, out of simplicity, i just went ahead and quickly coded a small tool to call the API and dump
the reconstructed frames from an animation. It's called 'anim_dump', and the patch is here:


You just need to call './examples/anim_dump my_anim.webp' to get the frames 'dump_xxxx.png'.

hope it helps,
skal/
On Fri, Aug 18, 2017 at 4:05 PM, Julian Lugod <anamar...@gmail.com> wrote:
Hi, noob question. How do I extract all sequential frames  from an Animated Webp to PNG. 

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.

James Zern

unread,
Nov 8, 2022, 9:19:54 PM11/8/22
to webp-d...@webmproject.org
Hi,

On Tue, Nov 8, 2022 at 1:25 AM Phil Warren <jagge...@gmail.com> wrote:
Hello,

Was curious how to apply the patch?  New to this, thank you in advance!

That patch landed quite some time ago [1]; anim_dump has been available since v0.6.1.

Gerrit offers various ways to download the diff, though. Click on the overflow menu (3 vertical '.'s) in the upper right corner (or hit the 'd' key) to see some ways to download using git or via an archive.

 
Message has been deleted
Message has been deleted

Eduardo Spuqui

unread,
Dec 22, 2023, 1:10:56 AM12/22/23
to WebP Discussion, Pascal Massimino
I do manage to extract all frames from a WebP animation, either by using anim_dump or by using webpmux to extract the webp frames and then using dwebp to convert each frame back to PNG format.

My issue is that when I recompile the PNG frames into a WebP animation, the file size is a little smaller than the original WebP animation, indicating there was data loss in this process.

Is there a way to disassemble a WebP animation into PNG frames without any data loss so that when recompiling the WebP animation from the PNG frames it would be exactly the same size as the original WebP animation?

On Monday, August 28, 2017 at 11:10:04 AM UTC-3 Pascal Massimino wrote:
Hi,

On Mon, Aug 21, 2017 at 6:12 PM, Vincent Rabaud <vincent...@gmail.com> wrote:
Hi Julian,

what you are looking for is the webpmux utility in the examples folder: https://developers.google.com/speed/webp/docs/webpmux

The following example is given to get the 2nd frame from an animated WebP file:

webpmux -get frame 2 anim_container.webp -o frame_2.webp

Actually, this will save the raw .webp data, which may not be what you expect. In particular, it will
not reconstruct the frames (taking the DISPOSE method into account).

It's actually relatively easy to reconstruct and extract the frames with the API. This is what the
small tool 'anim_diff' is doing, for instance. But using anim_diff to dump frames, even if possible,
feels a bit awkward.

So, out of simplicity, i just went ahead and quickly coded a small tool to call the API and dump
the reconstructed frames from an animation. It's called 'anim_dump', and the patch is here:


You just need to call './examples/anim_dump my_anim.webp' to get the frames 'dump_xxxx.png'.

hope it helps,
skal/
On Fri, Aug 18, 2017 at 4:05 PM, Julian Lugod <anamar...@gmail.com> wrote:
Hi, noob question. How do I extract all sequential frames  from an Animated Webp to PNG. 

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.

Vincent Rabaud

unread,
Dec 22, 2023, 7:50:20 AM12/22/23
to webp-d...@webmproject.org, Pascal Massimino
The frames are dumped, not recompressed.
The size reduction you are seeing is probably because:
- you recompresse with different lossless settings (E.g. with more effort)
- your animation was compressed with a certain version of WebP and when it is re-compressed, you use a newer version that has better lossless compression

Can you please open up a bug as indicated at https://developers.google.com/speed/webp/community, with your animation and the command line you use? Thx.


Reply all
Reply to author
Forward
0 new messages