Skip to main content

Topic: LossyFLAC outputs larger file then plain FLAC? (Read 3406 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • romor
  • [*][*][*][*][*]
LossyFLAC outputs larger file then plain FLAC?
I converted 2min sample to be sent over internet:

size: 6.412.156 B [TAK -p2]
size: 6.802.070 B [FLAC -8]
size: 7.083.526 B [lossyFLAC -q5 | FLAC -8]
size: 5.838.614 B [lossyFLAC -q2 | FLAC -8]

I didn't know that lossyFLAC with any switch can result in larger file then plain FLAC. Why can that be or is it OK?

  • Nick.C
  • [*][*][*][*][*]
  • Developer
LossyFLAC outputs larger file then plain FLAC?
Reply #1
It could be that the original material compresses particularly well in FLAC. Compression of lossyWAV processed audio results in a slightly higher overhead due to the smaller block size used (512 rarher than 4096 samples). This phenomenon has been observed before where some files get bigger.
lossyWAV -q X -a 7 -A 0.586740 --feedback 5| FLAC -5 -e -p -b 512 -P=4096 -S- ~= 314kbps

  • romor
  • [*][*][*][*][*]
LossyFLAC outputs larger file then plain FLAC?
Reply #2
Yes, origanal was well compressed (472 Kb/s)
So, is this like general case for lossyFLAC (lossyWAV) to behave like this if FLAC compressed the material at < 500 Kb/s (for -q5), or this are some exceptions caused by known content of source material?
  • Last Edit: 30 September, 2010, 02:31:10 AM by romor

  • Northpack
  • [*][*][*][*]
LossyFLAC outputs larger file then plain FLAC?
Reply #3
I wonder if it would be possible to implement a special LossyWAV switch for FLAC? It would tell FLAC to encode each 4048 samples once as a whole block and once divided into 4 blocks of 512 samples and choose whatever compresses better. Do the FLAC specifications allow for such a variable block size?

  • halb27
  • [*][*][*][*][*]
LossyFLAC outputs larger file then plain FLAC?
Reply #4
Yes, origanal was well compressed (472 Kb/s)
So, is this like general case for lossyFLAC (lossyWAV) to behave like this if FLAC compressed the material at < 500 Kb/s (for -q5), or this are some exceptions caused by known content of source material?

From my experience in case of a original FLAC compression of 472 kbps chance to get a smaller file size when using lossyWAV -q5 and below is pretty high though it won't be much what you gain. But the better FLAC compression is on its own, the higher the chance that lossyFLAC makes it worse. With relative quiet music originating from one or few instruments lossyWAV is more of a disadvantage than an advantage.

From overall view however it's extremely rare that lossyWAV increases file size, that's why I personally don't care about it.
  • Last Edit: 30 September, 2010, 04:09:41 AM by halb27
lame3995n -Q0.5

  • romor
  • [*][*][*][*][*]
LossyFLAC outputs larger file then plain FLAC?
Reply #5
But the better FLAC compression is on its own, the higher the chance that lossyFLAC makes it worse. With relative quiet music originating from one or few instruments lossyWAV is more of a disadvantage than an advantage.

So one more consideration in using lossyWAV would be content of source material (or looking at FLAC bitrate compared to lossyWAV profile chosen)
  • Last Edit: 30 September, 2010, 04:56:52 AM by romor

  • 2Bdecided
  • [*][*][*][*][*]
  • Developer
LossyFLAC outputs larger file then plain FLAC?
Reply #6
I wonder if it would be possible to implement a special LossyWAV switch for FLAC? It would tell FLAC to encode each 4048 samples once as a whole block and once divided into 4 blocks of 512 samples and choose whatever compresses better. Do the FLAC specifications allow for such a variable block size?
I think we discussed this a year or more back. The FLAC spec fully supports variable block lengths within a single file.

An optimised FLAC encoder (never mind lossyWAV or anything else) would probably make use of this feature. However, no current FLAC encoders do this, so there are no variable block length files around. Which raises the possibility that at least some FLAC decoders might not be built to expect them. Who knows?

You could build a special FLAC encoder to independently adapt the blocksize, or integrate lossyWAV into FLAC and set the blocksize dynamically, or just create two FLACs from each lossyWAV file (i.e. a 512 and a 4048 version) and chop them together using an external utility, keeping whichever version was smaller for each 4048 samples.


Apart from the change in blocksize, it's really quite rare for lossyWAV to increase the encoded filesize. Has anyone actually seen it happen when the FLAC settings (including blocksize) are identical for lossless vs lossyWAV encodings? I'm guessing it could happen, but I'm not sure what kind of signal(s) would trigger this behaviour. If people were paranoid about this, you could write another external script to check it block-by-block by comparing the two versions, and keeping the smaller block - but as I say, I'm not sure when this happens, if at all, and it's a cumbersome sledgehammer-to-crack-a-nut kind of solution.

btw, it's not too unusual for lossyWAV to do exactly nothing. Which is a good thing.

Cheers,
David.
  • Last Edit: 30 September, 2010, 05:17:01 AM by 2Bdecided