Saved FLAC files increase in size

Help for Audacity 2.x.x on Windows.
Forum rules
ImageThis forum is for Audacity 2.x.x on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Post Reply
Apesbrain
Posts: 39
Joined: Sat Dec 04, 2010 4:58 pm
Operating System: Windows 7

Saved FLAC files increase in size

Post by Apesbrain » Sun Dec 16, 2018 6:07 pm

I've noticed now a few times that when I edit a FLAC file in Audacity 2.3.0 and export it back to FLAC, the resulting file is considerably larger than the original file. The difference is as much as 10%. It's not due to different compression levels and it's not due to different FLAC versions. I can take the original FLAC file and re-encode it to FLAC using foobar2000 and the size barely changes. Audacity is doing something that results in its saved FLAC files being larger. Any idea what might be going on? Thanks.

Here is the difference in size:
Clipboard01.jpg
Clipboard01.jpg (20.93 KiB) Viewed 146 times
"Audacity Commandline FLAC 1.3.2" uses this command line:
"C:\Program Files (x86)\Codecs\flac-1.3.2\win64\flac.exe" --no-seektable - -o "%f.flac" -f

Yarn366
Posts: 15
Joined: Sat May 20, 2017 11:31 pm
Operating System: Windows 7

Re: Saved FLAC files increase in size

Post by Yarn366 » Sun Dec 16, 2018 9:24 pm

For "Audacity Commandline FLAC 1.3.2", you're definitely using compression level 5 because that's what flac.exe uses it's given a parameter to override it ("-#", where "#" is the compression level, ranging from 0 to 8). For the others, it's very likely that Audacity is also using 5, while Foobar2000 is using a higher value. Can you double-check which levels you're actually using?

Yarn366
Posts: 15
Joined: Sat May 20, 2017 11:31 pm
Operating System: Windows 7

Re: Saved FLAC files increase in size

Post by Yarn366 » Sun Dec 16, 2018 9:44 pm

Another thing that may be contributing the file size is the (generally inaudible) noise that Audacity adds for dithering. Here's an explanation on this:

https://alphamanual.audacityteam.org/ma ... xplanation

Even noise this quiet will make the audio harder to compress losslessly, which increases the file size. This, combined with possibly using a lower compression level than what was used for the original file, may explain your situation.

If you want to turn off dithering, simply go to Edit -> Preferences... -> Quality, and in the "High-quality Conversion" section, set "Dither" to "None".

Apesbrain
Posts: 39
Joined: Sat Dec 04, 2010 4:58 pm
Operating System: Windows 7

Re: Saved FLAC files increase in size

Post by Apesbrain » Sun Dec 16, 2018 10:28 pm

Well, it's the dither making the difference. Turned it off and file size is maintained. Thanks for helping with this.

Since I'm opening 16/44 and saving back to the same, there's no point in dither (right?) I've never noticed it to be audible, but size-wise its impact is much larger than I'd have thought. Maybe because this track is classical and there is a lot of silence?

I'd think the default setting for dither would be "Off" except in cases of higher wordlength being saved to lower. Maybe that isn't possible with Audacity code today, but would be nice for a future release.

kozikowski
Forum Staff
Posts: 41754
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: OS X 10.9 Mavericks

Re: Saved FLAC files increase in size

Post by kozikowski » Mon Dec 17, 2018 5:34 pm

Since I'm opening 16/44 and saving back to the same, there's no point in dither (right?)
Nice try.

Audacity works internally at 32-bit floating. Not 16-bit. There is always a serious conversion even if you do nothing. Getting into Audacity is a snap since the quality inside is much greater than the quality outside. But Exporting a new show can cause problems.

Any change to the sound during editing can cause errors to "line up" and be audible during export.

Nobody cares about one sampling point quantizing error, but if three or more of them line up, that's audible distortion.
I'd think the default setting for dither would be "Off"...
That's a recipe for complaints of "mystery" errors and distortion for normal production.

Koz

Apesbrain
Posts: 39
Joined: Sat Dec 04, 2010 4:58 pm
Operating System: Windows 7

Re: Saved FLAC files increase in size

Post by Apesbrain » Mon Dec 17, 2018 6:11 pm

kozikowski wrote:
Mon Dec 17, 2018 5:34 pm
Audacity works internally at 32-bit floating.
Thanks, I'd forgotten this.

steve
Site Admin
Posts: 49424
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Saved FLAC files increase in size

Post by steve » Mon Dec 17, 2018 6:19 pm

kozikowski wrote:
Mon Dec 17, 2018 5:34 pm
There is always a serious conversion even if you do nothing.
Not quite.
If you literally do nothing other than import and export, and the audio files (original and copy) are both in a lossless format (such as WAV or FLAC), then by turning dither off, the output file will be a bit-perfect copy of the original.
kozikowski wrote:
Mon Dec 17, 2018 5:34 pm
I'd think the default setting for dither would be "Off"...
Well there's the thing - in the vast majority of cases, people are using Audacity (an "audio editor") to modify the audio before exporting it. If sample values are modified by applying any kind of effect, mixing, pan or gain change, fades, normalizing ... then the (32-bit float) sample values in Audacity will not convert exactly to 16-bit values. This is what "dither" is for. Dither provides a better way of "rounding" high bit formats to lower bit formats.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Apesbrain
Posts: 39
Joined: Sat Dec 04, 2010 4:58 pm
Operating System: Windows 7

Re: Saved FLAC files increase in size

Post by Apesbrain » Mon Dec 17, 2018 9:05 pm

Understood. In this particular case, I was simply chopping off a few seconds of silence at the head of a FLAC file. Pretty sure the dither added by Audacity would be of no benefit in this case.

steve
Site Admin
Posts: 49424
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Saved FLAC files increase in size

Post by steve » Mon Dec 17, 2018 9:16 pm

Apesbrain wrote:
Mon Dec 17, 2018 9:05 pm
In this particular case, I was simply chopping off a few seconds of silence at the head of a FLAC file. Pretty sure the dither added by Audacity would be of no benefit in this case.
Correct.

As you suggested in your previous post, the way that Audacity handles dither is not ideal in all cases, but making it "ideal for all cases" is a rather complex task (and a "theoretic ideal" may not always be a "practical ideal").
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 41754
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: OS X 10.9 Mavericks

Re: Saved FLAC files increase in size

Post by kozikowski » Tue Dec 18, 2018 4:09 am

If you literally do nothing other than import and export ... the output file will be a bit-perfect copy of the original.
Yes, but it's still converting. It's just under those conditions, the errors go away.

Koz

Post Reply