Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
442 stars 60 forks source link

Pictures not showing in Spotify #210

Closed nlogozzo closed 11 months ago

nlogozzo commented 11 months ago

Hi,

We received this issue for Tagger in which embedded pictures are not being show in Spotify (if you didn't know, yes Spotify client can play local files...I learned that too).

We set pictures in Tagger via the following code:

track.EmbeddedPictures.Add(PictureInfo.fromBinaryData(FrontAlbumArt, PictureInfo.PIC_TYPE.Front));
track.EmbeddedPictures.Add(PictureInfo.fromBinaryData(BackAlbumArt, PictureInfo.PIC_TYPE.Back));

where FrontAlbumArt and BackAlbumArt are byte[] of jpg images.

I tried changing the PIC_TYPE to Generic but that also didn't work.

--

Spotify only provides these requirements on cover art...the only thing I'm thinking is that this is not happening and thus not showing in Spotify:

Encoded with an sRGB color space, 24bits per pixel, with color profiles applied directly Don’t upscale images. We also don’t support embedded color profiles and orientation metadata.

Can you in the library encode added pictures in sRGB space with 24bits per pixel with profiles applied directly? Is that even possible?

Zeugma440 commented 11 months ago

Hey Nick 😄

The code you posted looks fine. I'd bet the issue is within the requirements you underlined.

TIFF, PNG, or JPG format using lossless encoding At least 640px wide and tall 1:1 aspect ratio Encoded with an sRGB color space, 24bits per pixel, with color profiles applied directly

ATL is not (and won't be) an image processing library, so all of these requirements should be checked before you embed the picture into the MP3.

Maybe create a "Is my picture Spotify-ready?" feature that analyzes the submitted cover and fires a warning if these requirements aren't met?

nlogozzo commented 11 months ago

Maybe create a "Is my picture Spotify-ready?" feature that analyzes the submitted cover and fires a warning if these requirements aren't met?

Yes I guess I'll have to eventually do something like this

Sounds good...thanks :)

nlogozzo commented 11 months ago

Reopening as it turns out it has nothing to do with image manipulation...I believe it might be the way ATL stores pictures...

Using the program EarTag (python based) that uses mutagen stores the album art without an image modification and it shows in Spotify no problem.

I first believed it was because I was saving art with Front/Back PicType but even using Generic it still doesn't show...

Zeugma440 commented 11 months ago

Using the program EarTag (python based) that uses mutagen stores the album art without an image modification and it shows in Spotify no problem.

Could you upload such a tagged file ? I'm not sure I want to install EarTag and its pre-requisites to edit one single file.

Nvm, most of my files are displayed properly in Spotify.

I'll keep you updated

nlogozzo commented 11 months ago

Could you upload such a tagged file ? I'm not sure I want to install EarTag and its pre-requisites to edit one single file. Nvm, most of my files are displayed properly in Spotify.

No worries here they are anyway just in case they are of use. They are the same exact file just one has album art added from eartag and one has album art added from Tagger:

EarTag: EarTag.zip Tagger: Tagger.zip

Note let's not have this block the release of the lyrics fixes. This isn't that important as the lyrics fixes that I need for Tagger's release tomorrow

Zeugma440 commented 11 months ago

A few things I noticed when testing : 1/ The EarTag file you provided doesn't work either on Spotify (installed v1.2.18.999.g9b38fc27) 2/ Forcing ATL to write ID3v2.3 tags (Settings.ID3v2_tagSubVersion = 3) works 3/ There's a way to make it work with ID3v2.4 too, as MP3tag writes readable image tags - currently investigating that lead

Zeugma440 commented 11 months ago

Got it!

You should use the new flag Settings.ID3v2_writePictureDataLengthIndicator = false for the picture to show in Spotify.

nlogozzo commented 11 months ago

Got it!

You should use the new flag Settings.ID3v2_writePictureDataLengthIndicator = false for the picture to show in Spotify.

Thank you! Can't wait to try it :)

nlogozzo commented 11 months ago

Got it!

You should use the new flag Settings.ID3v2_writePictureDataLengthIndicator = false for the picture to show in Spotify.

Is there any issue if I keep this flag always false...i.e. should I only have it false if the user wants it to work on Spotify? Or does it not matter?

Zeugma440 commented 11 months ago

Available on today's v5.04

Is there any issue if I keep this flag always false...i.e. should I only have it false if the user wants it to work on Spotify? Or does it not matter?

According to the specs, it's an optional flag, so I think you can keep it forced to false. As for myself, that field has been there for a while. I think I added it to have more metadata available, but I don't remember it needing to be there for any reason.

nlogozzo commented 11 months ago

ok sounds good...thanks so much for everything!!

nlogozzo commented 11 months ago

Can confirm it works now!! image