View Full Version : weird FLAC compression
bjoker
11th August 2020, 18:47
Hi,
I have a PCM file - LPCM Audio / 2.0 / 48 kHz / 1536 kbps / 16-bit
Encoded with 2 FLAC versions and the outputs are
1) libFLAC 1.2.1 (using eac3to)
General
Complete name : XXX_Main.flac
Format : FLAC
Format/Info : Free Lossless Audio Codec
File size : 278 MiB
Duration : 1 h 43 min
Overall bit rate mode : Variable
Overall bit rate : 376 kb/s
Audio
Format : FLAC
Format/Info : Free Lossless Audio Codec
Duration : 1 h 43 min
Bit rate mode : Variable
Bit rate : 376 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Stream size : 278 MiB (100%)
Writing library : libFLAC 1.2.1 (UTC 2007-09-17)
2) libFLAC 1.3.2 CLI (tried with & without "--compression-level-5" option to check default compression level. both resulted same)
General
Complete name : XXX_Main_flac_WSL_level5.flac
Format : FLAC
Format/Info : Free Lossless Audio Codec
File size : 883 MiB
Overall bit rate mode : Variable
Overall bit rate : 1 195 b/s
Audio
Format : FLAC
Format/Info : Free Lossless Audio Codec
Bit rate mode : Variable
Bit rate : 1 194 b/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48 Hz
Bit depth : 16 bits
Stream size : 882 MiB (100%)
Writing library : libFLAC 1.3.2 (UTC 2017-01-01)
I totally get it if the difference is like 10-20% but it's almost 300% difference. Could anyone advise what's wrong (if any) here?
Thanks!
nevcairiel
11th August 2020, 19:46
Is your FLAC build with Visual Studio and 64-bit? There has been an odd bug that caused files to barely compress when Visual Studio compiles libFLAC in 64-bit mode. Newer libFLAC has a work-around for this issue, ie. you could get 1.3.3
bjoker
11th August 2020, 20:40
Thanks nevcairiel for the reply.
I just tried 1.3.3 from https://www.videohelp.com/software/FLAC-Encoder (win64-bit) but same result (bloated flac).
General
Complete name : XXX_Main_flac_133_win64.flac
Format : FLAC
Format/Info : Free Lossless Audio Codec
File size : 883 MiB
Overall bit rate mode : Variable
Overall bit rate : 1 195 b/s
Audio
Format : FLAC
Format/Info : Free Lossless Audio Codec
Bit rate mode : Variable
Bit rate : 1 194 b/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48 Hz
Bit depth : 16 bits
Stream size : 882 MiB (100%)
Writing library : libFLAC 1.3.3 (UTC 2019-08-04)
tebasuna51
11th August 2020, 22:39
A wav 1 h 43 min at 1536 kbps (2.0, 48000, 16bit) have a size of 1.2 GB, a flac compression to 882 MB is more or less normal (73%), a compression to 278 MB is not normal (23%). A tipical compression can be 60%.
The source have many silences to justify this 23%?
bjoker
12th August 2020, 15:34
A wav 1 h 43 min at 1536 kbps (2.0, 48000, 16bit) have a size of 1.2 GB, a flac compression to 882 MB is more or less normal (73%), a compression to 278 MB is not normal (23%). A tipical compression can be 60%.
The source have many silences to justify this 23%?
Yeah it is audio of a very old movie with lot of silences.
But how come the very old version of FLAC compresses a lot more ( 23% vs 73%) than the latest FLAC version? I'm able to reverse the flac file back to PCM and hash check (they matched) for both versions.
tebasuna51
12th August 2020, 18:11
I can't confirm than v1.2.1 compress more.
With 1 hour wav (from Jurassic Park) test:
Size (bytes) enc. time %
------------------------- ------------- --------- ------
WAV 5.1,1 hour,48kHz,24 b 3.110.400.102 -
flac.exe -5 1.3.3 64 b 1.708.546.600 22,68 54,930
flac.exe -5 -e 1.3.3 64 b 1.707.631.271 45,34 54,901
ffmpeg -5 Lavf58.42.100 1.707.221.663 23,63 54,887
eac3to libflac 1.2.1 32 b 1.705.970.954 3:43,90 54,847
flac.exe -8 1.3.3 64 b 1.705.443.722 38,95 54,830
flac.exe -8 -e 1.3.3 64 b 1.705.443.722 43,39 54,830
eac3to libflac 1.3.3 32 b 1.705.367.448 1:19,47 54,828
ffmpeg -12 Lavf58.42.100 1.704.010.142 5:16,12 54,784
there are very little differences but seems better 1.3.3.
I used best size (-8 in flac.exe), if I remember ok madshi use also -8 by default.
with ffmpeg I used -compression_level 12, I don't know how reproduce that with flac, we obtain the best size (only a 0,05 % better) but with huge encoding time.
EDIT: more encode options.
If default for flac and ffmpeg (compression level 5) is more compatible with hardware players, like SeeMoreDigital say, I think is the best option because the gain in size is only a 0,1 %
lvqcl
12th August 2020, 21:03
You can add -e option
For example, flac.exe -5 -e in.wav -o out.flac
tebasuna51
13th August 2020, 09:55
Same size with -8 -e:
flac.exe -8 1.3.3 64 b 1.705.443.722 38,95 54,830
flac.exe -8 -e 1.3.3 64 b 1.705.443.722 43,39 54,830
flac.exe -5 -e 1.3.3 64 b 1.707.631.271 45,34 54,901
flac.exe -5 1.3.3 64 b 1.708.546.600 22,68 54,930
BTW minimal differences don't justify spend more time encoding.
Flac.exe -8 is a good option for me.
Of course I don't know for what libflac 1.2.1 32 bits compress the bjoker file with a 23%
SeeMoreDigital
13th August 2020, 10:36
For anyone who is interested...
The 'Compression 5' setting is more compatible with hardware playback devices ;)
bjoker
13th August 2020, 11:25
I encoded atleast 50 PCMs to FLAC and the difference has always been <20% between 1.2.1 & 1.3.2 but this one is different.
Not sure what compression level does eac3to use (I think it is 5) but I used default setting. I tried 1.3.2 (& 1.3.3) with default & "--compression-level-5" but same result.
There seems to be no way of finding the compression level of a FLAC file.
Could i upload the whole audio (or part of it) to a file hoster and share here so anyone with interest could reproduce the problem?
Thanks everyone for your replies :thanks:
tebasuna51
13th August 2020, 11:58
@SeeMoreDigital
Good to know, I modified the table with the comparative.
I I will modify the default for encode to flac with ffmpeg in Useac3to GUI.
@bjoker
Don't upload the file for me, I believe in your test and I can't do anything more with it.
The eac3to compression level is the max (I suppose 8) like madshi say here (https://forum.doom9.org/showthread.php?p=1222771#post1222771)
Boulder
13th August 2020, 12:38
If you post the issue at https://sourceforge.net/p/flac/bugs/ , maybe some dev will be able to see what the difference between the files is. As far as I've understood, eac3to uses a standard library for FLAC so it should be possible to reproducible with a build from the same sources.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.