Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unsupported animation properties from AVIF #2870

Closed
realandrew opened this issue Aug 30, 2021 · 3 comments
Closed

Remove unsupported animation properties from AVIF #2870

realandrew opened this issue Aug 30, 2021 · 3 comments

Comments

@realandrew
Copy link

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?

Yes, 0.29.0.

What are the steps to reproduce?

Feed sharp an animated gif or animated webp file, and convert to avif.

What is the expected behaviour?

Output data should be a working animated AVIF file. It doesn't throw an error, but the file decodes as a white square in Chrome and fails to decode in IrfanView. So either animated avifs are broken, or it should throw an error and the documentation should be updated to say they are not supported.

Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?

sharp(imgData, { animated: true }).avif().toBuffer( resolveWithObject: true; }
where imgData is a data buffer of an animated image (gif or animated webp).

Are you able to provide a sample image that helps explain the problem?

Input file: https://cloudflare-ipfs.com/ipfs/bafybeifcmh3muodb5shyhptrobbstvcalw67fb32vuzugl5y7vlsh4mw4y/1b9a0df060d6c860abbeae9b8fc6b82c8084a255844ce40ff011d14cb8563dce.gif

Broken output file: https://www.cloudflare-ipfs.com/ipfs/bafybeifcmh3muodb5shyhptrobbstvcalw67fb32vuzugl5y7vlsh4mw4y/fd54a2b9fb9022c76a55d3e40e8db26b5d35f3f30010ad0b4fe89dd57c04212a.avif

What is the output of running npx envinfo --binaries --system?

System:
OS: Windows 10 10.0.19043
CPU: (4) x64 Intel(R) Core(TM) i5-7600K CPU @ 3.80GHz
Memory: 11.62 GB / 31.94 GB
Binaries:
Node: 14.17.5 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 7.20.6 - C:\Program Files\nodejs\npm.CMD

@lovell
Copy link
Owner

lovell commented Aug 31, 2021

AVIF sequence files (AVIS) aren't supported by the underlying libheif - please see strukturag/libheif#377

libheif does support the addition of multiple "planes" as part of the HEIF container, which is what libvips is using in this example. However this appears to be creating invalid images, so perhaps we should add logic to libvips to block this, at least when using AV1 compression.

@lovell lovell added enhancement and removed triage labels Aug 31, 2021
@lovell lovell changed the title Animated AVIF output are broken/corrupted Remove unsupported animation properties from AVIF Sep 5, 2021
@lovell lovell added this to the v0.29.1 milestone Sep 5, 2021
@lovell
Copy link
Owner

lovell commented Sep 5, 2021

Commit 5d98bcd prevents broken AVIF images from being created via sharp, plus adds a test that would previously have failed as well as a brief note about this to the docs. Thanks for reporting this.

@lovell
Copy link
Owner

lovell commented Sep 7, 2021

v0.29.1 now available. The docs have just been updated too (or at least will do when CDN caches expire in a few hours):

https://sharp.pixelplumbing.com/api-output#avif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants