strukturag / libheif

libheif is an HEIF and AVIF file format decoder and encoder.
Other
1.76k stars 302 forks source link

Newest version isn't able to show images #933

Closed eHonnef closed 1 year ago

eHonnef commented 1 year ago

Hello, currently I'm using Fedora 37 with KDE and Wayland. And I had a problem trying to open some HEIF images with Gwenview with the version 1.16.1 of the library, and when I downgraded to version 1.13.0 it works without problem.

I checked the other plugins, like qt-heif-image-plugin, and it is on latest version.

Let me know which extra information (and how to get it) I can provide.

Cheers.

bigcat88 commented 1 year ago

Will be good to see sample of the image that cannot be open.

farindk commented 1 year ago

Check whether you have the codec plugins installed, i.e. "libheif-plugin-libde265" (not sure how that is called in Fedora). When you type heif-convert --list-decoders, you should get an output like this:

HEIC decoders:
- libde265 = libde265 HEVC decoder, version 1.0.8
AVIF decoders:
- aom = AOMedia Project AV1 Decoder v3.3.0
eHonnef commented 1 year ago

Thanks for the reply, and again, let me know if you need more info:

Will be good to see sample of the image that cannot be open.

@bigcat88 Any HEIF image, but I put one in the annexed zip file: autumn_1440x960.zip

Check whether you have the codec plugins installed, i.e. "libheif-plugin-libde265"

@farindk I updated the libheif to the latest version (I put a dump of heif related installed packages below).

i.e. "libheif-plugin-libde265" (not sure how that is called in Fedora).

It is the libheif-freeworld.x86_64

[~]> heif-convert --list-decoders
HEIC decoders:
- libde265 = libde265 HEVC decoder, version 1.0.12
AVIF decoders:
- dav1d = dav1d v6.6.0
- aom = AOMedia Project AV1 Decoder v3.6.1
uncompressed: no

HEIF related packages:

[~]> sudo dnf list *heif*
Last metadata expiration check: 0:10:26 ago on Sun 23 Jul 2023 22:53:46 CEST.
Installed Packages
libheif.x86_64                                                         1.16.1-1.fc37                                               @updates               
libheif-devel.x86_64                                                   1.16.1-1.fc37                                               @updates               
libheif-freeworld.x86_64                                               1.16.1-1.fc37                                               @rpmfusion-free-updates
libheif-tools.x86_64                                                   1.16.1-1.fc37                                               @updates               
qt-heif-image-plugin.x86_64                                            0.3.3-7.fc37                                                @rpmfusion-free
farindk commented 1 year ago

Works fine for me (compiled from source). Also you seem to have all necessary decoders. What's the output of this command? heif-convert autumn_1440x960.heic out.jpg If that works to convert to image, it's probably a problem with gwenview.

fancycode commented 1 year ago

There has been a similar issue from Debian (decoding doesn't work even though plugins are installed): https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1041242

eHonnef commented 1 year ago

@farindk it produces a jpeg output, but I cannot open the heic image on gwenview:

[~/images]> heif-convert autumn_1440x960.heic out.jpg
File contains 1 image
Written to out.jpg

If that works to convert to image, it's probably a problem with gwenview.

@fancycode @farindk maybe that's the case, but since with the version 1.13 it works, I thought it could be something related to libheif itself

farindk commented 1 year ago

I think I know. This could be because of #914. If gwenview is not calling heif_init(), the plugins are not loaded.

farindk commented 1 year ago

I just fixed #914. Please check if it works with the latest version from master.

eHonnef commented 1 year ago

I compiled and installed the project from source, here is the output:

[~/.../libheif/build](master)> sudo make install
[ 34%] Built target heif
[ 37%] Built target heif-info
[ 46%] Built target heif-convert
[ 55%] Built target heif-enc
[ 59%] Built target heif-test
[ 65%] Built target heif-thumbnailer
[ 68%] Built target heif-x265
[ 73%] Built target heif-libde265
[ 77%] Built target heif-dav1d
[ 80%] Built target heif-aomdec
[ 86%] Built target heif-aomenc
[ 91%] Built target heif-rav1e
[ 94%] Built target heif-jpegdec
[ 97%] Built target heif-jpegenc
[100%] Built target pixbufloader-heif
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /usr/local/lib64/libheif
-- Up-to-date: /usr/local/lib64/pkgconfig/libheif.pc
-- Up-to-date: /usr/local/bin/heif-info
-- Up-to-date: /usr/local/share/man/man1/heif-info.1
-- Up-to-date: /usr/local/bin/heif-convert
-- Up-to-date: /usr/local/share/man/man1/heif-convert.1
-- Up-to-date: /usr/local/bin/heif-enc
-- Up-to-date: /usr/local/share/man/man1/heif-enc.1
-- Up-to-date: /usr/local/bin/heif-thumbnailer
-- Up-to-date: /usr/local/share/man/man1/heif-thumbnailer.1
-- Up-to-date: /usr/local/lib64/libheif/libheif-x265.so
-- Up-to-date: /usr/local/lib64/libheif/libheif-libde265.so
-- Up-to-date: /usr/local/lib64/libheif/libheif-dav1d.so
-- Up-to-date: /usr/local/lib64/libheif/libheif-aomdec.so
-- Up-to-date: /usr/local/lib64/libheif/libheif-aomenc.so
-- Up-to-date: /usr/local/lib64/libheif/libheif-rav1e.so
-- Up-to-date: /usr/local/lib64/libheif/libheif-jpegdec.so
-- Up-to-date: /usr/local/lib64/libheif/libheif-jpegenc.so
-- Up-to-date: /usr/local/lib64/libheif.so.1.16.2
-- Up-to-date: /usr/local/lib64/libheif.so.1
-- Up-to-date: /usr/local/lib64/libheif.so
-- Up-to-date: /usr/local/include/libheif/heif.h
-- Up-to-date: /usr/local/include/libheif/heif_cxx.h
-- Up-to-date: /usr/local/include/libheif/heif_plugin.h
-- Up-to-date: /usr/local/include/libheif/heif_version.h
-- Up-to-date: /usr/local/lib64/cmake/libheif/libheif-config.cmake
-- Up-to-date: /usr/local/lib64/cmake/libheif/libheif-config-release.cmake
-- Up-to-date: /usr/local/lib64/cmake/libheif/libheif-config-version.cmake
-- Up-to-date: /usr/local/lib64/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-heif.so
-- Up-to-date: /usr/local/share/thumbnailers/heif.thumbnailer

But gwenview still doesn't work properly. But something seems strange, it looks like the library hasn't been updated properly, even after running sudo make install, am I missing a step here?

Some other dumps, hope it helps:

[~/.../libheif/build](master)> heif-info -v
1.16.2
libheif: 1.16.1
heif-info: symbol lookup error: heif-info: undefined symbol: heif_get_plugin_directories
[~/.../libheif/build](master)> heif-convert --list-decoders
HEIC decoders:
- libde265 = libde265 HEVC decoder, version 1.0.12
AVIF decoders:
- dav1d = dav1d v6.6.0
- aom = AOMedia Project AV1 Decoder v3.6.1
JPEG decoders:
JPEG-2000 decoders:
uncompressed: yes

Also, I tried to remove the libheif package and install from the source, also without success.

farindk commented 1 year ago

You messed up your installation. You installed the compiled version into /usr/local/. Probably that is not in the LD_LIBRARY_PATH and other paths. The packaged library is probably in /usr/.

You can see that it's taking the wrong library:

> heif-info -v
1.16.2
libheif: 1.16.1

Compiled version is 1.16.2, but libheif.so is still 1.16.1

Uninstall all libheif packages. Now configure the source with cmake .. -DCMAKE_BUILD_PREFIX=/usr -DPLUGIN_DIRECTORY=/usr/lib/libheif. Rebuild and install.

eHonnef commented 1 year ago

Thanks for the reply, I tested and it works.

Below are some regards from me, and to show that I don't have anything else related to heif installed from the package manager:

I was able to proper compile and install, just a tip to do so:

My heif-info output:

1.16.2
libheif: 1.16.2
plugin path: /usr/lib/libheif
[~/.../libheif/build](master)> heif-convert --list-decoders
dlopen: /usr/lib/libheif/libheif-rav1e.so: undefined symbol: _ZTV8Box_pclr
HEIC decoders:
- libde265 = libde265 HEVC decoder, version 1.0.12
- libde265 = libde265 HEVC decoder, version 1.0.12
AVIF decoders:
- dav1d = dav1d v6.9.0
- dav1d = dav1d v6.9.0
- aom = AOMedia Project AV1 Decoder v3.6.1
- aom = AOMedia Project AV1 Decoder v3.6.1
JPEG decoders:
- jpeg = libjpeg-turbo 2.1.3 (libjpeg 6.2)
- jpeg = libjpeg-turbo 2.1.3 (libjpeg 6.2)
JPEG-2000 decoders:
uncompressed: no

also, nothing related to heif installed:

[~/.../libheif/build](master)> sudo dnf list *heif*
Fedora 37 - x86_64 - Updates                                                                                                                         84 kB/s |  19 kB     00:00    
Fedora Modular 37 - x86_64 - Updates                                                                                                                206 kB/s |  19 kB     00:00    
download.vscodium.com                                                                                                                               4.1 kB/s | 866  B     00:00    
Available Packages
libheif.i686                                                                           1.16.1-1.fc37                                                                         updates
libheif.x86_64                                                                         1.16.1-1.fc37                                                                         updates

Thank you very much for the support.

bradh commented 1 year ago
dlopen: /usr/lib/libheif/libheif-rav1e.so: undefined symbol: _ZTV8Box_pclr

Possibly this is from a previous build with JPEG 2000 turned on?

eHonnef commented 1 year ago

@bradh Yes, that was the case, I just compiled with the default options enabled and I don't have the jpeg2000 decoder, here is the logs for the cmake config:

[~/projects/libheif](master)> cmake --preset release
Preset CMake variables:

  BUILD_SHARED_LIBS="ON"
  BUILD_TESTING="OFF"
  CMAKE_BUILD_TYPE="Release"
  WITH_AOM_DECODER="ON"
  WITH_AOM_DECODER_PLUGIN="ON"
  WITH_AOM_ENCODER="ON"
  WITH_AOM_ENCODER_PLUGIN="ON"
  WITH_DAV1D="ON"
  WITH_DAV1D_PLUGIN="ON"
  WITH_DEFLATE_HEADER_COMPRESSION="ON"
  WITH_EXAMPLES="ON"
  WITH_FUZZERS="OFF"
  WITH_JPEG_DECODER="ON"
  WITH_JPEG_DECODER_PLUGIN="ON"
  WITH_JPEG_ENCODER="ON"
  WITH_JPEG_ENCODER_PLUGIN="ON"
  WITH_LIBDE265="ON"
  WITH_LIBDE265_PLUGIN="ON"
  WITH_LIBSHARPYUV="ON"
  WITH_RAV1E="ON"
  WITH_RAV1E_PLUGIN="ON"
  WITH_REDUCED_VISIBILITY="ON"
  WITH_SvtEnc="ON"
  WITH_SvtEnc_PLUGIN="ON"
  WITH_UNCOMPRESSED_CODEC="ON"
  WITH_X265="ON"
  WITH_X265_PLUGIN="ON"

-- The C compiler identification is GNU 12.3.1
-- The CXX compiler identification is GNU 12.3.1
-- 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.12") 
libde265 (HEIC decoder): found (plugin)
-- Found X265 
-- Found X265: /usr/include (found version "199") 
x265 (HEIC encoder): found (plugin)
CMake Warning at cmake/modules/LibFindMacros.cmake:267 (message):
  WARNING: MISSING PACKAGE

  We could not find development headers for KVAZAAR.  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:

    KVAZAAR_INCLUDE_DIR=<not found>
    KVAZAAR_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/Findkvazaar.cmake:19 (libfind_process)
  CMakeLists.txt:74 (find_package)
  CMakeLists.txt:93 (plugin_option)

-- Performing Test HAVE_KVAZAAR_ENABLE_LOGGING
-- Performing Test HAVE_KVAZAAR_ENABLE_LOGGING - Failed
-- Could NOT find kvazaar (missing: KVAZAAR_INCLUDE_DIR KVAZAAR_LIBRARIES) 
kvazaar (kvazaar HEVC encoder): not found
-- Found DAV1D 
-- Found DAV1D: /usr/include  
Dav1d (AVIF decoder): found (plugin)
-- Looking for AOM_USAGE_GOOD_QUALITY
-- Looking for AOM_USAGE_GOOD_QUALITY - found
-- Found AOM 
-- Found AOM: /usr/include  
aom (AVIF encoder): found (plugin)
aom (AVIF decoder): found (plugin)
CMake Warning at cmake/modules/LibFindMacros.cmake:267 (message):
  WARNING: MISSING PACKAGE

  We could not find development headers for SvtEnc.  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:

    SvtEnc_INCLUDE_DIR=<not found>
    SvtEnc_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/FindSvtEnc.cmake:17 (libfind_process)
  CMakeLists.txt:74 (find_package)
  CMakeLists.txt:103 (plugin_option)

-- Could NOT find SvtEnc (missing: SvtEnc_INCLUDE_DIR SvtEnc_LIBRARIES) 
Svt-av1 (AVIF encoder): not found
-- Found RAV1E 
-- Found RAV1E: /usr/include/rav1e  
Rav1e (AVIF encoder): found (plugin)
-- Found JPEG: /usr/lib64/libjpeg.so (found version "62") 
Jpeg (JPEG decoder): not found
Jpeg (JPEG encoder): not found
CMake Warning at CMakeLists.txt:74 (find_package):
  By not providing "FindOpenJPEG.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenJPEG",
  but CMake did not find one.

  Could not find a package configuration file provided by "OpenJPEG" with any
  of the following names:

    OpenJPEGConfig.cmake
    openjpeg-config.cmake

  Add the installation prefix of "OpenJPEG" to CMAKE_PREFIX_PATH or set
  "OpenJPEG_DIR" to a directory containing one of the above files.  If
  "OpenJPEG" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:107 (plugin_option)

OpenJPEG_Encoder (JPEG2000 encoder): not found
CMake Warning at CMakeLists.txt:74 (find_package):
  By not providing "FindOpenJPEG.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenJPEG",
  but CMake did not find one.

  Could not find a package configuration file provided by "OpenJPEG" with any
  of the following names:

    OpenJPEGConfig.cmake
    openjpeg-config.cmake

  Add the installation prefix of "OpenJPEG" to CMAKE_PREFIX_PATH or set
  "OpenJPEG_DIR" to a directory containing one of the above files.  If
  "OpenJPEG" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:108 (plugin_option)

OpenJPEG_Decoder (JPEG2000 decoder): not found
-- Found LIBSHARPYUV 
-- Found libsharpyuv: /usr/include/webp  
libsharpyuv: found
-- Performing Test HAVE_JPEG_WRITE_ICC_PROFILE
-- Performing Test HAVE_JPEG_WRITE_ICC_PROFILE - Success
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.12")  
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.37") 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
Doxygen tool needs to be installed to generate the API documentation
Compiling 'x265' as dynamic plugin
Compiling 'libde265' as dynamic plugin
Compiling 'dav1d' as dynamic plugin
Compiling 'aomdec' as dynamic plugin
Compiling 'aomenc' as dynamic plugin
Not compiling 'svtenc' backend
Compiling 'rav1e' as dynamic plugin
Compiling 'jpegdec' as dynamic plugin
Compiling 'jpegenc' as dynamic plugin
Not compiling 'OpenJPEG_Decoder' backend
Not compiling 'OpenJPEG_Encoder' backend
Not compiling 'kvazaar' backend
Compiling in '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.0") 
-- Checking for module 'gdk-pixbuf-2.0'
--   Found gdk-pixbuf-2.0, version 2.42.10
-- Configuring done (1.3s)
-- Generating done (0.0s)
-- Build files have been written to: ~/projects/libheif
bradh commented 1 year ago

So if you set up paths/install, does it work ok? If not, can you describe your problem again?

eHonnef commented 1 year ago

@bradh maybe yes, but my initial problem wasn't with the compilation or with these libraries, it was with the integration with gwenview, and it was fixed by #914

Testing with the master branch resulted in gwenview showing the heif image without problem.

I will close this ticket to not cause anymore confusion.

Solved by #914.

patsch commented 3 weeks ago

Thanks for the reply, I tested and it works.

Below are some regards from me, and to show that I don't have anything else related to heif installed from the package manager:

I was able to proper compile and install, just a tip to do so:

* Setting the flags `CMAKE_BUILD_PREFIX` and `PLUGIN_DIRECTORY` will not work, the workaround is, from inside the build folder, run `ccmake ..` and change the corresponding values.

Thanks for your comments ! This is what worked for me:

cmake -DCMAKE_INSTALL_PREFIX=/usr -DPLUGIN_DIRECTORY=/usr/lib/libheif ..