# Native option to remove padding from FLAC files

**URL:** https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637
**Category:** General Discussion
**Created:** [January 18, 2021, 12:22am UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637 "2021-01-18T00:22:00Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Lebon14](https://community.mp3tag.de/user_avatar/community.mp3tag.de/lebon14/32/8738_2.png) [@Lebon14](https://community.mp3tag.de/u/Lebon14)
#### Post date: [January 18, 2021, 12:22am UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/1 "2021-01-18T00:22:00Z")

</div>

Hi there.  
I can't believe MP3tag doesn't support removing the padding _and_ an option to show how much padding a FLAC file has and a warning to users when removing artwork from files.

Now, this is not a call for help. I know how to show the padding in FLAC files in MP3tag and how to remove them afterward. I'd just like Florian to incorporate it within MP3tag and not worry about forgetting to remove them from within Foobar2000.

So, a recap:

- Allow removing padding from FLAC files natively (either after the fact, or when saving tags)
- A way to show how much padding a FLAC file has without the column trick.
- Show a warning after removing artwork to user if padding wasn't removed and the option to do it.

Cheers.

P.S For those who don't know, you can create a column with this code and it will show the padding for all files. Right click the columns and click "Customize columns" and create a new column. Name it "Padding" (or whatever you want really) and copy this in the value field:  
`$div(%_tag_size%,1024)`  
...and click the check box "Numeric" and click OK. (Size in KB)

---

<div class="post-metadata">

### Author: ![Moshi](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/f07891/32.png) [@Moshi](https://community.mp3tag.de/u/Moshi)
#### Post date: [January 28, 2021, 8:36pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/2 "2021-01-28T20:36:01Z")

</div>

Also I can't find metaflac.exe anymore. [FLAC - download](https://xiph.org/flac/download.html) this doesn't have it (I dled flac-1.3.3.tar). Installing EAC also doesn't give it in the subfolders. Am I so stupid or what?

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [January 28, 2021, 8:49pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/3 "2021-01-28T20:49:59Z")

</div>

You need to get `flac-1.3.2-win.zip`, seems like they haven't uploaded a Windows build of latest 1.3.3. At least `metaflac` has no changes between the two versions.

I have padding removal on my list.

---

<div class="post-metadata">

### Author: ![astrohip](https://community.mp3tag.de/user_avatar/community.mp3tag.de/astrohip/32/18205_2.png) [@astrohip](https://community.mp3tag.de/u/astrohip)
#### Post date: [January 29, 2021, 1:41am UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/4 "2021-01-29T01:41:15Z")

</div>

Curiosity question: What is padding? Extra file length beyond what the tags use? It's not automatically removed/compressed?

I did a google search, but the results are very confusing.

Thanks.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [January 29, 2021, 8:17am UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/5 "2021-01-29T08:17:21Z")

</div>

> [@astrohip](#):
>
> What is padding?

Imagine you put 30 sheep into a pasture. Around this place you build a fence.  
Then you sell 20 sheep. The fence remains and the space for these 20 sheep remains unused. This unused space is called padding\*.  
The idea is that you might buy 20 sheep again someday and therefore let this space stay as "reserved".

\* _(as IT term of course, not for the animals 😉)_

---

<div class="post-metadata">

### Author: ![astrohip](https://community.mp3tag.de/user_avatar/community.mp3tag.de/astrohip/32/18205_2.png) [@astrohip](https://community.mp3tag.de/u/astrohip)
#### Post date: [January 29, 2021, 2:28pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/6 "2021-01-29T14:28:02Z")

</div>

Ok, I mostly get that (aside, my background is IT/programming, so I can follow the sheep 🙃). I guess what I'm asking is, how does padding concern us as Mp3tag users, or MP3 file users? Do all MP3 files have padding? Is it added each time I edit, or only when I change a tag for a smaller tag? I often edit images, for example from 250K to 45K. Is that space still there, unused? Should I be compressing? Is it automatic?

These are the types of questions I have. And I'm happy to research on my own, except as I said, googling this topic brings a bunch of info, most of which doesn't apply or make sense.

I have well over 25,000 MP3 files, using over 250GB of space. If I'm wasting electrons, I'd love to know it. And fix it.

Thanks!!

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [January 29, 2021, 2:56pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/7 "2021-01-29T14:56:13Z")

</div>

> [@astrohip](#):
>
> I have well over 25,000 MP3 files, using over 250GB of space. If I'm wasting electrons, I'd love to know it. And fix it.

That's easy:  
Check your favorite price compare service for an external 1 TB drive. Compare that price to the value of your wasted time saving some "electrons".  
I bet I know the answer...

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 29, 2021, 4:08pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/8 "2021-01-29T16:08:11Z")

</div>

Just to add something: AFAIK Mp3tag handles padding in chunks of 2k. HD drives may have a cluster size of 4k. So there is probably ample space for padding until any saving effect is noticeable.  
Ah, and yes: Mp3tag already handles padding for MP3 files. FLAC files currently get only expanded but not shrunk.

---

<div class="post-metadata">

### Author: ![astrohip](https://community.mp3tag.de/user_avatar/community.mp3tag.de/astrohip/32/18205_2.png) [@astrohip](https://community.mp3tag.de/u/astrohip)
#### Post date: [January 29, 2021, 4:28pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/9 "2021-01-29T16:28:08Z")

</div>

I won't disagree. Spending time to resolve individual files is time wasted.

I was looking at it more from a long-term POV, as in... is there something I should change or set, that would keep files from wasting space on an ongoing basis.

FWIW, I keep them all on my internal laptop HD, a 2TB SSD drive.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [January 29, 2021, 4:30pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/10 "2021-01-29T16:30:45Z")

</div>

> [@astrohip](#):
>
> is there something I should change or set, that would keep files from wasting space on an ongoing basis.

I don't see anything really important.

> [@astrohip](#):
>
> FWIW, I keep them all on my internal laptop HD, a 2TB SSD drive.

Just one word:  
BACKUP 😇 😉

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 29, 2021, 4:35pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/11 "2021-01-29T16:35:06Z")

</div>

> [@astrohip](#):
>
> Spending time to resolve individual files

If you are interested how many files there are that may be a little exuberant with the padding, try the suggested utility "mp3diags". This lets you find files with "too much" padding in respect to what mp3diags thinks is too much. But this still meanders around some kilobytes and not megabytes.

---

<div class="post-metadata">

### Author: ![phw](https://community.mp3tag.de/user_avatar/community.mp3tag.de/phw/32/11831_2.png) [@phw](https://community.mp3tag.de/u/phw)
#### Post date: [January 30, 2021, 10:08am UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/12 "2021-01-30T10:08:01Z")

</div>

> [@astrohip](#):
>
> googling this topic brings a bunch of info, most of which doesn't apply or make sense.

Maybe some background why there is padding in the first place: In most current formats the tags are located somewhere at the beginning of the file. That makes sense as you have quick access to the tags, no need to seek for the end, and even in cases where you e.g. only partially have downloaded the files you might already be able to read the tags.

The downside is that when you change the tags and their size changes you need to resize the entire file, which might also involve, depending on format, adjusting some offset positions stored in file. Rewriting the entire file usually is much slower then just changing a few bytes of tags.

So to work around this software writing tags usually adds some extra empty space behind the tags as reserve. So when you in a future read add some data and that fits within existing tag size + padding there is no need to rewrite the entire file. You can add some data to the tags and it will just use up the existing padding, and if you remove data it will increase the padding.

Especially when tagging larger files like FLAC you might already have experienced this: After adding a significant amount of tags saving for the first time is slower, saving the same file again with maybe only minor changes is quick.

I don't know about Mp3tag's implementation, but e.g. the Python library mutagen by default will add a padding of 1 KiB + 0.1% of the file size after the tags as default padding. It will also shrink back the padding to that size if it exceeds 10 KiB + 1% of the file size after the tags. For Mp3tag you might find some details here in the forum.

For your library this would mean roughly 0,25 GB of padding.

UPDATE: Not sure if this is still valid, but

> [@setting padding size](https://community.mp3tag.de/t/setting-padding-size/1813/6):
>
> Mp3tag simply uses 2048 bytes of padding by default now.

That would mean for your 25k files roughly 50 MiB of padding, about 0.02% of your libraries size.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 30, 2021, 10:25am UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/13 "2021-01-30T10:25:54Z")

</div>

Thank you for your explanation.  
I would like to add that the padding is added only if the current space (padding) is not big enough to cater for the tag size. Then a new 2k block is added which would be filled to some extent as the previous one is full. So the unused space would be less than the 2k block as some is being used.

---

<div class="post-metadata">

### Author: ![astrohip](https://community.mp3tag.de/user_avatar/community.mp3tag.de/astrohip/32/18205_2.png) [@astrohip](https://community.mp3tag.de/u/astrohip)
#### Post date: [January 30, 2021, 2:03pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/14 "2021-01-30T14:03:18Z")

</div>

Thanks, great info! I love learning behind the scenes type info. Nice job of explaining.

> [@phw](#):
>
> After adding a significant amount of tags saving for the first time is slower, saving the same file again with maybe only minor changes is quick.

This happens quite often, and now I know why. Often my first edit/save is simply to update or fix the track numbers (I like them in a specific format). And even though they may already have track numbers, sometimes it takes a while to save. It never made sense that changing a format would be so slow, especially for files that already had track numbers. Now I understand why. And yes, all subsequent saves are rapido.

---

<div class="post-metadata">

### Author: ![Lebon14](https://community.mp3tag.de/user_avatar/community.mp3tag.de/lebon14/32/8738_2.png) [@Lebon14](https://community.mp3tag.de/u/Lebon14)
#### Post date: [January 31, 2021, 9:16pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/15 "2021-01-31T21:16:46Z")

</div>

> [@Florian](#):
>
> I have padding removal on my list.

That's amazing news!

* * *

> [@astrohip](#):
>
> Curiosity question: What is padding? Extra file length beyond what the tags use? It's not automatically removed/compressed?

It's the space made into audio file to insert the image. In FLAC, it's problematic because it is not removed when the image(s) are removed. People can embedded images of several megabytes but this space is not saved when removing them.

> [@astrohip](#):
>
> Do all MP3 files have padding? Is it added each time I edit, or only when I change a tag for a smaller tag? I often edit images, for example from 250K to 45K. Is that space still there, unused? Should I be compressing? Is it automatic?

MP3 files do not have padding by default. They'll only do if you insert an image in it. In your case, they'll have 45KB padding because of that image. If you remove said image, the padding will be removed. But that's not true for FLAC.

> [@phw](#):
>
> Especially when tagging larger files like FLAC you might already have experienced this: After adding a significant amount of tags saving for the first time is slower, saving the same file again with maybe only minor changes is quick.

Yup! That's because the basic padding of 4KB (or 8KB) was removed. So, MP3tag has to make said padding to make tag editing much faster.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [March 2, 2021, 9:17pm UTC](https://community.mp3tag.de/t/native-option-to-remove-padding-from-flac-files/51637/16 "2021-03-02T21:17:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
