[FFmpeg-devel] [PATCH v2 5/5] libavformat/webp: add WebP demuxer

James Zern jzern at google.com
Thu Jul 6 23:24:29 EEST 2023


On Thu, Jul 6, 2023 at 4:28 AM Thilo Borgmann <thilo.borgmann at mail.de> wrote:
>
> From: Josef Zlomek <josef at pex.com>
>
> Adds the demuxer of animated WebP files.
> It supports non-animated, animated, truncated, and concatenated files.
> Reading from a pipe (and other non-seekable inputs) is also supported.
>
> The WebP demuxer splits the input stream into packets containing one frame.
> It also marks the key frames properly.
> The loop count is ignored by default (same behaviour as animated PNG and GIF),
> it may be enabled by the option '-ignore_loop 0'.
>
> The frame rate is set according to the frame delay in the ANMF chunk.
> If the delay is too low, or the image is not animated, the default frame rate
> is set to 10 fps, similarly to other WebP libraries and browsers.
> The fate suite was updated accordingly.
>
> Signed-off-by: Josef Zlomek <josef at pex.com>
> ---
>  Changelog                                   |   1 +
>  doc/demuxers.texi                           |  28 +
>  libavformat/Makefile                        |   1 +
>  libavformat/allformats.c                    |   1 +
>  libavformat/version.h                       |   2 +-
>  libavformat/webpdec.c                       | 733 ++++++++++++++++++++
>  tests/ref/fate/webp-rgb-lena-lossless       |   2 +-
>  tests/ref/fate/webp-rgb-lena-lossless-rgb24 |   2 +-
>  tests/ref/fate/webp-rgb-lossless            |   2 +-
>  tests/ref/fate/webp-rgb-lossy-q80           |   2 +-
>  tests/ref/fate/webp-rgba-lossless           |   2 +-
>  tests/ref/fate/webp-rgba-lossy-q80          |   2 +-
>  12 files changed, 771 insertions(+), 7 deletions(-)
>  create mode 100644 libavformat/webpdec.c
>

Looks like fate is breaking on fate-exif-image-webp with this change.
I also noticed a few corrupt files could hang this. I'll send some examples.

> [...]
> +        // fallback if VP8X chunk was not present
> +        if (!canvas_width && width > 0)
> +            canvas_width = width;
> +        if (!canvas_height && height > 0)
> +            canvas_height = height;
> +    }
> +
> +    // WebP format operates with time in "milliseconds", therefore timebase is 1/100

1/1000


More information about the ffmpeg-devel mailing list