gotson / komga

Media server for comics/mangas/BDs/magazines/eBooks with API, OPDS and Kobo Sync support
https://komga.org
MIT License
4.1k stars 243 forks source link

AVIF decoding fails on Windows app #1624

Closed acer1204 closed 2 months ago

acer1204 commented 3 months ago

Steps to reproduce

1.get two avif comic with zip . 2.Scan Library File. 3.The two comic preview not show, but when i enter the two comic, it can view content, only preview cover not show.

Expected behavior

in https://komga.org/docs/guides/image-formats/. it show Windows app support AVIF / HEIF. so, the preview not show is bug? (because enter the book, it can show every page)

Actual behavior

avif comic with zip , preview cover not show.

Logs

komga.log

the book name is 異世界不倫2~導かれし人妻たちと不器用転生勇者. from 01 to 05 is avif zip, and from 06 to 07 is jpg zip. the avif zip preview cover not show, but it can read all page. and the jpg zip it work fine.

Komga version

v1.11.1-master

Operating system

Windows 11

Installation method

Microsoft Store

Other details

No response

Acknowledgements

gotson commented 3 months ago

would need:

Komga does not need to decode images when reading with the webreader, the AVIF file is passed as-is if your browser supports it, that's why you can see it when reading.

Komga decodes when generating the thumbnail, the fact that it fails to generate a thumbnail seem to indicate something does not work on your machine, but logs would be needed to confirm.

acer1204 commented 3 months ago

/> would need:

  • startup logs to verify that AVIF is enabled or not
  • logs when generating the thumbnail, check for any error

Komga does not need to decode images when reading with the webreader, the AVIF file is passed as-is if your browser supports it, that's why you can see it when reading.

Komga decodes when generating the thumbnail, the fact that it fails to generate a thumbnail seem to indicate something does not work on your machine, but logs would be needed to confirm.

where can found the startup log? when i right click komga icon, and show log file , it just get the komga.log. this file is close komga and delete record, then reopen komga. komga.log

java.io.IOException: com.github.gotson.nightmonkeys.heif.HeifException: Unsupported feature: Unsupported codec
    at com.github.gotson.nightmonkeys.heif.imageio.plugins.HeifImageReader.read(HeifImageReader.java:118) ~[imageio-heif-0.6.2.jar:0.6.2]
    at net.coobird.thumbnailator.tasks.io.InputStreamImageSource.readImage(Unknown Source) ~[thumbnailator-0.4.20.jar:0.4.20]
    at net.coobird.thumbnailator.tasks.io.InputStreamImageSource.read(Unknown Source) ~[thumbnailator-0.4.20.jar:0.4.20]
    at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.read(Unknown Source) ~[thumbnailator-0.4.20.jar:0.4.20]
    at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source) ~[thumbnailator-0.4.20.jar:0.4.20]
    at net.coobird.thumbnailator.Thumbnails$Builder.toOutputStream(Unknown Source) ~[thumbnailator-0.4.20.jar:0.4.20]
    at org.gotson.komga.infrastructure.image.ImageConverter.resizeImageToByteArray(ImageConverter.kt:99) ~[komga-1.11.1-plain.jar:na]
    at org.gotson.komga.domain.service.BookAnalyzer.generateThumbnail(BookAnalyzer.kt:192) ~[komga-1.11.1-plain.jar:na]
    at org.gotson.komga.domain.service.BookLifecycle.generateThumbnailAndPersist(BookLifecycle.kt:125) ~[komga-1.11.1-plain.jar:na]
    at org.gotson.komga.application.tasks.TaskHandler.handleTask(TaskHandler.kt:95) ~[komga-1.11.1-plain.jar:na]
    at org.gotson.komga.application.tasks.TaskProcessor.takeAndProcess(TaskProcessor.kt:63) ~[komga-1.11.1-plain.jar:na]
    at org.gotson.komga.application.tasks.TaskProcessor.processAvailableTask$lambda$2(TaskProcessor.kt:51) ~[komga-1.11.1-plain.jar:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
Caused by: com.github.gotson.nightmonkeys.heif.HeifException: Unsupported feature: Unsupported codec
    at com.github.gotson.nightmonkeys.heif.Heif.check(Heif.java:182) ~[imageio-heif-0.6.2.jar:0.6.2]
    at com.github.gotson.nightmonkeys.heif.Heif.checkError(Heif.java:177) ~[imageio-heif-0.6.2.jar:0.6.2]
    at com.github.gotson.nightmonkeys.heif.Heif.decode(Heif.java:132) ~[imageio-heif-0.6.2.jar:0.6.2]
    at com.github.gotson.nightmonkeys.heif.imageio.plugins.HeifImageReader.read(HeifImageReader.java:116) ~[imageio-heif-0.6.2.jar:0.6.2]
    ... 14 common frames omitted

it;s looks show heif.HeifException: Unsupported feature: Unsupported codec. DLRAW.TO_00001.zip this is my avif zip with one page.

gotson commented 3 months ago

where can found the startup log? when i right click komga icon, and show log file , it just get the komga.log.

It's just the first lines of the log file, but sometimes when log file rolls, it's missing in the file.

The library is loaded properly:

2024-07-17T15:59:27.451+08:00  INFO 21192 --- [main] c.g.g.n.h.i.plugins.HeifImageReaderSpi   : Loaded libheif v1.17.5

2024-07-17T15:59:27.458+08:00  INFO 21192 --- [main] o.g.k.i.image.ImageConverter             : Supported read mediaTypes: [image/vnd.wap.wbmp, image/jpeg, image/x-portable-graymap, image/bmp, image/x-windows-pcx, image/gif, image/x-pc-paintbrush, image/x-raw, image/webp, image/heif-sequence, image/x-pcx, image/heic-sequence, image/avif, image/x-portable-bitmap, image/heif, image/heic, image/x-jb2, image/png, image/pcx, image/x-windows-bmp, image/x-webp, image/jpeg2000, image/jp2, image/x-bmp, image/x-png, image/x-portable-pixmap, image/x-jbig2, image/tiff, image/x-tiff, image/x-portable-anymap, image/jxl]

The issue is in the decoding, could be something wrong with the file or codec. I'll check it out.

gotson commented 3 months ago

The library works with your test image, so there must be an issue with libheif dll not loading the AOM codec. I don't have a windows machine to troubleshoot though, so there's not much i can do.

acer1204 commented 3 months ago

The library works with your test image, so there must be an issue with libheif dll not loading the AOM codec. I don't have a windows machine to troubleshoot though, so there's not much i can do.

Q1. Let me test using the Docker version of Komga on Windows 11 to see if the issue is only present in the Windows Store version.

A1. I have tested the Komga Docker version on Windows 11, and the AVIF zip preview images are working correctly. Synology docker version working correctly.

It's only failed show preivew cover with windows store version.

Q2, which version has better performance, the Docker version or the Windows Store version?

gotson commented 3 months ago

which version has better performance, the Docker version or the Windows Store version?

shouldn't be any difference

gotson commented 2 months ago

i've managed to reproduce the issue in a Windows CI environment, the dlls shipped with the windows app can't handle AVIF. I am trying to build new ones that will work.

github-actions[bot] commented 2 months ago

🎉 This issue has been resolved in 1.11.3 (Release Notes)