Bug #81217 [Com]: imageavif() fails - Segmentation Fault or No codec available

From: Date: Wed, 02 Nov 2022 21:43:47 +0000
Subject: Bug #81217 [Com]: imageavif() fails - Segmentation Fault or No codec available
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242739@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81217&edit=1

 ID:                 81217
 Comment by:         mlocati at gmail dot com
 Reported by:        mlocati at gmail dot com
 Summary:            imageavif() fails - Segmentation Fault or No codec
                     available
 Status:             Not a bug
 Type:               Bug
 Package:            GD related
 Operating System:   Debian Buster and Alpine Linux
 PHP Version:        8.1.0alpha2
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Just an update on this issue.

Alpine Linux offers the pre-compiled libraries avif/aom/dav1d.

With Alpine up to 3.14, by using these libraries we had this error:

imageavif(): avif error - Could not encode image: No codec available


But since Alpine 3.15 and later, it seems we can use them without problems, that is:

apk add libavif-dev aom-dev dav1d-dev


Previous Comments:
------------------------------------------------------------------------
[2021-10-15 17:35:05] cmb@php.net

> So, it seems that the root cause of this issue is that the
> libaom versions currently provided by Debian APT and Alpine APK
> systems are not functional […]

Right.  Closing as not a (PHP) bug.

------------------------------------------------------------------------
[2021-10-08 10:12:36] mlocati at gmail dot com

So, it seems that the root cause of this issue is that the libaom versions currently provided by
Debian APT and Alpine APK systems are not functional (AFAIK they are compiled without the required
BUILD_SHARED_LIBS=1, but I may be wrong here).

So, in order to make imageavif() and imagecreatefromavif() work, you need to do everything by hand:

1. compile and install libaom
2. compile and install libdav1d (to decode AV1)
3. compile and install libyuv (used by libavif to better handle YUV decoding)
4. compile and install libavif
5. compile and install the gd PHP extension (with the --with-avif flag)

For an example about how that can be done in Debian (so, Ubuntu too) and Alpine, you can take a look
at https://github.com/mlocati/docker-php-extension-installer

------------------------------------------------------------------------
[2021-09-28 00:05:06] apostnikov at gmail dot com

I filed MR to upgrade libavif in Alpinelinex 3.14 but looks it needs major version bump for libaom,
meantime it should be working in alpine:edge

------------------------------------------------------------------------
[2021-09-27 17:47:27] morss at google dot com

I think this is the same thing that Pierre kindly fixed here:

https://github.com/libgd/libgd/issues/770

------------------------------------------------------------------------
[2021-08-26 14:23:18] pear at laurent-laville dot org

This issue is still live with version 8.1.0beta3

Same test procedure, but used docker image php:8.1.0beta3-fpm-buster

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=81217


--
Edit this bug report at https://bugs.php.net/bug.php?id=81217&edit=1


Thread (11 messages)

« previous php.bugs (#242739) next »