Streaming webp encoder?

337 views
Skip to first unread message

Victor Loh

unread,
Sep 25, 2023, 3:48:40 AM9/25/23
to WebP Discussion
I was looking into whether it is possible to do:
1. Encode webp frame by frame while generating webp bitstreams
2. Decoding webp while step (1) is ongoing

Technically, the only difficulty seems to be the assumption that the total image size is known at the beginning (A potential hack is to set it to 0 and ignore that value). Setting that aside, digging into libwebp source code, my understanding is the following:
* There is incremental decoding API which potentially can be used for (2)
* For the animated encoder API, there is the encoding part and muxing. The encoding part seems to be able to be done in a streaming fashion. However, because the muxing is written in a fashion that requires all the frames to be present, the API exposed by animated encoder is that way.

Hence my questions:
* Is my understanding correct?
* Is there any streaming webp encoders?

Thanks!

Regards,
Victor

James Zern

unread,
Oct 6, 2023, 10:50:14 PM10/6/23
to webp-d...@webmproject.org
Hi Victor,

No, there isn't anything in the libwebp project to emit chunks of an animated file on the fly. This could be done, but for it to be decodable in most cases the RIFF header would need to be updated or set to an arbitrarily large value. The incremental decoder works on individual frames and doesn't support animated files directly, you would need to use the demuxer to retrieve partial frames.
For a streaming case like this you might consider using a video format like fragmented mp4 or webm.
 

Thanks!

Regards,
Victor
Reply all
Reply to author
Forward
0 new messages