HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: foxyshadis on 2019-11-06 06:06:32

Title: Possible to add alternate cover format support?
Post by: foxyshadis on 2019-11-06 06:06:32
Right now, fb2k only seems to have support for good old jpeg, png, and gif covers. I'm looking into converting some of mine to AVIF, even though it's fairly new, but obviously foobar doesn't support that. Strange thing -- as soon as I put the file in the folder, foobar no longer shows the cover, only a blank placeholder, even though no *.avif is present in the cover list at all. That might be a bug.

But my real request is, is it possible to add new image format support through a plugin, like audio formats? I'd like to try making one (and I'd probably add HEIF if I ever make it public), I'm just not sure where to look for that API.
Title: Re: Possible to add alternate cover format support?
Post by: Tomio on 2019-11-06 13:55:29
It would be very nice to have the rating stars in the library next to the listed tracks, the same as on the right of playlist.  I think this way you could individually send tracks to the playlist based on rating.  I know you can probably do this in the properties dialog.  As I see it, right now you can't easily see the track rating until send and drag the album to the playlist. I can't say that I am an expert as the use of Foobar.
Title: Re: Possible to add alternate cover format support?
Post by: jazzthieve on 2019-11-06 15:24:59
It would be very nice to have the rating stars in the library next to the listed tracks, the same as on the right of playlist.  I think this way you could individually send tracks to the playlist based on rating.  I know you can probably do this in the properties dialog.  As I see it, right now you can't easily see the track rating until send and drag the album to the playlist. I can't say that I am an expert as the use of Foobar.

Why are you posting this on this topic?
TOS #5 violation? You don't just change topics to your liking.
Title: Re: Possible to add alternate cover format support?
Post by: punkrockdude on 2020-10-16 13:33:55
Any news on .avif support?
Title: Re: Possible to add alternate cover format support?
Post by: foxyshadis on 2022-01-01 12:31:50
I'm still curious about this and I'm willing to do the heavy lifting to tie it into libheif or libavif, there's just nothing I can find in the SDK pointing a way forward. WebP was quietly added to the core a few months ago, I don't know if that had ever even been requested? It's an OK alternative for now, even if it has even more limitations than jpeg.
Title: Re: Possible to add alternate cover format support?
Post by: marc2k3 on 2022-01-01 15:16:58
Columns UI supports HEIF/avif. I tested both just now. You'll need the extensions from the windows 10 store - not sure if it's possible on earlier version of windows. foobar2000 not supporting them isn't an issue because the SDK provides a chunk of data (album_art_data_ptr) and it's up to developers to decode the contents in to something usable. The CUI developer does this by using WIC (windows imaging component). Of course this means it's only available in the built in CUI playlist view/album art panel. The source code is on github if you fancy looking.

FWIW, having support built in to foobar2000 doesn't really add much unless you are desperate to use the default UI album art viewer. It doesn't magically enable support for other components. If they're not updated, they will be oblivious to any "core" support. For example SimPlaylist and Facets are massively popular DUI components but they were last updated 10 years ago. They'll never have support for exotic formats no matter what anyone else does. You would need the source code to update them and that isn't happening.


Title: Re: Possible to add alternate cover format support?
Post by: foxyshadis on 2022-01-02 07:38:47
Those comments are very helpful, I assumed it was a core service that each format might be handled or at worst overridden, not baked into each UI which then offers its own extension points or not. Now not surprising that nothing like it is found in the SDK.

I have the WIC hevc and just retested with heif, and it does seem to work, though I'm still having trouble with avif. Oh well, it's something, I'll see what I can do.
Title: Re: Possible to add alternate cover format support?
Post by: marc2k3 on 2022-01-02 07:56:02
You'll need AV1 video extension for avif.

Title: Re: Possible to add alternate cover format support?
Post by: foxyshadis on 2022-02-13 18:12:31
Coming back around to this, Foobar2000 only supports 8-bit formats, which is a major bug now that 10-bit is the standard for newer codecs, not the 8-bit of older codecs.

It took a while to narrow down why I couldn't see many AVIF files. Well, AVIF is usually 10-bit. I was able to transcode them into 8-bit, which massively increased the size, but that shouldn't be necessary. WIC can do 10-bit. If Foobar2000 uses WIC, there's no reason beyond a bit of coding to make 10-bit display, even if it's converted to 8-bit RGB. (Which is much higher fidelity than 8-bit YUV, the main reason to use 10-bit in a non-HDR environment.)
Title: Re: Possible to add alternate cover format support?
Post by: musicmusic on 2022-02-13 21:04:31
As far as Columns UI goes, it's already set up to convert images to 32bpp, but I'm afraid WIC is giving it an inexplicable 'Not implemented' error when it tries to read the pixel data after the conversion.

A debugger is also showing this error:

Exception thrown at 0x7787B812 (KernelBase.dll) in foobar2000.exe: WinRT originate error - 0x80004001 : 'No scaler found for format'.

(Which is odd, as there's no scaling involved.)

I haven't been able to find a workaround, I'm afraid.

Also note that I found the WIC codec buggy when it comes to AVIF files using 4:2:2 or 4:4:4 chroma subsampling. (If the Windows Photo app can't display the image, then the problem is the codec.)
Title: Re: Possible to add alternate cover format support?
Post by: foxyshadis on 2022-02-13 21:53:16
Exception thrown at 0x7787B812 (KernelBase.dll) in foobar2000.exe: WinRT originate error - 0x80004001 : 'No scaler found for format'.

(Which is odd, as there's no scaling involved.)

I don't know about WIC specifically, but in DirectX everything is through a scaler and/or custom shader, whether it's color format conversions or bit depth conversion.

Also note that I found the WIC codec buggy when it comes to AVIF files using 4:2:2 or 4:4:4 chroma subsampling. (If the Windows Photo app can't display the image, then the problem is the codec.)
Oddly enough, I have no problem with 4:4:4 as long as it's 8-bit.

This whole reliance on what the OS giveth is why it'd be nice to incorporate something more cross-platform, since even various Windows versions can feel like a cross-platform nightmare!
Title: Re: Possible to add alternate cover format support?
Post by: musicmusic on 2022-02-13 23:20:59
There is another option I can investigate actually. Let me see if it's any better...

BTW it does seem to be the HEIF extension doing the decoding here.

Edit: Correction, seems like both the HEIF and AV1 extensions are involved.
Title: Re: Possible to add alternate cover format support?
Post by: musicmusic on 2022-02-16 20:57:23
10-bit 4:2:0 images work fine in Columns UI on every Windows 11 machine and VM I tried. The same versions of the HEIF and AV1 extensions are reported as are for my Windows 10 machine. Make of that what you will.

I also tried using the Windows Runtime API from a test 64-bit app on Windows 10 and got the exact same errors as from WIC, sadly.
Title: Re: Possible to add alternate cover format support?
Post by: kode54 on 2022-02-17 01:54:13
Oh no, now people will have to actually upgrade their OS to get new functionality. What a shocker.
Title: Re: Possible to add alternate cover format support?
Post by: mudlord on 2022-02-18 06:01:58
would have thought people using ffmpeg or smth to decode these image formats :/ whole dependancies just for picture/video formats.
Title: Re: Possible to add alternate cover format support?
Post by: kode54 on 2022-02-18 22:41:12
The bundled FFmpeg only handles audio formats. Handling lots of image formats increases its size considerably.
Title: Re: Possible to add alternate cover format support?
Post by: foxyshadis on 2022-02-18 23:04:18
Mostly because it statically bundles a ton of various image libraries. (And ImageMagick is an entire more painful kettle of fish.) I totally understand, whether it's Media Foundation or ffmpeg, it's so much simpler and less buggy to write for one API that's probably already in the OS instead of dozens of individual libraries'.
Title: Re: Possible to add alternate cover format support?
Post by: musicmusic on 2022-02-19 09:51:40
I could allow for an external magick.exe to be provided and use that with standard input and output to decode the images. (Although, it just writes the input image to a temporary file, it seems.)

As for Windows 10, there is a feature update scheduled for H2 (though it remains to be seen what exactly it will include...)
Title: Re: Possible to add alternate cover format support?
Post by: musicmusic on 2022-02-19 14:19:26
The 10-bit 4:2:0 AVIF image I was testing with miraculously starting working on my Windows 10 machine. I'm not sure what exactly triggered it, but I installed the KB5010415 preview update and it started working after a reboot. The AV1 extension also shows as having being updated today (the version is now 1.1.50332.0).