Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Can webp animations be streamed?

139 views
Skip to first unread message

Dima

unread,
Mar 4, 2025, 8:47:58 AMMar 4
to WebP Discussion
Hi all, right now I'm developing a project using webp animations on embedded chip, so I have pretty strict memory limitations. As decoding library I'm using libwebp, and I've come across the problem that as far as I could see, there's no way to init WebPAnimDecoder and start playing the animation without having full webp file in the buffer.

Are there any workarounds that can be used?
Thanks in advance!

James Zern

unread,
Mar 12, 2025, 6:39:14 PMMar 12
to webp-d...@webmproject.org
Hi,

On Tue, Mar 4, 2025 at 5:48 AM Dima <gore...@gmail.com> wrote:
Hi all, right now I'm developing a project using webp animations on embedded chip, so I have pretty strict memory limitations. As decoding library I'm using libwebp, and I've come across the problem that as far as I could see, there's no way to init WebPAnimDecoder and start playing the animation without having full webp file in the buffer.

Are there any workarounds that can be used?

To do this you will need to use the libwebpdemux interface along with the decoder (incremental or otherwise). The demuxer has a  WebPDemuxPartial() function [1] that can be used for this purpose. Note your application will also need to handle the composition (blending / disposal) of the image to the full canvas. Chrome uses this method [2].
The only limitation to the WebPDemuxPartial() function is that it will reparse the buffer provided. There is no way to continue demuxing at this point. It would be possible to do this, and has come up in the context of Chrome in the past, but it hasn't been a priority.
 
Thanks in advance! 

James Zern

unread,
Mar 13, 2025, 2:23:50 PMMar 13
to webp-d...@webmproject.org
On Wed, Mar 12, 2025 at 3:38 PM James Zern <jz...@google.com> wrote:
Hi,

On Tue, Mar 4, 2025 at 5:48 AM Dima <gore...@gmail.com> wrote:
Hi all, right now I'm developing a project using webp animations on embedded chip, so I have pretty strict memory limitations. As decoding library I'm using libwebp, and I've come across the problem that as far as I could see, there's no way to init WebPAnimDecoder and start playing the animation without having full webp file in the buffer.

Are there any workarounds that can be used?

To do this you will need to use the libwebpdemux interface along with the decoder (incremental or otherwise). The demuxer has a  WebPDemuxPartial() function [1] that can be used for this purpose. Note your application will also need to handle the composition (blending / disposal) of the image to the full canvas. Chrome uses this method [2].
The only limitation to the WebPDemuxPartial() function is that it will reparse the buffer provided. There is no way to continue demuxing at this point. It would be possible to do this, and has come up in the context of Chrome in the past, but it hasn't been a priority.

The discussion related to Chrome I was thinking about happened in a bug [3].
Reply all
Reply to author
Forward
0 new messages