Skip to main content
Topic: bits/sample, kbits/second? (Read 1600 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

bits/sample, kbits/second?

I'm interested in the advantages/disadvantages of using -b with a value smaller than 24 (bits/sample) vs. one bigger or equal to 24 (kbits/second). What's the technical difference and if there is any, how do these two "modes" differ with regards to quality?
WavPack 5.1: -cb320x4mrv

Re: bits/sample, kbits/second?

Reply #1
Ouch... I needed to check on which subforum this post was in, to even understand what the question was about.

From the manual
-bn = enable hybrid compression, n = 2.0 to 23.9 bits/sample, or
                                 n = 24-9600 kbits/second (kbps)
The default operation of WavPack is pure lossless, which means that the .wv file contains all the information that was in the original .wav file. The hybrid mode allows the user to specify a target bitrate for the output file, either in kilobits per second (kbps) or bits per sample. If the track can be losslessly compressed without exceeding the specified bitrate, then it will be and WavPack will report the compression as lossless. If lossless compression would exceed the specified bitrate, then WavPack will begin carefully discarding the least significant portion of the audio information to stay within the limit. Every effort is made to keep this inaudible, including the use of joint stereo, dynamic bit allocation and noise shaping. WavPack will report this as "lossy" compression. Although the option accepts bitrates as low as 24 kbps, the actual value that WavPack can achieve is usually much higher than that. For example, with CD-audio sampled at 44.1k the lower limit is about 196 kbps.
The hybrid mode can be used quite successfully with floating-point audio, however it should not be used for scientific type floating-point data because the hybrid algorithm might not be application appropriate (and floating-point "exception" values like infinities or NaNs will not be properly encoded). Use only the pure lossless mode with non-audio floating-point data.

So, first, we are talking about the lossy part of hybrid encoding of WavPack.

I don't know the innerworkings, so I will not give the best answer, but basically, you tell the encoder to constraint the quality either by the desired signal to noise ratio, or by the desired average bitrate of the lossy file.

The bitdepth (bits/sample) determines the allowed amount of noise distortion on the signal. At 24bits (for a 24bit file) it doesn't allow any distortion. At 16bits, it would allow a distortion that would be around the noise floor of an Audio CD.  8bits would be a noisy background, but where music could still be heard without much issues (except if it is a low volume passage).

The bitrate (kbps/second) determines the desired size of the file ( given a bitrate and a duration in seconds, you get the file size by multiplying those values). In this case, the encoder is responsible to determine the allowed noise floor, i.e. the allowed bitdepth.

I don't have enough knowledge of the codec to say if the bitrate mode can change the bitdepth dynamically, or it is more or less fixed, but I remember that when LossyWav was developed, that Wavpack was not so advanced.

Re: bits/sample, kbits/second?

Reply #2
I believe that bits per sample (<24) is just another expression of bitrate, where the bitrate is dynamically adjusted relative to the number of channels and sampling rate of the input. For example, if you feed the encoder a mixture of mono and stereo files at CD quality, and specify -b 4, then the average bitrates will be approximately 176 and 352 kbit/s respectively, without the need to sort the input files in advance and use different parameters.

Re: bits/sample, kbits/second?

Reply #3
@j7n:   Oh... I see. You are probably right:  176000 /44100 = 3.99 (so, sample understood as individual sample, not as a sample frame)

Re: bits/sample, kbits/second?

Reply #4
Thanks for the answers, guys. Do you personally prefer one mode over the other?
WavPack 5.1: -cb320x4mrv


Re: bits/sample, kbits/second?

Reply #5
Thanks for the answers, guys. Do you personally prefer one mode over the other?
Specifying bits per sample allows bit rate to scale linearly with the sample rate. I'm not sure if this results in a constant quality in practice, but to me it makes more sense in a distribution format than setting a constant bit rate.

SimplePortal 1.0.0 RC1 © 2008-2019