hoyon / mpv-mpris

MPRIS plugin for mpv
MIT License
607 stars 35 forks source link

Cover image in opus file is not shown in KDE media control in system tray #64

Open shmerl opened 2 years ago

shmerl commented 2 years ago

When playing an opus file which contains a cover image with mpv, it's not propagating through mpris.

I think it's a problem with mpv-mpris, since mpv shows the image in the window itself and reports using a cover art when run from the terminal. And when playing it with vlc, it shows up there fine.

If you think it's an issue with mpv itself, I can open a bug there too.

shmerl commented 2 years ago

Here is a file you can test it on (run it in a loop, it's pretty short):

test.zip

hoyon commented 2 years ago

Yes this is a known limitation of mpv-mpris. Only external album art is currently supported and the test file you provided uses an embedded image.

Although now that I think about it, it might be possible to use mpv's screenshot command to make this work. I'll have a play around with that when I have some time. PRs also welcome.

shmerl commented 2 years ago

Is it a limitation of mpris protocol itself (i.e. it's impossible a normal way without such hacks like making a temporary external file), or mpv-mpris is just not implementing some features yet? How does it work for VLC for example?

I'd be interested in looking into it, if there is some correct solution.

shmerl commented 2 years ago

mpv itself somehow recognizes that embedded image is a cover art and displays it. May be mpv-mpris can query that data from mpv itself? I'm looking through the code to try to understand what the plugin is doing now.

shmerl commented 2 years ago

OK, I see it's doing try_put_local_art(mpv, dict, path); now. I'll look into mpv itself, may be its library has some kind of function for getting the cover art or if not, I can open a feature request there. There is no need to duplicate that code.

shmerl commented 2 years ago

Looking also into how VLC handled embedded cover image:

https://github.com/videolan/vlc/blob/master/modules/meta_engine/taglib.cpp#L780 https://github.com/videolan/vlc/blob/master/modules/meta_engine/taglib.cpp#L830

shmerl commented 2 years ago

I'm not sure I understand it fully, but I think VLC reads base 64 encoded metadata, decodes into binary, and somehow handles that later. I.e. might be not even writing any file, just using the data from memory.