[PR #4988] Issue 3697: extract largest cover art & ignore 1x1 #4393

Open
opened 2026-04-25 00:19:35 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4988
Author: @lieut-data
Created: 1/16/2026
Status: 🔄 Open

Base: masterHead: issue-3697-extract-largest-cover-art


📝 Commits (1)

  • 55f75d2 extractCoverArt should use the largest "video stream", ignoring <= 1x1

📊 Changes

2 files changed (+278 additions, -17 deletions)

View changed files

📝 server/utils/ffmpegHelpers.js (+60 -16)
📝 test/server/utils/ffmpegHelpers.test.js (+218 -1)

📄 Description

Brief summary

Some audiobook files have "video streams" (aka cover art) that is a 1x1 placeholder image. Ignore these, and when multiple cover arts exist, always pick the biggest one.

Which issue is fixed?

Fixes #3697

In-depth Description

I have an audio book, A Christmas Carol (Dramatized) which just renders with a black cover art in Audiobookshelf:

Screenshot 2026-01-15 at 9 24 27 PM

when I go to edit the cover art, I see the size is just 1x1:

Screenshot 2026-01-15 at 9 49 59 PM

but the cover art shows up normally in MacOS:

Screenshot 2026-01-15 at 9 58 19 PM

With the changes in this pull request, extractCoverArt is modified to ignore any "video stream" with dimension <= 1, and furthermore if there are multiple remaining options, to always pick the biggest one. It identifies these streams with an additional call to ffprobe after which it uses the normal (but tweaked) call to ffmpeg.

How have you tested this?

I tested this locally with my audiobook file, deleting and recreating the library to force it to reprocess the cover art. I've also added unit test coverage to boot. This results in the cover art being extracted correctly:

Screenshot 2026-01-15 at 9 23 29 PM

Finally, I built the Docker image and deployed it to my service and verified that all affected audiobooks now show cover art. Before, lots of missing or auto-generated cover art:

Screenshot 2026-01-15 at 10 16 59 PM

And with this change:

Screenshot 2026-01-15 at 10 23 51 PM

Screenshots

(See inline above.)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/4988 **Author:** [@lieut-data](https://github.com/lieut-data) **Created:** 1/16/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `issue-3697-extract-largest-cover-art` --- ### 📝 Commits (1) - [`55f75d2`](https://github.com/advplyr/audiobookshelf/commit/55f75d2b31986775e0a57f1e7075b455eafee6b8) extractCoverArt should use the largest "video stream", ignoring <= 1x1 ### 📊 Changes **2 files changed** (+278 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/ffmpegHelpers.js` (+60 -16) 📝 `test/server/utils/ffmpegHelpers.test.js` (+218 -1) </details> ### 📄 Description ## Brief summary Some audiobook files have "video streams" (aka cover art) that is a 1x1 placeholder image. Ignore these, and when multiple cover arts exist, always pick the biggest one. ## Which issue is fixed? Fixes #3697 ## In-depth Description I have an audio book, A Christmas Carol (Dramatized) which just renders with a black cover art in Audiobookshelf: <img width="705" height="325" alt="Screenshot 2026-01-15 at 9 24 27 PM" src="https://github.com/user-attachments/assets/e3e7e85e-b029-4eee-bdd2-8018644cae9e" /> when I go to edit the cover art, I see the size is just 1x1: <img width="846" height="330" alt="Screenshot 2026-01-15 at 9 49 59 PM" src="https://github.com/user-attachments/assets/b3ec2317-3c1a-4562-a7d6-c6e05b15aaa3" /> but the cover art shows up normally in MacOS: <img width="203" height="229" alt="Screenshot 2026-01-15 at 9 58 19 PM" src="https://github.com/user-attachments/assets/089be35b-0b7b-4123-9fce-7c5f8ba0a848" /> With the changes in this pull request, `extractCoverArt` is modified to ignore any "video stream" with dimension <= 1, and furthermore if there are multiple remaining options, to always pick the biggest one. It identifies these streams with an additional call to `ffprobe` after which it uses the normal (but tweaked) call to `ffmpeg`. ## How have you tested this? I tested this locally with my audiobook file, deleting and recreating the library to force it to reprocess the cover art. I've also added unit test coverage to boot. This results in the cover art being extracted correctly: <img width="696" height="321" alt="Screenshot 2026-01-15 at 9 23 29 PM" src="https://github.com/user-attachments/assets/8bf6ffbd-8ddf-4ed5-b2da-76a5e5872e31" /> Finally, I built the Docker image and deployed it to my service and verified that all affected audiobooks now show cover art. Before, lots of missing or auto-generated cover art: <img width="1547" height="783" alt="Screenshot 2026-01-15 at 10 16 59 PM" src="https://github.com/user-attachments/assets/50c8bc1f-82fe-4174-8a9d-cd42a1851d4e" /> And with this change: <img width="1539" height="791" alt="Screenshot 2026-01-15 at 10 23 51 PM" src="https://github.com/user-attachments/assets/85e060a4-84ec-4716-96f9-3dd8d612bad8" /> ## Screenshots (See inline above.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:19:35 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4393