Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Wish for v1.5: FLAC album art padding awareness (Read 7426 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Wish for v1.5: FLAC album art padding awareness

Hi.

I have a wish for v1.5 and the song properties rework: show picture size (padding) and, when removing from FLAC file, show a warning:

Quote
You are going to remove W album art from X FLAC files of Y KB each.
If you do not re-encode the file, the padding use to integrate the file into the FLAC will remain.
Foobar2000 can re-encode the file to remove the padding. Removing the padding will save Z KB total.

[ ] Do not show again - Foobar2000 will do the selected action for future removals.
* Cancel action
* Remove padding from files
* Keep padding

At the opposite, we must inform users that inserting images in FLAC files will increase padding but most (if not all) software won't remove said padding if the file is not re-encoded.
Quote
You are about to embed pictures into FLAC files.
Please consider that, if you are to remove them or replacing them with smaller artwork in the future, that the space added into the file in order to insert the image isn't automatically removed, like with MP3s, until the file is re-encoded. You can use the Song Properties again and remove the artwork and ask to remove the padding here in Foobar2000. However, keep in mind that, if you remove it with another software that the image will be gone but not the padding.

[ ] Do not show again
* Proceed.
* Cancel.

Additionally, the default option can be set in the options if the messages have been set to do not be shown.

I really want this to happen and raise awareness of this weakness of the FLAC format. Not a lot of people know about this.

The only downside to having to re-encode the file, it's that the next time writing tags will be slow but the next sub-sequent writes will return to fast. Oh and, make the padding size CLEAR and VISISBLE under he picture. Not a line in the extended info dialogue. Bonus points if Foobar2000 detects padding but no pictures, a "remove padding" option appears if the size is larger than a user-defined size (default could be 25KB). The padding can be shown for other format but is less important than FLAC files as the padding is removed when the picture is removed.

Cheers.

EDIT:
I've just seen a screenshot of the new dialog. One thing's for sure, the size is clearly displayed! Nice. Now, to know if the rest of wishes can come true.

Re: Wish for v1.5: FLAC album art padding awareness

Reply #1
It would be awesome if foobar2000 had a tool that says the padding of a flac file.

I have lot of alubums in a single file and probably some of them have padding, because of previous artwork being very big and I replaced it by 600x600 artwork.


Re: Wish for v1.5: FLAC album art padding awareness

Reply #3
Padding removal should have an option for keeping around 512 bytes of padding for updating textual tags in the future. This can be accomplished manually by adding a temporary, sufficiently long field before size optimization, but is not an elegant solution.

Re: Wish for v1.5: FLAC album art padding awareness

Reply #4
Can you use this button (optimize size) for removing the padding of previous embeded artwork??
https://ibb.co/B2Tz8C8







Re: Wish for v1.5: FLAC album art padding awareness

Reply #5
Windows* allocates storage for files in "chunks", where chunk sizes are multiples of disk sector sizes (typically 512 bytes). Often the allocation is in groups of sectors, typically 4K or 8K in size (although much larger sizes are possible). Trimming all of the padding in a FLAC file out will not necessarily save any disk space. You can see this by looking at the properties of files on disk. For example, I have a small text file and Properties shows:

Size:               5.51 KB (5,648 bytes)
Size on disk:  8.00 KB (8,192 bytes)

In this case, you can see that space is always allocated in 8KB units. Trimming all the padding out so a file is less than 8KB won't save any space. The space will be allocated on disk, even if the file isn't using it.

So, with FLAC files, trimming all of the unused padding out of the file will not save any more space than trimming the padding down until the file is exactly a multiple of 8KB (in this case) in size. That will leave, on average, 4KB of padding in the file, so many changes to metadata will not need to resize the file. Of course, there will be cases where the remaining padding is tiny and almost any change to metadata will require reallocation, but with an average of 4KB padding left over, that won't happen very often.

So, trim padding only until the file is a multiple of 8KB (in this case) and you will save all the disk space you can save, and will still minimize reallocation when metadata changes.

Mike

* I presume Linux and MacOS will also allocate space in chunks larger than a single sector size, but don't know that for a fact. But even if they don't, truncating padding down until the file size is exactly a multiple of the sector size will still maximize savings on disk and minimize the number of reallocations.



Re: Wish for v1.5: FLAC album art padding awareness

Reply #8
This article might be useful to you: https://captainrookie.com/viewing-metadata-padding-size-using-mp3tag/

Requires the file to have no cover art. The code
$div($sub(%_tag_size%,%_cover_size%),1024)
will work if there is at most one picture attached. (Edit: I don't know any Mp3tag field for total cover size? Doesn't look like there is one.)

Re: Wish for v1.5: FLAC album art padding awareness

Reply #9
This article might be useful to you: https://captainrookie.com/viewing-metadata-padding-size-using-mp3tag/

Requires the file to have no cover art. The code
$div($sub(%_tag_size%,%_cover_size%),1024)
will work if there is at most one picture attached. (Edit: I don't know any Mp3tag field for total cover size? Doesn't look like there is one.)
You're right that the captainrookie code for "show excess padding" will show a number that includes the size of the existing cover art, so in that case it's not EXCESS padding.  Thanks Porcus for your own code, which does indeed just show "true" excess padding, ignoring that required to store the existing cover art.  Yeah too bad about the lack of a "total covers size" variable so it could be all-inclusive but at least yours covers (pardon the pun) most cases.