chr56 / Phonograph_Plus

A semi-active fork of kabouzeid/Phonograph -- a revived classic material designed music player for Android
GNU General Public License v3.0
413 stars 20 forks source link

[Unexpected Behavior] random thumbnails/artwork #6

Closed elesto closed 1 year ago

elesto commented 2 years ago

I use the music player in folder view. I have a folder with 10 songs in it all with different artwork embedded. The artwork displays fine in the tiny folder view icons but when playing the song the artwork defaults to a seemingly random artwork in that folder and displays it for each song in the folder. This is true for the notification widget and the song playing window. I used yt-dlp which uses ffmpeg to embed the artwork from YouTube.com.

Selecting "ignore media store covers" fixes it but slows down loading time. Its a workaround that I use for now.

How to reproduce

  1. Find a few different songs or even videos on youtube
  2. use yt-dlp to save audio
  3. yt-dlp -x -f bestaudio --audio-quality 5 --audio-format mp3 --embed-thumbnail --write-sub --sub-lang en --convert-subs lrc --add-metadata "YT URL HERE"
  4. Put the files in a folder and use folder view to view, you should see all thumbnails correctly shown.
  5. Play the first file and then switch to player and look at the thumbnail. They should all be the same random image.
chr56 commented 2 years ago

Sorry, I don't really understand what you want to describe. Maybe it's the fault of your system's Media Store (providing messy random thumbnail🤔)?

elesto commented 2 years ago

When playing a song the thumbnails displayed are wrong. The app chooses a seemingly random thumbnail from my songs and displays it for every song in that folder.

Im not a dev so I dont know the details about androids media store. Have you been able to reproduce this using my example? I can help you troubleshoot.

chr56 commented 2 years ago

When playing a song the thumbnails displayed are wrong. The app chooses a seemingly random thumbnail from my songs and displays it for every song in that folder.

Im not a dev so I dont know the details about androids media store. Have you been able to reproduce this using my example? I can help you troubleshoot.

Are your thumbnails embedded in song files?

elesto commented 2 years ago

Yes I use yt-dlp for this. I use this command yt-dlp -x -f bestaudio --audio-quality 5 --audio-format mp3 --embed-thumbnail "https://www.youtube.com/watch?v=iZ0Jm_EqXd0"

It uses ffmpeg to embed the thumbnail I think

chr56 commented 2 years ago

Well, I used yt-dlp to try steps you said. Here is the conclusion:

Yes, you're right. But why?

I checked MediaStore databases and used ffmpeg to read metadata (aka. "Music Tags"), and found that yt-dlp doesn't write any music tags (such as Artist, Album, Year etc.) into songs. And since these files were put into one folder and files were not tagged with Album, so Android take the folder name (actually containing path but not showing) as these files' Album name. However, now here is the key point: MediaStore only read album covers (and save this albums thumbnail in dir './thumbnail' under music path), and as we known, an Album has only a cover artwork traditionally, so MediaStore randomly chooses artwork of any of song files in the same album as Album cover. As a result, when fetching files downloaded by yt-dlp, Phonograph Plus fetches from MediaStore but only obtaining thumbnail that Android supposes , however, that is not true. This is just thumbnail just belongs to any file under this folder because Android "thinks" they belong to one album, but actually every file has a distinct (video) thumbnail, MediaStore is "wrong".

But how to fix? (temperately)

  1. do not put them into one folder;
  2. toggle on ignore media store covers (Phonograph Plus then fetches directly from file bypassing thumbnail MediaStore provided);
  3. add distinct Album tags to these downloaded files. WARNNING: Try not to use Phonograph Plus's tag editor in high version Android, editor is unmaintained now and a kind of "rusty" and "shaky".
elesto commented 2 years ago

Thanks for investigating! Im using "ignore media store covers" as workaround for now. So basically a fix for this isnt possible because its a fault of yt-dlp

chr56 commented 2 years ago

Thanks for investigating! Im using "ignore media store covers" as workaround for now. So basically a fix for this isnt possible because its a fault of yt-dlp

😂Actually, in the future, I am planning to add a preference to allow ”ignore media store covers when tags are not complete” for those songs like this. This is a compromise that it can let songs with complete tags using MediaStore thumbnails while let songs with no tags using directly fetched thumbnails from file.

But, considering there are some more important works to do and codes about thumbnails loading are not easy to modify (gently and elegantly) , the plan would be postponed (to next month?🤔).

chr56 commented 1 year ago

It's been over 1 year.

We have Trouble Shooting & FAQ now. Close!