Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Compression options for Flac Command Line (Read 3196 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Compression options for Flac Command Line

I try to compress my FLACs as much as possible since CPU time doesnt matter. Currently i have compression level 8 enabled and i use the extra options -e & -p. I'm not much of an expert when it comes to that but recently i discovered that there are two more options to compress even further, so if you someone could explain to me how they work that would be great! One is -m (mid-side) from what i understand it compresses the Stereo streams into a Mono stream and on replay decodes them again into a Stereo stream, but that seems to fishy to me so i'm probably not gonna use that. Is that really still lossless at this point or 'bit perfect'?
The other one i'm more curious about is 'rice partition order' (-r). What does it exactly do to increase compression. And if someone had some encoding results for different compression levels, i've only found one comparison and  from level 11 to 15 the file had the exact same amount of bytes, so the last few levels make no difference at all?
I know the difference is gonna be negligible but i'm running out on mobile storage and i've calculated that with my current library i'll still save a few GBs.

Re: Compression options for Flac Command Line

Reply #1
There is often correlation between the left and right channels, and this can help compression. This is still lossless.


Re: Compression options for Flac Command Line

Reply #3
This is offtopic, but if you need some extra space and still want very high quality, you could try LossyWAV with FLAC.
If you reeeeeally need to squeeze without any quality loss, there are other codec options with higher compression ratio, although there is some drawbacks.

Thank you but i'm set on using FLAC, i just wanna squeeze as much out of it as possible. In the long run i'll end up buying a phone with higher microSD support. And i also still gotta compress my high quality album art.

Re: Compression options for Flac Command Line

Reply #4
Currently i have compression level 8 enabled [...]
One is -m (mid-side)
That's already included in level 8: https://xiph.org/flac/documentation_tools_flac.html#flac_options_level_8
from what i understand it compresses the Stereo streams into a Mono stream and on replay decodes them again into a Stereo stream
Not to mono, but to average (mid) and difference (side) of the left and right channel: https://xiph.org/flac/format.html#interchannel
The -m option actually encodes both ways (normal stereo and mid-side) and chooses the one that gives better results: https://xiph.org/flac/documentation_tools_flac.html#flac_options_mid_side
The other one i'm more curious about is 'rice partition order' (-r). What does it exactly do to increase compression.
Here's some info:
Residual coding: https://xiph.org/flac/format.html#residualcoding
-r option: https://xiph.org/flac/documentation_tools_flac.html#flac_options_rice_partition_order
i've only found one comparison and  from level 11 to 15
Not sure if you care but FYI, if I read this correctly, values above 8 will create files which are not the Subset: https://xiph.org/flac/format.html#subset
i've calculated that with my current library i'll still save a few GBs.
So what's your current size? A terabyte?

Re: Compression options for Flac Command Line

Reply #5
Ah so turns out all my FLACs are already mid-side. Thanks also for explaining what it actually is.


Here's some info:
Residual coding: https://xiph.org/flac/format.html#residualcoding
-r option: https://xiph.org/flac/documentation_tools_flac.html#flac_options_rice_partition_order
i've only found one comparison and  from level 11 to 15
Not sure if you care but FYI, if I read this correctly, values above 8 will create files which are not the Subset: https://xiph.org/flac/format.html#subset

I'm gonna be honest, i've looked at all these links, read through the pages but i dont understand a thing  :o
What does it mean to "create files which are not the subset", or rather what differences does it make for the file, i cant skip through a song?

EDIT: Ah ja i'm curently approaching 500GB with my Library but i added like 200 over the last few months only. It's not so much about saving space now but in the long run.

Re: Compression options for Flac Command Line

Reply #6
I'm gonna be honest, i've looked at all these links, read through the pages but i dont understand a thing  :o
FLAC can split each block into partitions and choose a different Rice parameter for each partition. Sometimes, using a different Rice parameter in each partition will improve compression. Other times, the ideal Rice parameter is the same for each partition so there's no reason to split the block. The -r option controls how FLAC splits blocks into partitions.

What does it mean to "create files which are not the subset", or rather what differences does it make for the file, i cant skip through a song?
It means they might not play correctly on all FLAC players.