MaestroError / php-heic-to-jpg

The easiest way to convert HEIC images to JPEG with PHP and Laravel framework
MIT License
147 stars 20 forks source link

Arm64 debian12 error reading "meta" box: got box type "mdat" instead #33

Open kukumagi opened 9 months ago

kukumagi commented 9 months ago

Getting error reading "meta" box: got box type "mdat" instead After moving to Arm64 debian12 I am unable to get past this error. In old server this works fine.

/var/www/http/app/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64 "/volumes/volume_1/app-storagetest/app/PXhhV4nOy5bt5DUIBmNsf0QCx8Zdztxuc2KhKvHl.heic" "/volumes/volume_1/app-storagetest/app/PXhhV4nOy5bt5DUIBmNsf0QCx8Zdztxuc2KhKvHl.jpg"

2024/01/26 11:37:17 error reading "meta" box: got box type "mdat" instead Error while converting /volumes/volume_1/app-storagetest/app/PXhhV4nOy5bt5DUIBmNsf0QCx8Zdztxuc2KhKvHl.heic: error reading "meta" box: got box type "mdat" instead Created by MaestroError

MaestroError commented 9 months ago

Hi @kukumagi! Thanks for reaching out! Yes, we have this issue on some linux distributions. please refer to Handling 'mdat' File Conversion Issues section of Docs 👍

kukumagi commented 9 months ago

Does it mean I did something wrong with the installation of libheif? Since I did run those commands for libheif installation.

MaestroError commented 9 months ago

Hmm.. Were they successful? Can you try to convert the exact same file using a heif-converter?

Here is usage: ./heif-converter [heic|avif|jpeg|png] path/to/input_file.heic /path/to/output_file.png

P.s. You should replace ./heif-converter with your binary. You can find it in your projects vendor/bin folder (as usual: ./vendor/bin/heif-converter-linux)

kukumagi commented 9 months ago

Hmm.. Were they successful? Can you try to convert the exact same file using a heif-converter?

Here is usage: ./heif-converter [heic|avif|jpeg|png] path/to/input_file.heic /path/to/output_file.png

P.s. You should replace ./heif-converter with your binary. You can find it in your projects vendor/bin folder (as usual: ./vendor/bin/heif-converter-linux)

./vendor/bin/heif-converter-linux: 37: /var/www/http/app/vendor/maestroerror/heif-converter/bin/heif-converter-linux: Exec format error

kukumagi commented 9 months ago

There are some warnings in cmake .. command

cmake .. -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for unistd.h -- Looking for unistd.h - found -- Performing Test has_potentially_evaluated_expression -- Performing Test has_potentially_evaluated_expression - Failed -- Found LIBDE265 -- Found LIBDE265: /usr/include (found version "1.0.11") -- Found X265 -- Found X265: /usr/include (found version "199") -- Looking for AOM_USAGE_GOOD_QUALITY -- Looking for AOM_USAGE_GOOD_QUALITY - not found CMake Warning at cmake/modules/LibFindMacros.cmake:267 (message): WARNING: MISSING PACKAGE

We could not find development headers for AOM. Do you have the necessary dev package installed? This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of libheif.

Relevant CMake configuration variables:

AOM_INCLUDE_DIR=<not found>
AOM_LIBRARY=<not found>

You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.

Call Stack (most recent call first): cmake/modules/FindAOM.cmake:35 (libfind_process) CMakeLists.txt:140 (find_package)

-- Could NOT find AOM (missing: AOM_INCLUDE_DIR AOM_LIBRARIES) === Summary of compiled codecs === libde265 HEVC decoder : + built-in FFMPEG HEVC decoder (HW acc) : - disabled x265 HEVC encoder : + built-in Kvazaar HEVC encoder : - disabled AOM AV1 decoder : - not found AOM AV1 encoder : - not found Dav1d AV1 decoder : - disabled SVT AV1 encoder : - disabled Rav1e AV1 encoder : - disabled JPEG decoder : - disabled JPEG encoder : - disabled OpenJPEG J2K decoder : - disabled OpenJPEG J2K encoder : - disabled CMake Warning at cmake/modules/LibFindMacros.cmake:267 (message): WARNING: MISSING PACKAGE

We could not find development headers for LIBSHARPYUV. Do you have the necessary dev package installed? This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of libheif.

Relevant CMake configuration variables:

LIBSHARPYUV_INCLUDE_DIR=<not found>
LIBSHARPYUV_LIBRARY=<not found>

You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.

Call Stack (most recent call first): cmake/modules/Findlibsharpyuv.cmake:18 (libfind_process) CMakeLists.txt:207 (find_package)

-- Could NOT find libsharpyuv (missing: LIBSHARPYUV_INCLUDE_DIR LIBSHARPYUV_LIBRARIES) libsharpyuv: disabled -- Looking for _LIBCPP_VERSION -- Looking for _LIBCPP_VERSION - not found -- Found JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (found version "62") -- Performing Test HAVE_JPEG_WRITE_ICC_PROFILE -- Performing Test HAVE_JPEG_WRITE_ICC_PROFILE - Success -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR) -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) Doxygen tool needs to be installed to generate the API documentation CMake Warning at tests/CMakeLists.txt:19 (message): Conversion and box unit tests can only be compiled with full symbol visibility (WITH_REDUCED_VISIBILITY=OFF)

CMake Warning at tests/CMakeLists.txt:35 (message): Tests of the 'uncompressed codec' are not compiled because the uncompressed codec is not enabled (WITH_UNCOMPRESSED_CODEC==OFF)

Compiling 'x265' as built-in backend Compiling 'libde265' as built-in backend Not compiling 'dav1d' backend Not compiling 'aomdec' backend Not compiling 'aomenc' backend Not compiling 'svtenc' backend Not compiling 'rav1e' backend Not compiling 'jpegdec' backend Not compiling 'jpegenc' backend Not compiling 'j2kdec' backend Not compiling 'j2kenc' backend Not compiling 'kvazaar' backend Not compiling 'ffmpegdec' backend Not compiling 'libsharpyuv' -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") -- Checking for module 'gdk-pixbuf-2.0' -- Package 'gdk-pixbuf-2.0', required by 'virtual:world', not found -- Configuring done -- Generating done -- Build files have been written to:

kukumagi commented 9 months ago

Ended up rebuilding heif-converter Installed go for arm64

cd vendor/maestroerror/heif-converter
env GOOS=linux GOARCH=arm64 go build -o bin/heif-converter-linux
cp bin/heif-converter-linux ../../bin/heif-converter-linux

../../bin/heif-converter-linux should be vendor/bin/heif-converter-linux

Tested and it worked.

MaestroError commented 9 months ago

Good job @kukumagi! And nice solution, I will add this issue as an example for arm64 in docs 👍

MaestroError commented 9 months ago

Thanks for sharing your experience and for your support 🙏