hi can the flac encoder be used to compress non-wave data? So suppose I rename a data file to *.wav, can i compress it then using the flac encoder to make it smaller? just wondering if this is possible -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac/attachments/20070903/b3091c47/attachment.html
On 9/3/07, Harry Sack <tranzedude@gmail.com> wrote:> can the flac encoder be used to compress non-wave data?It's actually PCM, not "wave data". I think you need to read on PCM on Wikipedia to understand that no, it's not possible.> So suppose I rename > a data file to *.wav, can i compress it then using the flac encoder to make > it smaller? > just wondering if this is possibleNo, it's not possible. That's actually very silly. File extensions are not an important thing outside the Windows world. Most applications read some initial data of a file and know what it actually is. In this case, the encoder would understand it would not be dealing with PCM data and not even try to attempt doing such a silly thing. I think what you are looking for is 7z. Its LZMA compression can compress files more than any other format. Install 7-zip. -Ivo
On Mon 3 Sep 4:04 pm Ivo Emanuel Gon?alves wrote:> > can the flac encoder be used to compress non-wave data? > No, it's not possible. ?That's actually very silly.Actually, there is no reason it should not run on the data fine, if presented to it appropriately. Input data is a binary stream, and any input will work correctly. With music data, most algorithms rely on the fact that adjacent samples are close to each other in value, so flac works out an equation that fits the data closely, then relies on knowing that the error (the residuals) are small, so it uses a nifty encoding scheme (Golomb-Rice I think) using extra 'padding' bits at the start to efficiently store the small numbers without needing to write the leading zeros as well. This process will work on any data, but for most inputs the output will probably be a bit bigger, as the polynomials will not fit the data well. The compression algorithm you use should really be tailored to the application for which you need it, but any input will work. I checked this on a pdf file: flac --force-raw-format --endian=little --channels=2 --bps=24 --sample-rate=24000 --sign=unsigned Arsene\ Lupin\ contre\ Herlock\ Sholmes.pdf The values you choose for channels etc are purely arbitrary, but will affect the compression (I got a ratio of 1.004, only slightly larger than the input). To decompress: flac -d --force-raw-format --endian=little --sign=unsigned Arsene\ Lupin\ contre\ Herlock\ Sholmes.flac -o test.pdf The output file was perfectly readable, and bit-perfect as expected. Nicholas
On Mon 3 Sep 4:04 pm Ivo Emanuel Gon?alves wrote:> I think what you are looking for is 7z. Its LZMA compression can > compress files more than any other format. Install 7-zip.7-zip is good, but it cannot compress more than any other format: a general purpose algorithm like this is good for most things, but if you know something about the distribution of the input, you will probably achieve better results using a more specific algorithm (this is why things like flac exist). A quick test of 7z on music gave 77% of the original size, and flac was 49%. This was a very bad study, but you get the idea. An algorithm good at picking up repeated patterns does well on text, while ones like jpeg are based on wavelets, and flac is an advanced delta compression system. All successful systems treat the input as more than just random data. Nicholas