Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th August 2020, 18:47   #1  |  Link
bjoker
Registered User
 
Join Date: Jan 2013
Posts: 50
weird FLAC compression

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)

Quote:
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)

Quote:
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!
bjoker is offline   Reply With Quote
Old 11th August 2020, 19:46   #2  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,346
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
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 11th August 2020, 20:40   #3  |  Link
bjoker
Registered User
 
Join Date: Jan 2013
Posts: 50
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).

Quote:
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)
bjoker is offline   Reply With Quote
Old 11th August 2020, 22:39   #4  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,914
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%?
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 11th August 2020 at 22:46.
tebasuna51 is offline   Reply With Quote
Old 12th August 2020, 15:34   #5  |  Link
bjoker
Registered User
 
Join Date: Jan 2013
Posts: 50
Quote:
Originally Posted by tebasuna51 View Post
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.
bjoker is offline   Reply With Quote
Old 12th August 2020, 18:11   #6  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,914
I can't confirm than v1.2.1 compress more.
With 1 hour wav (from Jurassic Park) test:

Code:
                            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 %
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 13th August 2020 at 11:54. Reason: add info
tebasuna51 is offline   Reply With Quote
Old 12th August 2020, 21:03   #7  |  Link
lvqcl
Registered User
 
Join Date: Aug 2015
Posts: 294
You can add -e option
For example, flac.exe -5 -e in.wav -o out.flac
lvqcl is offline   Reply With Quote
Old 13th August 2020, 09:55   #8  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,914
Same size with -8 -e:
Code:
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%
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 13th August 2020 at 10:23.
tebasuna51 is offline   Reply With Quote
Old 13th August 2020, 10:36   #9  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
For anyone who is interested...

The 'Compression 5' setting is more compatible with hardware playback devices
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 13th August 2020, 11:25   #10  |  Link
bjoker
Registered User
 
Join Date: Jan 2013
Posts: 50
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
bjoker is offline   Reply With Quote
Old 13th August 2020, 11:58   #11  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,914
@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
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 13th August 2020 at 12:07. Reason: add info
tebasuna51 is offline   Reply With Quote
Old 13th August 2020, 12:38   #12  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
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.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.