Skip to main content
Topic: FLAC compression levels 8 versus 12 (Read 13426 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

FLAC compression levels 8 versus 12

Why does vidcoder use different compression values than flac.exe? I thought FLAC went from 0 to 8 but vidcoder, which I think uses libavcodec or I've also seen libFLAC has values from 0 to 12. Can anyone explain this to me?

(I have been using FLAC for my music forever, basically since it came out or when I was made aware of it. Anyway, I've used the "FLAC Frontend" program for windows as it has always worked quite well for me and it's simple to use. The compression values have always been 0-8.

However recently after learning how to and converting some of my blurays from disc to mkv files and trying to save some HDD space using vidcoder CQ18 and FLAC_16bit from the HD codecs I have noticed that the compression value vidcoder uses is 0-12. Thinking I was missing something I went to the command line (of 1.3.1 and ran flac.exe -help and saw that it lists only compression from 0-8.

Am I missing something, or does the libFLAC or libavcodec use different values than flac.exe?)


Any info is welcome thanks.

FLAC compression levels 8 versus 12

Reply #1
libFLAC only has compression levels defined from 0 to 8.  They are really nothing more than presets for various combinations of the "real" compression settings, but they've been 0-8 for a long time and don't seem likely to change.  There is nothing fundamental to the Flac format that defines compression levels of 0-8 or any other value.

ffmpeg (libavcodec) does not use libFLAC (flake?) and it has its own options for controlling the encoding of Flac.  Apparently these include a "compression level" of 12, but that's nothing to do with the 0-8 values used in libFLAC and shouldn't be interpreted as being better or worse, just different.

FLAC compression levels 8 versus 12

Reply #2
Only thing I can imagine is that they just made those levels up themselves and use command like:

flac -8 -e
flac -8 -p
flac -8 -ep

as new values for compression, but in reality these do not exist and are separate options that gain very little space at the cost of much slower encryption.

FLAC compression levels 8 versus 12

Reply #3
libFLAC only has compression levels defined from 0 to 8.  They are really nothing more than presets for various combinations of the "real" compression settings, but they've been 0-8 for a long time and don't seem likely to change.  There is nothing fundamental to the Flac format that defines compression levels of 0-8 or any other value.

ffmpeg (libavcodec) does not use libFLAC (flake?) and it has its own options for controlling the encoding of Flac.  Apparently these include a "compression level" of 12, but that's nothing to do with the 0-8 values used in libFLAC and shouldn't be interpreted as being better or worse, just different.


Thank you for the info...I think a better question to ask then is: What levels should I use for the best compression when using FLAC?

flac.exe - level 8?
vidcoder (libavcodec) level 12?
eac3to uses libFLAC but I've never seen an option to set the sompression so I'm assuming its using maximum.

Would these all be approximately equivalent "best" compression values?

thx

FLAC compression levels 8 versus 12

Reply #4
Only thing I can imagine is that they just made those levels up themselves and use command like:

flac -8 -e
flac -8 -p
flac -8 -ep

as new values for compression, but in reality these do not exist and are separate options that gain very little space at the cost of much slower encryption.


Thanks for reply but time doesn't really matter much to me as I'm encoding blurays so they take 5-11 hours per file anyway. An extra 30min for flac doesn't bother me at all even if it is virtually pointless, it's a "hit go" and walk away from the computer for the night process anyway.

I take it that flac -8 -ep is the "max" setting for flac.exe? I use flac frontend and have only ever used 8, I don't know what that corresponds to exactly, but probably good enough?

Being that it is lossless and all, I could always just decode the outputted flacs from eac3to and vidcoder and just re-encode using the frontend value 8. In fact I'll do that and see what sizes I get. I'll post in a bit.

FLAC compression levels 8 versus 12

Reply #5
With flac -8 is considered --best which is an equivalent command line option (though it might change to mean something else in a future release).  Adding -e or -p can potentially improve compression and usually does by a tiny amount.  I don't see any harm in using them.  They slow down lower compression levels quite a lot, but really don't make a huge difference with -8 which is already relatively slow.


FLAC compression levels 8 versus 12

Reply #6
What levels should I use for the best compression when using FLAC?
vidcoder (libavcodec) level 12?

Some of the flac encoders in CUETools (libFlake and FlaCCL) have compression levels above 8 but the developer recommends against using them because they create non-subset flac files that may not be supported by some players.

I'd be cautious using levels above 8 in vidcoder.
korth

FLAC compression levels 8 versus 12

Reply #7
They slow down lower compression levels quite a lot, but really don't make a huge difference with -8 which is already relatively slow.

On my computer flac -8 encoding speed is about 60x realtime, and -8 -e -p  is 1.8x realtime. I think it's a quite big difference!

FLAC compression levels 8 versus 12

Reply #8
They slow down lower compression levels quite a lot, but really don't make a huge difference with -8 which is already relatively slow.

On my computer flac -8 encoding speed is about 60x realtime, and -8 -e -p  is 1.8x realtime. I think it's a quite big difference!


I was going to write that I don't see it (note that I'm not using 1.3.1).  However, I *do* see it ... sometimes.

Adding -e or -p at compression level 5 makes some difference, but adding both makes it dramatically slower.  At compression level 8, adding -e makes very little difference (this is what I have configured in my preset), -p makes a big difference, and -8 -ep is *faster* than -8 -p and about the same (speed) as -5 -ep.  Go figure

Probably worth some comparison with your numbers:
-8 => ~25x
-8 -ep -> ~8x

FLAC compression levels 8 versus 12

Reply #9
which I think uses libavcodec

In that case, you might not want to use levels 11 and 12, because they are non-subset. That means not all hardware players (like portable devices, car head units, DLNA players, set-top boxes etc.) are able to play them.

Anyway, FFMPEG uses a FLAC encoder that has been written completely independent of libFLAC, the reference implementation. It does things differently, and is tuned differently. Therefore, the compression levels differ. The main difference here is the way the encoder determines how many predictors to use. FFMPEG levels 8, 9 and 10 only differ in that, the extend to which is checked which number of predictors is optimal. libFLAC has this as well, which is the -e option. This only slows down encoding.

However, FFMPEG levels 11 and 12 increase the maximum number of predictors from 12 to 32. More predictors usually means a more accurate prediction of the signal, but it makes decoding slower as well (there are more calculations to be done). The FLAC format can go up to 32 predictors, but the developers have chosen to limit the number of predictors to a 'sane' range of max 12, the so called FLAC subset.


Music: sounds arranged such that they construct feelings.

FLAC compression levels 8 versus 12

Reply #10
I was going to write that I don't see it (note that I'm not using 1.3.1).

Before FLAC 1.3.1 -e option was on for -7 and -8 presets. So -8 -e was the same as -8; -8 -e -p is the same as -8 -p, etc.

FLAC compression levels 8 versus 12

Reply #11
I was going to write that I don't see it (note that I'm not using 1.3.1).

Before FLAC 1.3.1 -e option was on for -7 and -8 presets. So -8 -e was the same as -8; -8 -e -p is the same as -8 -p, etc.


Thanks.  That half explains things, but why is your -8 -ep speed so slow?  Or mine so fast?  The behaviour of my machine is more as if -e is always off (even when specified explicitly) than always on.

FLAC compression levels 8 versus 12

Reply #12
Thanks.  That half explains things, but why is your -8 -ep speed so slow?  Or mine so fast?

Because the presets were retuned. The -e option was left out to make 'room' for other options that consume about as much time, but are generally more efficient.
Music: sounds arranged such that they construct feelings.

FLAC compression levels 8 versus 12

Reply #13
Thanks.  That half explains things, but why is your -8 -ep speed so slow?  Or mine so fast?

Because the presets were retuned. The -e option was left out to make 'room' for other options that consume about as much time, but are generally more efficient.


Thanks for all the info...please tell me if this sounds silly but because I am going to use these via DLNA I want them to be fully compatible.

When using vidcoder, pick a flac, but after the file is made just re-process it with either flac.exe level 8 or eac3to which I have just updated to libFLAC1.3.1 because libavcodec and FFMPEG were "written completely independent of libFLAC, the reference implementation"

When using eac3to (for DTSHDMA because I have the Arcsoft decoder and vidcoder does not have a dts decoder yet) outputting to FLAC should be fine because it uses libFLAC, which I'm taking is the "properly authored" version of FLAC based on a post above?

Is that right?

OR - When using vidcoder just use level 8 and it should be fine?

thx again

FLAC compression levels 8 versus 12

Reply #14
OR - When using vidcoder just use level 8 and it should be fine?

Yeah, I see no reason why using -8 with vidcoder would cause any problems.
Music: sounds arranged such that they construct feelings.

FLAC compression levels 8 versus 12

Reply #15
Why not preprocess the files with LossyWAV first? It can cut the filesize in half and there is no audible difference (not yet proven under normal circumstances)...

But remember to always use '-b 512' when the files are preprocessed because LossyWAV uses 512 sampleblocks. Encoding at larger blocksizes takes the 'wasted bits' level to the worst of the 4 blocks processed and results in worse compression levels...

Technically it is a lossy codec, but there is just no audible difference (IMO !) and for transcoding BR discs and movies it is really more than enough.

Really I encourage you to try it. Use LossyWAV for testing and use the ultraportable and worst setting. Even then the chances are great there is no audible difference. If there is, I would really like you to hand over a sample so we can hear for ourselves.

FLAC compression levels 8 versus 12

Reply #16
Why not preprocess the files with LossyWAV first? It can cut the filesize in half and there is no audible difference (not yet proven under normal circumstances)...

But remember to always use '-b 512' when the files are preprocessed because LossyWAV uses 512 sampleblocks. Encoding at larger blocksizes takes the 'wasted bits' level to the worst of the 4 blocks processed and results in worse compression levels...

Technically it is a lossy codec, but there is just no audible difference (IMO !) and for transcoding BR discs and movies it is really more than enough.

Really I encourage you to try it. Use LossyWAV for testing and use the ultraportable and worst setting. Even then the chances are great there is no audible difference. If there is, I would really like you to hand over a sample so we can hear for ourselves.


Thanks for the info...I'll give that some consderation...I've never used Lossywav and neither vidcoder nor eac3to use it (do they?). So if I can just use vidcoder level 8 and eac3to then that saves an extra step compared to using lossywav.

Out of curiousity, why not use mp3_v0? Wouldn't that save even more space than lossywav and have virtually unlimited compatibility on everything. Or is lossy wav less lossy than mp3_v0?

thx

Ben

FLAC compression levels 8 versus 12

Reply #17
okay nevermind then, dumb idea. mp3 doesn't do multichannel very well so I guess the compatibility goes out the window.

I'll look it up!


FLAC compression levels 8 versus 12

Reply #18
Why not preprocess the files with LossyWAV first?

But remember to always use '-b 512' when the files are preprocessed because LossyWAV uses 512 sampleblocks.

Well, this is true at sample rates up to 48kHz, at 88kHz and 96kHz lossyWav uses 1024 block size, above that even 2048.
In theory, there is no difference between theory and practice. In practice there is.

Re: FLAC compression levels 8 versus 12

Reply #19
Is this still relevant? Is there any reason to not use flac compression level 12 at all?

Re: FLAC compression levels 8 versus 12

Reply #20
Is this still relevant? Is there any reason to not use flac compression level 12 at all?

You mean in libavcodec?  Looking at the source code levels above 10 are not subset compatible, so yes it is still relevent. 

Re: FLAC compression levels 8 versus 12

Reply #21
Hi to everyone!

Sorry for asking about this here but I couldnt find anywhere else my answer:

How do you do to have FLAC option to transcode inside Handbrake or VidCoder? I do not have it in the options list. Only AAC, AC3, DTS, DTS-HD and MP3.

Thanks

Re: FLAC compression levels 8 versus 12

Reply #22
You should choose as output container MKV.


 
SimplePortal 1.0.0 RC1 © 2008-2018