Difference between revisions of "Lossless"

From Hydrogenaudio Knowledgebase
Jump to: navigation, search
(Rarewares link. Kexis. PCA. mkw. a-pac collated to "a". But this page needs update ...)
(Major rewrite. In particular, tiered up the codecs so that e.g. RKAU isn't 'popular' anymore (and WMAL shouldn't be).)
Line 1: Line 1:
Compression is '''lossless''' when decoding the compressed data gives a result which is identical bit-by-bit to the uncompressed original.
+
Compression is '''lossless''' when decoding the compressed data gives a result which is identical bit-by-bit to the uncompressed original.  Also, a format that stores data ''uncompressed'' is lossless if it can be reverted back to the original bit-by-bit.  
  
Generic file compression formats, like ZIP or RAR, are lossless. However, trying to compress raw audio with those generally results in files which are only slightly- if at all- smaller than the originals. Lossless audio formats take advantage of knowledge about real-world audio data to provide compression ratios averaging around 50% on most music.
+
Lossless compression has been used for long in various applications, for example ''generic file compressors'' like ZIP or RAR or Windows NTFS file compression feature; this article is about lossless compression of audio signals.  
  
[[Lossy]] encoders only attempt to approximate the sound of the original waveform rather than preserving all the information present in it. Losslessly compressed audio will therefore unavoidably be larger than audio compressed with any reasonable [[lossy]] encoder. However, this disadvantage is offset by lossless files' ability to be [[transcoding|transcoded]] to other lossless formats without any quality degradation.
+
== Lossless audio compression and formats ==
  
== Popular lossless formats ==
+
Compressing audio with generic file compressors to e.g. .7z or .rar will is not efficient for audio: file sizes typically end up fairly close to the uncompressed original.  Lossless audio formats might measure closer to half size of the original uncompressed [[PCM|linear PCM]] (.wav or .aiff) file, utilizing knowledge about real-world ''audio'' data.  File sizes will still be larger than audio compressed with any (reasonable) [[lossy]] encoder, as lossy compression aims at saving space by replacing the original signal by an approximation which is ''perceptually'' "close" but easier to compress.
* [[Apple Lossless]] ([[ALAC]])
+
* [[Free Lossless Audio Codec]] (FLAC)
+
* [[Lossless Audio]] (LA)
+
* [[Lossless Predictive Audio Compression]] (LPAC)
+
* [[Meridian Lossless Packing]] (MLP)
+
* [[Monkey's Audio]] (APE)
+
* [[OptimFROG]]
+
* [[RK Audio]] (RKAU)
+
* [[Shorten]] (SHN)
+
* [[TAK]]
+
* [[TTA]]
+
* [[WavPack]]
+
* [[Windows Media Audio|WMA lossless]]
+
  
== Oddball Formats ==
+
Lossless audio file formats ''typically'' have features that generic file compressors are lacking (but most lossy audio formats possess): for playback they can be read block by block rather than having to unpack the whole file first, and a decoder might pick up the audio mid-stream and play from there (like when tuning in radio on a channel).  Furthermore, they can be tagged with metadata like artist, album, title, track number etc. Because this feature is designed for metadata to be altered by users at their discretion, a lossless ''audio'' format need not transfer metadata bit-by-bit, only the audio - although certain lossless codecs can also store the original's metadata in a separate chunk to be recreated.  
There are several old lossless formats that aren't really deserving of having an article all for themselves. Reasons are: lack of widespread support, lack of features, bad efficiency and, most importantly, it seems no one is really interested in them.
+
  
Most of those would have disappeared by now, but several are being preserved for posterity at [[User:Rjamorim|rjamorim]]'s  Rarewares/[https://www.rarewares.org/rrw/programs.php ReallyRareWares] website.
+
Just like e.g. two .zip-compressed copies of the same file might differ due to e.g. effort made to find a smaller file with the same information - try for example 7-zip with different compression options - then the same original audio file might encode to different size depending on both codec format and the settings used upon encoding - possibly the compressor's internal choices could depend on the CPU and process different files with the same command given on two different computers. 
 +
 
 +
The phrase "lossless" is not restricted to ''files'', it also refers to data streams not in files (an audio [[CD]] has no files) - or the ''process'' that generates a signal.  E.g. reducing a 16-bit signal to 8 bits is not a "lossless" operation, and it does not become lossless even if the output signal is stored in a "lossless" format like FLAC (or even uncompressed .wav or .aiff).  [https://en.wikipedia.org/wiki/Master_Quality_Authenticated | MQA] is lossy processing even if delivered with a codec that ''could'' deliver the lossless signal. 
 +
 
 +
=== Notable lossless codecs in current use ===
 +
 
 +
Different [[codec|codecs]] - i.e., formats and encoders/decoders - have been developed with different priorities in mind, as trade-off between compressed file size vs encoding CPU load (time taken to encode) vs decoding CPU load (to play or decompress for e.g. creating lossy files for portable use).  Also they differ as to features and OS/third party support.  Thus there is no single 'superior for all' format.  To compare features and performance, see the HA Wiki's [[Lossless comparison]] - though arguably, performance was more of an issue with storage/CPU costs of the early 2000s when most popular lossless formats were launched and when the first version of the comparison and this article were written.
 +
 
 +
Some formats in current use - some widespread and available from online music stores, others arguably restricted to the enthusiast user segments - in alphabetical order:
 +
* [[Apple Lossless|Apple Lossless (ALAC)]].  Has support in the Apple ecosystem.
 +
* [[Free Lossless Audio Codec|Free Lossless Audio Codec (FLAC)]]. Probably the most common and well-supported lossless codec.  Highly optimized for light decoding CPU usage.
 +
* [[Monkey's Audio|Monkey's Audio (APE)]]. Launched 2000, it was by then ''the'' compressor for users who prioritized size over speed.  Still actively maintained.
 +
* [[OptimFROG]]. Even higher compression (and slower speed) than Monkey's.  Offers a [[hybrid codec|lossless/lossy hybrid]] encoding.
 +
* [[TAK|Tom's verlustfreier Audiokompressor (TAK)]]. More recently launched (2006), it has attracted attention for accomplishing both high speed and high compression levels.
 +
* [[TTA|The True Audio (TTA)]]. A single-setting compressor performing on the fast side (close to WavPack/FLAC).
 +
* [[WavPack]]. Developed since the 1990s into arguably the most feature-rich lossless codec. Offers a [[hybrid codec|lossless/lossy hybrid]] encoding.
 +
 
 +
Also Blu-Ray/DVD discs are certainly widespread, carrying a variety of audio formats of which the lossless compressed formats are [[Meridian Lossless Packing]] (MLP), Dolby TrueHD (uses the MLP algorithm) and [[DTS-HD|DTS-HD MA]] (hybrid).  [https://en.wikipedia.org/wiki/FFmpeg FFmpeg] has support for these.
 +
==== Other (once) notable formats ====
 +
These formats once have at some stage been widely used or otherwise notable, though end-users would hardly encode to them anymore (as of 2022):
 +
* [[Shorten]] (SHN): The major lossless compressor of the 1990s.
 +
* [[Windows Media Audio|WMA lossless]]: Once aggressively pushed by Microsoft, support for the WMA formats have waned to the point where certain Windows 10 releases could not handle WMA lossless.  Not recommended.
 +
* [[ATRAC]] Advanced Lossless: a lossless extension of Sony's ATRAC format (MiniDisc etc.). Like WMA, a once-corporate-backed format now considered legacy.
 +
* [[Real Lossless]]. Before the Windows Media suite, Real Networks had theirs, and it was expanded with a lossless audio format and a freeware encoder.  Real would later support the development of MPEG-4 ALS.
 +
* [[MPEG-4 ALS]]. Despite being an ISO standard, with an open-source encoder/decoder available, the format scarcely caught on.  Its predecessors [[MPEG-4 ALS | LPAC/LTAC]] once enjoyed some popularity in competition with Shorten.
 +
* [[MPEG-4 SLS]]. Also ISO-standardized, but hardly in use, and obviously not intended for end-users, witnessed by the pricing of the only known encoder.
 +
* [[Lossless Audio]] (La).  Notable for its very high compression levels, and would therefore appear in comparison tests.  Unmaintained since 2004.
 +
* [[Sac]].  Only semi-notable for its even higher compression levels, not for ever being practically useful other than for benchmarking.
 +
* [[RK Audio]] (RKAU) and the later WinRK. Offered good compression for year 2000 standards.
 +
 
 +
And finally, as of writing (January 2022), aptX Lossless (to be used for Bluetooth streaming) got [https://www.qualcomm.com/news/releases/2021/09/01/qualcomm-adds-bluetooth-lossless-audio-technology-snapdragon-sound hardware support] announced less than half a year ago. Future popularity unknown.
 +
 
 +
=== Oddball Formats ===
 +
There are several old lossless formats that never made it to a user base that warranted an article for themselves. Most of those would have disappeared by now, but several are being preserved for posterity at [[User:Rjamorim|rjamorim]]'s  Rarewares/[https://www.rarewares.org/rrw/programs.php ReallyRareWares] website.
  
 
* a-Pac (by sound card manufacturer MARIAN)
 
* a-Pac (by sound card manufacturer MARIAN)
Line 35: Line 54:
 
* mp3HD
 
* mp3HD
 
* Pegasus SPS
 
* Pegasus SPS
* Perfect Clarity Audio (might still be supported in [https://en.wikipedia.org/wiki/Sound_Forge SoundForge], being developed in the 1990s(?) for its predecessor)
 
* RKaudio
 
 
* Split2000
 
* Split2000
 
* Sonarc
 
* Sonarc
Line 42: Line 59:
 
* WavArc
 
* WavArc
 
* WaveZip/MUSICompress
 
* WaveZip/MUSICompress
 
Note that currently '''no single format can be considered best for all applications'''. Rather, the best format depends on the ''intended use'', as well as a number of other factors (such as licensing and file structure). For example, Shorten and FLAC are widely used for sharing live music because of their cross-platform support and speed. Monkey's Audio is popular among Windows users for its superior compression ratio.
 
 
== Comparisons ==
 
''Note the specific assumptions and limitations of each comparison; in particular, results are sensitive to the music selected'''
 
  
; [[Lossless comparison]] : A comparision focusing more on codec features and less on absolute encoding efficiency. Also features a table comparing most popular codecs based on their features.
+
Also several audio editing software have (had) their own formats.
  
* Lossless audio formats [http://www.bobulous.org.uk/misc/lossless_audio_2006.html here] - A comparison of the rip-and-encode speed and album file size of six different lossless formats: [[WAV|uncompressed Wave]], [[FLAC]], [[WavPack]], [[SHN|Shorten]], [[APE|Monkey's Audio]], and [[OptimFROG]]. First published on 22nd May 2006.
 
  
 
[[Category:Codecs|*]]
 
[[Category:Codecs|*]]

Revision as of 19:29, 27 January 2022

Compression is lossless when decoding the compressed data gives a result which is identical bit-by-bit to the uncompressed original. Also, a format that stores data uncompressed is lossless if it can be reverted back to the original bit-by-bit.

Lossless compression has been used for long in various applications, for example generic file compressors like ZIP or RAR or Windows NTFS file compression feature; this article is about lossless compression of audio signals.

Lossless audio compression and formats

Compressing audio with generic file compressors to e.g. .7z or .rar will is not efficient for audio: file sizes typically end up fairly close to the uncompressed original. Lossless audio formats might measure closer to half size of the original uncompressed linear PCM (.wav or .aiff) file, utilizing knowledge about real-world audio data. File sizes will still be larger than audio compressed with any (reasonable) lossy encoder, as lossy compression aims at saving space by replacing the original signal by an approximation which is perceptually "close" but easier to compress.

Lossless audio file formats typically have features that generic file compressors are lacking (but most lossy audio formats possess): for playback they can be read block by block rather than having to unpack the whole file first, and a decoder might pick up the audio mid-stream and play from there (like when tuning in radio on a channel). Furthermore, they can be tagged with metadata like artist, album, title, track number etc. Because this feature is designed for metadata to be altered by users at their discretion, a lossless audio format need not transfer metadata bit-by-bit, only the audio - although certain lossless codecs can also store the original's metadata in a separate chunk to be recreated.

Just like e.g. two .zip-compressed copies of the same file might differ due to e.g. effort made to find a smaller file with the same information - try for example 7-zip with different compression options - then the same original audio file might encode to different size depending on both codec format and the settings used upon encoding - possibly the compressor's internal choices could depend on the CPU and process different files with the same command given on two different computers.

The phrase "lossless" is not restricted to files, it also refers to data streams not in files (an audio CD has no files) - or the process that generates a signal. E.g. reducing a 16-bit signal to 8 bits is not a "lossless" operation, and it does not become lossless even if the output signal is stored in a "lossless" format like FLAC (or even uncompressed .wav or .aiff). | MQA is lossy processing even if delivered with a codec that could deliver the lossless signal.

Notable lossless codecs in current use

Different codecs - i.e., formats and encoders/decoders - have been developed with different priorities in mind, as trade-off between compressed file size vs encoding CPU load (time taken to encode) vs decoding CPU load (to play or decompress for e.g. creating lossy files for portable use). Also they differ as to features and OS/third party support. Thus there is no single 'superior for all' format. To compare features and performance, see the HA Wiki's Lossless comparison - though arguably, performance was more of an issue with storage/CPU costs of the early 2000s when most popular lossless formats were launched and when the first version of the comparison and this article were written.

Some formats in current use - some widespread and available from online music stores, others arguably restricted to the enthusiast user segments - in alphabetical order:

Also Blu-Ray/DVD discs are certainly widespread, carrying a variety of audio formats of which the lossless compressed formats are Meridian Lossless Packing (MLP), Dolby TrueHD (uses the MLP algorithm) and DTS-HD MA (hybrid). FFmpeg has support for these.

Other (once) notable formats

These formats once have at some stage been widely used or otherwise notable, though end-users would hardly encode to them anymore (as of 2022):

  • Shorten (SHN): The major lossless compressor of the 1990s.
  • WMA lossless: Once aggressively pushed by Microsoft, support for the WMA formats have waned to the point where certain Windows 10 releases could not handle WMA lossless. Not recommended.
  • ATRAC Advanced Lossless: a lossless extension of Sony's ATRAC format (MiniDisc etc.). Like WMA, a once-corporate-backed format now considered legacy.
  • Real Lossless. Before the Windows Media suite, Real Networks had theirs, and it was expanded with a lossless audio format and a freeware encoder. Real would later support the development of MPEG-4 ALS.
  • MPEG-4 ALS. Despite being an ISO standard, with an open-source encoder/decoder available, the format scarcely caught on. Its predecessors LPAC/LTAC once enjoyed some popularity in competition with Shorten.
  • MPEG-4 SLS. Also ISO-standardized, but hardly in use, and obviously not intended for end-users, witnessed by the pricing of the only known encoder.
  • Lossless Audio (La). Notable for its very high compression levels, and would therefore appear in comparison tests. Unmaintained since 2004.
  • Sac. Only semi-notable for its even higher compression levels, not for ever being practically useful other than for benchmarking.
  • RK Audio (RKAU) and the later WinRK. Offered good compression for year 2000 standards.

And finally, as of writing (January 2022), aptX Lossless (to be used for Bluetooth streaming) got hardware support announced less than half a year ago. Future popularity unknown.

Oddball Formats

There are several old lossless formats that never made it to a user base that warranted an article for themselves. Most of those would have disappeared by now, but several are being preserved for posterity at rjamorim's Rarewares/ReallyRareWares website.

  • a-Pac (by sound card manufacturer MARIAN)
  • Advanced Digital Audio (ADA)
  • AudioZip
  • Dakx WAV
  • Entis Lab MIO
  • Kexis
  • LiteWave
  • mkw
  • mp3HD
  • Pegasus SPS
  • Split2000
  • Sonarc
  • VocPack
  • WavArc
  • WaveZip/MUSICompress

Also several audio editing software have (had) their own formats.