-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
AVIF support in prebuilt binaries #2289
Comments
Hi Aaron, I expect to be able to include aom+libheif in the prebuilt binaries in order to support AVIF input and output, but the following things will need to exist first, in approximately this order:
Anything you can do to help with the first two security-related items will be much appreciated. (The patent-encumbered HEIC codec will not be supported in the prebuilt binaries.) |
Thanks! I'll close. |
I'm going to reopen this to become the "canonical" issue to track adding AVIF support in the prebuilt binaries. For anyone else coming to this issue, sharp already supports AVIF, you need to compile libvips from source with support for libheif that has been compiled with support for aom/rav1e, before installing sharp. |
I've created google/oss-fuzz#4414 to enable fuzz testing of AVIF images with libheif, see step 1 above. Once approved and merged, my plan is to let that run for a couple of weeks to give it a chance to find any problems and get them fixed before moving onto step 2. |
Is that something that would benefit from having some monster AWS EC2 server? I don't know much C but I do have credit card :) |
@soukicz OSS-Fuzz runs on Google's ClusterFuzz hardware, currently >25k cores of processing power. |
The addition of AVIF fuzzing to libvips is now merged at google/oss-fuzz#4463 - let's see what it finds in the next few days before moving onto step 3. |
There's lots of interest in this issue so I'd like to remind everyone that if you work at a for-profit organisation, and you are not already doing so, then please donate to https://opencollective.com/libvips if you benefit commercially from sharp and libvips. |
Prebuilt binaries containing libvips, libheif and aom have now been successfully built for Linux (x64, ARMv6, ARMv7, ARM64), macOS (x64) and Windows (x64, x86). A groot big thank you to @kleisauke for help with these. This means those feeling brave may want to carry out some early/alpha testing. npm install lovell/sharp#avif Given installation is from GitHub rather than npm, the above command will require node-gyp and its dependencies (C++ compiler, Python) - see https://sharp.pixelplumbing.com/install#building-from-source The following code samples are made possible when using these pre-release binaries: // AVAILABLE FROM v0.27.0+
await sharp(input).toFile("out.avif");
await sharp("in.avif").toFile("out.jpg");
await sharp(input).avif({ quality: 30, speed: 1 }).toBuffer();
// AVAILABLE FROM v0.27.0+ Temporary docs for the forthcoming Please do not use these in production systems yet. |
Fuzz tests added for this issue are (un)fortunately still finding security bugs in AVIF-related dependencies, approximately one every ~5 days, so this this not yet ready for release. Please do not use these in production systems yet. |
@lovell Any chance you could shed some more insight into your last comment? If there are a few random bugs would it be possible to still utilize the avif format in a release and then have subsequent build releases address security concerns in libvips? I guess at some level there will always be issues with dependencies. If the sharp app works well with the format yet there are a few downstream issues, couldn't those just be updated and re-released in minor patch builds? |
@virgofx If your question can be rephrased as "Will pre-compiled binaries be provided that contain known security vulnerabilities?" then the answer is "no". |
@lovell Is there an area where time/resources could be invested to get this over the line, or is this just lots of bugs in various dependencies? |
As a side issue, I had read that encoding and decoding AVIF files was very slow. Are there any performance stats on this with libvips? |
@ascorbic There are a number of security-related fixes in libheif and libvips awaiting release. There are also a couple of open bugs relating to the use of
|
When this is shipped it will make |
libheif v1.10.0 and libvips v8.10.5 have now been released, plus (sadly but understandably) all the pubs in London are pandemically-shut, which means we're looking at this side of Christmas for a release of sharp that includes prebuilt binaries that support AVIF. 🎉 |
If anyone would like to test the v0.27.0-beta1 pre-release, which includes prebuilt binaries for all the usual platforms, please use the following (this doesn't require a compiler, but does involve a git checkout of the whole repo so will still be slower than an npm-published package):
I plan to publish this to npm as v0.27.0 tomorrow. |
sharp v0.27.0 is now available with prebuilt binaries that contain libaom and libheif for full AVIF decoding and encoding support. Please note the current lack of support in most browsers for AVIF images smaller than 16x16. https://sharp.pixelplumbing.com/api-output#avif If anyone discovers a problem image, please open a new issue and provide as much information as possible, ideally trying libheif's command line tools such as |
Amazing, thanks so much @lovell, I had done some work to update humanmade/tachyon#130 to the |
Here's a basic CLI tool to quickly/easily transcode a directory of images into AVIF, which might be useful to help assess the suitability of AVIF for a particular task. https://www.npmjs.com/package/avif Run |
Reminder: if you work at a for-profit organisation that benefits commercially from sharp and libvips then please tell your manager to become a backer at https://opencollective.com/libvips |
That's awesome news @lovell. I'll certainly be raising this. |
As a note to anybody using Apple Silicon who wants AVIF support: bear in mind that before compiling libvips from source you will need to compile and install libheif and aom from source too. Using homebrew doesn't work either, and it will either fail to include AVIF support, or it will include it but fail to generate images. You must first compile and install aom from git, then compile and install libheif (checking that it has found aom when running configure), then finally compile and install libvips. |
AVIF is coming soon to the most popular browsers. Is there a reason this is still considered experimental and not ready for production? https://sharp.pixelplumbing.com/api-output#heif
The text was updated successfully, but these errors were encountered: