IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
FLAC tag and file size ?
Xrcr9709
post Feb 21 2012, 15:11
Post #1





Group: Members
Posts: 64
Joined: 16-June 09
Member No.: 70735



Hello,

I just noticed that and at a first glance it looks weird to me.

I've encoded 11 FLAC files with FLAC Frontend. I've tagged them (without album cover), but I kept a copy of the untagged files.
When I compare their size, the tagged files and the non-tagged files have the exactly same size (in bytes).
(This changes of course if I add the album cover to the files.)

So why is that that add data to the file doesn't seem to make the file bigger ?
I guess I've used the standard tag files and maybe they have their place reserved even when they are empty ? Or something like that ?


Thank you for the info.
Go to the top of the page
+Quote Post
skamp
post Feb 21 2012, 15:55
Post #2





Group: Developer
Posts: 1442
Joined: 4-May 04
From: France
Member No.: 13875



FLAC adds 8 KiB of padding by default when encoding files. That padding space allows for subsequent metadata alteration without changing the file size and without having to rewrite the file entirely.


--------------------
See my profile for measurements, tools and recommendations.
Go to the top of the page
+Quote Post
Deep_Elem
post Feb 21 2012, 17:43
Post #3





Group: Members
Posts: 120
Joined: 14-April 04
Member No.: 13473



If the file is over 20 mins long, FLAC adds 64KB of padding by default!

I have no use for cover art inside a flac file so I find that 8KB of padding is much much too large for my purposes. I can easily get away with 2KB, and most of the time 1KB is more than sufficient even for including replaygain tags.

Use the -P switch to make the padding size smaller than the default. E.g. -P 2048 will give you 2KB, -P 1024 will give you 1KB.
Go to the top of the page
+Quote Post
pdq
post Feb 21 2012, 18:19
Post #4





Group: Members
Posts: 3404
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



Let's see, a 20 min. FLAC file is already over 100 MB, and you're worried about an extra 64 KB?

Of course, I'm also mystified by people who worry about an extra 0.1 or 0.2% in compression ratio.
Go to the top of the page
+Quote Post
Deep_Elem
post Feb 21 2012, 19:49
Post #5





Group: Members
Posts: 120
Joined: 14-April 04
Member No.: 13473



QUOTE (pdq @ Feb 21 2012, 13:19) *
Let's see, a 20 min. FLAC file is already over 100 MB, and you're worried about an extra 64 KB?

Of course, I'm also mystified by people who worry about an extra 0.1 or 0.2% in compression ratio.

I'm not 'worried' about it. But it's pointless and arbitrary to add 64KB of padding to a file just because it's 20 mins long. I have many files that long. They don't deserve 8 times as much padding just for being longer. Why waste harddrive space on it for nothing? I use -P 1024 or -P 2048 in my command line and I get the padding just the way I want it without any worries. I'm sorry if that mystifies you. I am every bit as mystified by why a track needs 64KB of padding just because it's 20 mins long or why there are always people like you who feel the need to berate others for their preferences. I have provided the OP with information that he might find useful. What have you provided of value to this discussion? Very little. But just to be sure, I will remember to run my thoughts past you first before I post them, pdq, so that I won't risk mystifying you in the future.
Go to the top of the page
+Quote Post
JJZolx
post Feb 21 2012, 20:46
Post #6





Group: Members
Posts: 396
Joined: 26-November 04
Member No.: 18345



QUOTE (Deep_Elem @ Feb 21 2012, 11:49) *
I'm not 'worried' about it. But it's pointless and arbitrary to add 64KB of padding to a file just because it's 20 mins long.


I've never worried so much that I've adjusted it, but I have wondered about this. What was the original logic behind it?

I have 67 tracks of >= 20 minutes in my 35,000 track FLAC library, for a total of around 4.2 MB of wasted space, or the equivalent of about one 45 second track of music.
Go to the top of the page
+Quote Post
pdq
post Feb 21 2012, 21:00
Post #7





Group: Members
Posts: 3404
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



QUOTE (JJZolx @ Feb 21 2012, 14:46) *
QUOTE (Deep_Elem @ Feb 21 2012, 11:49) *
I'm not 'worried' about it. But it's pointless and arbitrary to add 64KB of padding to a file just because it's 20 mins long.


I've never worried so much that I've adjusted it, but I have wondered about this. What was the original logic behind it?

I have 67 tracks of >= 20 minutes in my 35,000 track FLAC library, for a total of around 4.2 MB of wasted space, or the equivalent of about one 45 second track of music.

And at today's prices that cost you approximately 0.042 cents.
Go to the top of the page
+Quote Post
Porcus
post Feb 22 2012, 10:49
Post #8





Group: Members
Posts: 1842
Joined: 30-November 06
Member No.: 38207



QUOTE (Deep_Elem @ Feb 21 2012, 19:49) *
it's pointless and arbitrary to add 64KB of padding to a file just because it's 20 mins long.


I was not aware of this property, but anyway, there are a couple of possible justifications: Long files are more likely to be full CD images consisting of all tracks, and when you embed a cuesheet which includes the tags for every track, it would be more likely to exceed 8K than a single-track tag set is. Second, I suppose users who care about space usage, will think that 64K minus whatever is used for a full CD, is no worse than 8K times the number of tracks (minus whatever is used). Third, I suppose that users who care about space usage, will be more inclined to put album art in a single-image file than in every track-file (in the latter case, they would probably save a folder.jpg instead).

Anyway, you can use the --dont-use-padding option.


Edit: And those 67 tracks you multiplied by 64, you forgot to subtract the actual usage ... that brings the total cost down by another very few basispoints sweat.gif . Of course if you are at the very edge of having to buy a bigger hard drive, you could go WavPack or TAK, or for whatever codec you choose: use file system compression. It will hardly compress the music part, but nils in the metadata will compress just nicely.

This post has been edited by Porcus: Feb 22 2012, 10:55


--------------------
One day in the Year of the Fox came a time remembered well
Go to the top of the page
+Quote Post
basher
post Feb 25 2012, 23:06
Post #9





Group: Members
Posts: 4
Joined: 25-February 12
Member No.: 97400



I have a question about tagging in FLAC files. I use the program Tagscanner for my tagging needs and I noticed something odd when I updated a few of the files with album art. The program shows you the bitrate and the compression ratio at the bottom right of the tagging window. When I added the album art, it increased the bitrate and the compression ratio. However, when I removed the album art, it kept the bitrate and ratio the same, which was odd because I expected it to revert back to the values before I added the art. I tried it in mp3Tag and that program showed me slightly different bitrate numbers which was odd because it should have shown the same numbers. Does this happen often to other people that tag FLAC files and if so, does this tagging information change the audio data in some way since the program is showing a difference in bitrate and compression ratio? Any clarification would be appreciated.

Thanks,
Basher
Go to the top of the page
+Quote Post
tuffy
post Feb 26 2012, 00:43
Post #10





Group: Members
Posts: 111
Joined: 20-August 07
Member No.: 46367



Tagging doesn't change audio data in any way. What's happening is that adding an image increases your file's size. When calculating bitrate as total file size in bytes divided by file length in seconds, adding an image will increase its bitrate. However, tagging programs often replace parts of the file with padding when removing an image in order to avoid rewriting the whole file. This explains why your bitrate doesn't shrink when taking the image back out again. On the other hand, if program decides to calculate bitrate as file length not counting the metadata tags, it might give a different rate than one that uses the file's total size.

But because your file is lossless, its bitrate is largely academic and not something to worry about beyond how well your file happens to be compressed.
Go to the top of the page
+Quote Post
JJZolx
post Feb 26 2012, 01:12
Post #11





Group: Members
Posts: 396
Joined: 26-November 04
Member No.: 18345



QUOTE (basher @ Feb 25 2012, 15:06) *
When I added the album art, it increased the bitrate and the compression ratio. However, when I removed the album art, it kept the bitrate and ratio the same, which was odd because I expected it to revert back to the values before I added the art.


Many tagging programs, when you remove album art, will just put that space into the padding block instead of rewriting the whole file. Mp3tag also does this. It makes saving edits much faster.

QUOTE
I tried it in mp3Tag and that program showed me slightly different bitrate numbers which was odd because it should have shown the same numbers.


Bitrate may be calculated differently by the two programs. I'd suspect that one may use 10^6 as a megabit and the other may use 2^20.

QUOTE
Does this happen often to other people that tag FLAC files and if so, does this tagging information change the audio data in some way since the program is showing a difference in bitrate and compression ratio? Any clarification would be appreciated.


No, the audio data does not change. The reason that the bitrate and compression ratio change when you add the artwork is that they're both calculated based on the total file size vs. the uncompressed size of the audio data in the file. When the file size goes up because the metadata (or padding) size increases then the bitrate (often expressed as 'average bitrate') for the _file_ goes up.
Go to the top of the page
+Quote Post
basher
post Feb 26 2012, 01:22
Post #12





Group: Members
Posts: 4
Joined: 25-February 12
Member No.: 97400



That's exactly the answers I was looking for! I can now rest peacefully knowing that my FLAC files are not modified as far as the audio goes. Thanks tuffy and JJZolx! biggrin.gif

Sincerely,
Basher
Go to the top of the page
+Quote Post
yourlord
post Mar 8 2012, 18:08
Post #13





Group: Members
Posts: 217
Joined: 1-March 11
Member No.: 88621



QUOTE (JJZolx @ Feb 21 2012, 15:46) *
I have 67 tracks of >= 20 minutes in my 35,000 track FLAC library, for a total of around 4.2 MB of wasted space, or the equivalent of about one 45 second track of music.


And assuming you are using a filesystem with a block size of 4K, averaged you will waste roughly 2K of drive space per file.
35,000 files X 2K is about 70MB of wasted space due to filesystem overhead.

In other words, don't sweat the small stuff. You're wasting far more space just in file system overhead than the extra metadata space in those 67 tracks.
(If you really want to cringe, if you don't use the metadata space you're wasting 280MB across 35000 8k padded FLAC files!)



Go to the top of the page
+Quote Post
pdq
post Mar 8 2012, 18:34
Post #14





Group: Members
Posts: 3404
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



A large disc is probably divided into 64K clusters, making the file system overhead more than a gigabyte.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th September 2014 - 21:05