Lossless: Difference between revisions

From Hydrogenaudio Knowledgebase
(Bonk, Squish, mp3hd, external links)
(So much text here that the lossless comparison was repeated in a link at the bottom. Changed headings. More tweaks.)
Line 11: Line 11:
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.   
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.   
The phrase "lossless" is not restricted to ''files'', it also refers to data streams (like a video file with lossless audio) or not in files (an audio [[CD]] has no files) - or furthermore, to 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 ===  
=== Notable lossless codecs in current use ===  
Line 21: Line 21:
* [[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.  
* [[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.
* [[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.
* [[OptimFROG]]. Even higher compression (and slower speed) than Monkey's.  Optional [[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.
* [[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).
* [[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.
* [[WavPack]]. Developed since the 1990s into arguably the most feature-rich lossless codec. Optional [[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. 


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 ===
=== 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):
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.
* [[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.  
* [[Windows Media Audio|WMA lossless]]: Once aggressively pushed by Microsoft, support for the WMA formats has waned to the point where certain Windows 10 releases could not handle WMA lossless(ly).  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.
* [[ATRAC]] Advanced Lossless: a lossless [[hybrid codec|hybrid]] extension of Sony's ATRAC format (MiniDisc etc.). Like WMA, a once-corporate-backed format now considered legacy.
* [[mp3HD]]: A short-lived similar extension of MP3 with a lossless correction stream.
* [[mp3HD]]: A short-lived similar extension of MP3, [[hybrid codec|hybrid]] with a lossless correction stream.
* [[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.
* [[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 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.
Line 39: Line 40:
* [[Sac]].  Only semi-notable for its even higher compression levels, not for ever being practically useful other than for benchmarking.
* [[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 general-purpose compressor WinRK. RKAU offered good compression for year 2000 standards.  
* [[RK Audio]] (RKAU) and the later general-purpose compressor WinRK. RKAU offered good compression for year 2000 standards.  
* [http://www.logarithmic.net/pfh/bonk Bonk]. Also with a lossy compressor, both abandoned around 2002.  More notable for the project evolving into the BonkEnc CD ripper, which later changed name to [[Fre:ac]].
* [http://www.logarithmic.net/pfh/bonk Bonk]. Also with a lossy compressor, both abandoned around 2002.  More notable for the project evolving into the BonkEnc CD ripper, which later changed name to [[fre:ac]].
* aptX Lossless is a codec to be used in Bluetooth streaming. Hardware support [https://www.qualcomm.com/news/releases/2021/09/01/qualcomm-adds-bluetooth-lossless-audio-technology-snapdragon-sound announced September 2021], future popularity unknown at time of writing.  


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.
Also several audio editing software have (had) their own formats, several of which are still in use.  


=== Oddball Formats ===
=== Oddball legacy formats ===
There are several old lossless formats that never made it to a significant userbase. 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.
There are several old lossless formats that never made it to a significant userbase. 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.


Line 54: Line 56:
* LiteWave
* LiteWave
* mkw
* mkw
* [https://en.wikipedia.org/wiki/Ogg_Squish OggSquish], an early lossless codec from Xiph. Discontinued in favour of FLAC.  
* [https://en.wikipedia.org/wiki/Ogg_Squish OggSquish] (Xiph, discontinued in favour of FLAC).
* Pegasus SPS
* Pegasus SPS
* Split2000
* Split2000
Line 62: Line 64:
* WaveZip/MUSICompress
* WaveZip/MUSICompress


Also several audio editing software have (had) their own formats.
== Further reading ==
 
== External links ==
* [https://www.rarewares.org/rrw/programs.php ReallyRareWares] has preserved older codecs
* [https://www.rarewares.org/rrw/programs.php ReallyRareWares] has preserved older codecs
* [http://fileformats.archiveteam.org/wiki/Audio_and_Music#Audio_recording_and_sound_waves Audio codec formats descriptions fileformats.archiveteam.org]
* [http://fileformats.archiveteam.org/wiki/Audio_and_Music#Audio_recording_and_sound_waves fileformats.archiveteam.org] has a section describing audio file formats.
* [[Lossless_comparison| HA Wiki's Lossless Codec Comparison]] originally by [[User:Rjamorim|Rjamorim]]  


[[Category:Codecs|*]]
[[Category:Codecs|*]]

Revision as of 09:01, 28 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 (like a video file with lossless audio) or not in files (an audio CD has no files) - or furthermore, to 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 has waned to the point where certain Windows 10 releases could not handle WMA lossless(ly). Not recommended.
  • ATRAC Advanced Lossless: a lossless hybrid extension of Sony's ATRAC format (MiniDisc etc.). Like WMA, a once-corporate-backed format now considered legacy.
  • mp3HD: A short-lived similar extension of MP3, hybrid with a lossless correction stream.
  • 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 general-purpose compressor WinRK. RKAU offered good compression for year 2000 standards.
  • Bonk. Also with a lossy compressor, both abandoned around 2002. More notable for the project evolving into the BonkEnc CD ripper, which later changed name to fre:ac.
  • aptX Lossless is a codec to be used in Bluetooth streaming. Hardware support announced September 2021, future popularity unknown at time of writing.

Also several audio editing software have (had) their own formats, several of which are still in use.

Oddball legacy formats

There are several old lossless formats that never made it to a significant userbase. 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
  • OggSquish (Xiph, discontinued in favour of FLAC).
  • Pegasus SPS
  • Split2000
  • Sonarc
  • VocPack
  • WavArc
  • WaveZip/MUSICompress

Further reading