navidrome / navidrome

🎧☁️ Modern Music Server and Streamer compatible with Subsonic/Airsonic
https://www.navidrome.org
GNU General Public License v3.0
11.24k stars 839 forks source link

Extract artist artwork from embedded images #1869

Closed Igorgro closed 2 weeks ago

Igorgro commented 1 year ago

Original title: Navidrome selects wrong cover from FLAC files

Description

Navidrome selects wrong cover from FLAC files. When there are two coves in the FLAC file: the front album art and the artist art, Navidrom selects artist art cover and shows it as the album art in the interface. This only affects FLAC files and not the MP3 files.

Expected Behaviour

The front album art cover is selected as the album art in the interface

Steps to reproduce

  1. Upload an album of the FLAC files which contains two covers: album art and artist art
  2. Open album in the Navidrome web interface
  3. See wrong cover is seleted from the FLAC files

    Platform information

    • Navidrome version: v0.47.5
    • Browser and version: Google Chrome 105.0.5195.102, but not sure that this matters
    • Operating System: Debian 11, native Navidrome installation

Additional information

See attached screenshot:

  1. The first album is MP3 and it contains both front cover art and the artist art and everything here works well
  2. The third album is FLAC and contains only front cover art and everything is ok
  3. The second and the fourth albums are FLAC and contain both front cover art and the artist art and this is where the bug behavior appears
  4. (Not sure if it is another bug) Does the artist art should appear instead of big grey star at the top of the screenshot?

    • Screenshots (please remove if this is a copyrighted content, it is used only for demonstration purpose):

image

If it may help somehow I can email this FLAC files to those who wants to reproduce this bug.

Vista2003 commented 1 year ago

The grey star is a placeholder when Navidrome can't get an artist photo. You will need to connect your Navidrome to Last.FM or Spotify for the star to actually show an artist (if the artist is on those platforms)

Igorgro commented 1 year ago

Why not to extract it from meta info?

Vista2003 commented 1 year ago

Because an artist photo doesn't exist in the metadata

Igorgro commented 1 year ago

If so, why can I set it for example in Kid3 (ID3 tag editor for KDE)? image

metalheim commented 1 year ago

You can attach Artist pictures in metadata, but its not currently read out by navidrome, nor used in any other fashion. For background information, theres lenghty discussions about how to fetch artist images in issue #394

Currently, navidrome can only get artist images from metadata provider spotify. This needs a spotify (free or paid doesnt matter) account and the apikey need to be configured in navidrome.

Igorgro commented 1 year ago

but its not currently read out by navidrome

But why does this bug (which described in the issue) persist?

Vista2003 commented 1 year ago

but its not currently read out by navidrome

But why does this bug (which described in the issue) persist?

To me, this doesn't seem like a bug, it seems more like a lack of a feature probably because it's easier to use someone else's service to pull that data and there are more higher priority things that need sorting first.

You can "resolve" the issue by connecting Navidrome to Spotify's APIs

Igorgro commented 1 year ago

Well, if you read carefully it is not about a gray star, but rather abut wrong selection of album art from flac files

crazygolem commented 1 year ago

I investigated this issue a few weeks ago. The problem is that navidrome currently doesn't mapping support picture types, and will just request any image from the underlying library.

For MP3s, the underlying lib returns the first image in the data stream, but for some reason for FLACs it will return the last one. It is just a coincidence that nobody noticed for MP3s yet; I assume that most people add the cover picture before the other pictures when they tag their collection.

So a quick workaround would be to reorder the pictures in the FLAC file's data stream, and insert the "main cover" last so that navidrome picks it up when displaying covers. If your tagging software doesn't allow to reorder pictures (and I don't know of any that does), you'd have to delete all of them, and then re-add them in the desired order (I tried it out with mp3tag).

Ironically, adding support for artists' pictures from tags will also likely solve this issue, as it will likely have to be done by adding support for mapping picture types as suggested in https://github.com/navidrome/navidrome/issues/394#issuecomment-799501347

Igorgro commented 1 year ago

I'm not sure if it shows the correct order but in Kid3 editor the artist art always goes after album front art.

UPD. Yes, it sorts them exactly as in that list, you mentioned

deluan commented 1 year ago

Both ffmpeg and taglib supports multiple embedded images. Ex output from ffmpeg:

  Duration: 00:04:13.96, start: 0.000000, bitrate: 831 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Side data:
      replaygain: track gain - -6.080000, track peak - 0.000021, album gain - -6.080000, album peak - 0.000021,
  Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 953x953 [SAR 200:200 DAR 1:1], 90k tbr, 90k tbn (attached pic)
    Metadata:
      comment         : Cover (front)
  Stream #0:2: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 742x743 [SAR 72:72 DAR 742:743], 90k tbr, 90k tbn (attached pic)
    Metadata:
      comment         : Artist/performer
      title           : 0019905298_10.jpeg

Unfortunately, they are only used to detect the presence of embedded images, not to extract them. The https://github.com/dhowden/tag package, used extract embedded images does not support it, and returns a random one if there are multiple images.

The solution would be to start extracting images using taglib and/or ffmpeg, and store their references in the DB. But unfortunately I don't have bandwidth to work on this right now.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Navidrome team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

Igorgro commented 1 year ago

Please, don't close this!

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Navidrome team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

Mladia commented 7 months ago

The issue is that the embedded images are not handled properly.

Example 1:

foobar:

image

Navidrome:

image

Actual: The artist icon is spinning beside Now Playing instead of the disc icon, The artist icon is empty:

image

Example 2:

foobar:

image

Navidrome:

image

Acutual The Disc icon is displayed as Front cover (and also spinning besides Now Playing which is actually correct)

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Navidrome team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.