WavPack: Difference between revisions
Porcuswiki (talk | contribs) (5.6.0 updates) |
Porcuswiki (talk | contribs) (No, suffix does *not* override output filetype, that is FLAC ... Then details ... about metadata import, DSD, CAF fractional sampling rates apparently rejected, and about -vvv.) |
||
Line 15: | Line 15: | ||
'''WavPack''' (pronounced "wave-pack") is a [[lossless]] audio [[codec]], also offering optionally a [[hybrid codec| hybrid lossless/lossy]] mode. It is distributed as a free open-source encoder/decoder with a library and a large number of tools, including a Windows GUI and a range of plugins for both audio players and other software. Third party implementations are available, including ffmpeg. WavPack supports and/or can be played back on a large number of platforms/OSes including mobile (Android, iOS), portable ([[Rockbox]]) and even web apps. | '''WavPack''' (pronounced "wave-pack") is a [[lossless]] audio [[codec]], also offering optionally a [[hybrid codec| hybrid lossless/lossy]] mode. It is distributed as a free open-source encoder/decoder with a library and a large number of tools, including a Windows GUI and a range of plugins for both audio players and other software. Third party implementations are available, including ffmpeg. WavPack supports and/or can be played back on a large number of platforms/OSes including mobile (Android, iOS), portable ([[Rockbox]]) and even web apps. | ||
WavPack is arguably the most feature-rich lossless compressor, supporting a unique range of audio signals including [https://en.wikipedia.org/wiki/Direct_Stream_Digital Direct-Stream Digital]. Everyday use is supported by a wide range of players and taggers, but conversion is likely safest done with applications that invoke the official tools (rather than e.g. ffmpeg's implementation) – and special features might require the user to apply the WavPack executable directly, for example with drag+drop, see the | WavPack is arguably the most feature-rich lossless compressor, supporting a unique range of audio signals including [https://en.wikipedia.org/wiki/Direct_Stream_Digital Direct-Stream Digital]. Everyday use is supported by a wide range of players and taggers, but conversion is likely safest done with applications that invoke the official tools (rather than e.g. ffmpeg's implementation) – and special features might require the user to apply the WavPack executable directly, for example with drag+drop, see the [[#Using WavPack]] section below. | ||
Performance-wise, WavPack defaults to a fast codec – less CPU intensive than [[ALAC]], but typically not as fast as [[FLAC]] or [[TAK]], especially in decoding CPU usage.<ref>[http://www.audiograaf.nl/losslesstest Martijn van Beurden: <em>Lossless audio codec comparison archive</em>], all comparisons in this wiki article consistent with CDDA results from revision 5, 2022, using WavPack 5.4.0.</ref> In the age of low-power portable Rockbox-equipped players, WavPack could be seen as a reasonable middle ground between FLAC's low CPU footprint and long battery life, and the smaller files but more CPU-intensive [[Monkey's Audio]]<ref>[https://www.rockbox.org/wiki/CodecPerformanceComparison CodecPerformanceComparison] at the Rockbox wiki</ref> – invoking WavPacks high mode and extra compression that would compress to smaller sizes than FLAC. | Performance-wise, WavPack defaults to a fast codec – less CPU intensive than [[ALAC]], but typically not as fast as [[FLAC]] or [[TAK]], especially in decoding CPU usage.<ref>[http://www.audiograaf.nl/losslesstest Martijn van Beurden: <em>Lossless audio codec comparison archive</em>], all comparisons in this wiki article consistent with CDDA results from revision 5, 2022, using WavPack 5.4.0.</ref> In the age of low-power portable Rockbox-equipped players, WavPack could be seen as a reasonable middle ground between FLAC's low CPU footprint and long battery life, and the smaller files but more CPU-intensive [[Monkey's Audio]]<ref>[https://www.rockbox.org/wiki/CodecPerformanceComparison CodecPerformanceComparison] at the Rockbox wiki</ref> – invoking WavPacks high mode and extra compression that would compress to smaller sizes than FLAC. | ||
WavPack has inspired other codecs<ref>Monkey's Audio FAQ {{webarchive|http://web.archive.org/web/20001017210206/http://www.monkeysaudio.com/faq.html|2000-10-17}}</ref> and their features<ref>[http://losslessaudio.org/DualStream.php OptimFROG's "DualStream"] hybrid encoding</ref>. For more on WavPack, including on its history and technology, see the [https://en.wikipedia.org/wiki/WavPack Wikipedia entry]. | WavPack has inspired other codecs<ref>Monkey's Audio FAQ {{webarchive|http://web.archive.org/web/20001017210206/http://www.monkeysaudio.com/faq.html|2000-10-17}}</ref> and their features<ref>[http://losslessaudio.org/DualStream.php OptimFROG's "DualStream"] hybrid encoding – apparently WavPack coined this phrase</ref>. For more on WavPack, including on its history and technology, see the [https://en.wikipedia.org/wiki/WavPack Wikipedia entry]. | ||
= Features = | = Features = | ||
For an end-user considering WavPack as | For an end-user considering WavPack as an audio format, its feature-richness might be the big selling point. WavPack supports pretty much all the more common features noted at [[Lossless_comparison| HA Wiki's Lossless Codec Comparison]] as in the following first list, but several users might consider the more unique features listed under the subsequent headline. | ||
* Seekable and streaming playback. | * Seekable and streaming playback. | ||
* Error handling: upon playback, it will detect and report corrupted frames, mute to protect against static/noise output, and continue playback. Since version 5, WavPack can also check for corruption without decoding, hence quicker than any decoding format. Optional MD5 audio checksum can also be added upon encoding for file fingerprinting. | * Error handling: upon playback, it will detect and report corrupted frames, mute to protect against static/noise output, and continue playback. Since version 5, WavPack can also check for corruption without decoding, hence quicker than any decoding format. Optional MD5 audio checksum can also be added upon encoding for file fingerprinting. | ||
* High-resolution audio support (see next headline). | * High-resolution audio support (see next headline). | ||
* Multichannel support: currently capped at 256 channels, supports [https://docs.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible WAVEFORMATEXTENSIBLE] channel masks. | * Multichannel support: currently capped at 256 channels, supports [https://docs.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible WAVEFORMATEXTENSIBLE] channel masks. | ||
* Piping support for encoding, and support for RAW PCM input/output. | * Piping support for encoding, and support for RAW PCM input/output. | ||
* | * Non-audio chunks (RIFF and similar) stored; by default, WavPack will not only decode the audio losslessly, but restore the non-audio chunks to file bit-identical to the original. | ||
* Tagging: APEv2. (ID3v1 is possible, but not advisable.) | * Tagging: APEv2. (ID3v1 is possible, but not advisable.) | ||
* Cuesheet support. In practice, some applications handle ''embedded'' cuesheets better in WavPack than in some other formats. | * Cuesheet support. In practice, some applications handle ''embedded'' cuesheets better in WavPack than in some other formats. | ||
Line 37: | Line 37: | ||
* Windows GUI available. | * Windows GUI available. | ||
WavPack also handles bit depths not divisible by 8, and is known to employ a "wasted bits" strategy: | WavPack also handles bit depths not divisible by 8, and is known to employ a "wasted bits" strategy: Say, if a WAVE file contains a 20 bit signal mono signal (which in WAVE takes up three bytes per sample anyway), but the two least significant bits are always zero, WavPack will compress it to the same size as if it were specified as the actual information content of eighteen bits – and will display it as 20 as per the WAVE's header flags (and restore it that way). | ||
== Special/unique features == | == Special/unique features == | ||
Most of these features are shared with only a few if any notable codecs, or extend to signal types or file types others do not support (comparisons given). | Most of these features are shared with only a few if any notable codecs, or extend to signal types or file types others do not support (comparisons given). | ||
* DSD support: can losslessly compress Philips DSDIFF and Sony DSF files (see "Using WavPack" below | * DSD support: can losslessly compress Philips DSDIFF and Sony DSF files (see "Using WavPack" below; no other end-user codec compresses DSD.) ID3v2.3 tags can be imported. | ||
* High-resolution support for bit depth 1-bit to 32-bit integer and sampling rates up to 2 GiHz in integer steps. (Officially, 1 GHz is supported – it is ''gigaherz'', not MHz, the upper limit being in the UHF radio frequency band. Monkey's Audio, OptimFROG and MPEG-4 ALS support the entire WAVE range up to 4 GiHz.) | * High-resolution support for bit depth 1-bit to 32-bit integer and sampling rates up to 2 GiHz in integer steps. (Officially, 1 GHz is supported – it is ''gigaherz'', not MHz, the upper limit being in the UHF radio frequency band. Monkey's Audio, OptimFROG and MPEG-4 ALS support the entire WAVE range up to 4 GiHz.) Can also compress AIFF files of non-integer sampling rates and recreate them bit-perfectly, but will round off sampling rate upon playback. | ||
* 32-bit ''floating-point'' supported – also including CoolEdit/Adobe Audition's own float format (use the <tt>-a</tt> option only if the .wav was generated by CoolEdit/Audition). (This line like OptimFROG.) | * 32-bit ''floating-point'' supported – also including CoolEdit/Adobe Audition's own float format (use the <tt>-a</tt> option only if the .wav was generated by CoolEdit/Audition). (This line like OptimFROG.) | ||
* As much as 256 channels currently supported (from version 5.5.0 on; [https://github.com/dbry/WavPack/issues/117 can be extended to the thousands] – for even more, MPEG-4 ALS supports 66536.) | * As much as 256 channels currently supported (from version 5.5.0 on; [https://github.com/dbry/WavPack/issues/117 can be extended to the thousands] – for even more, MPEG-4 ALS supports 66536.) | ||
* Hybrid lossy/lossless mode (can also be used as lossy – OptimFROG also has such a mode.) | * Hybrid lossy/lossless mode (can also be used as lossy – OptimFROG also has such a mode.) | ||
* | * For LPCM it can read and output to WAVE including extensions like RF64, to Sony's Wave64, AIFF/AIFC (both endiannesses) and CAF (ditto) – with full restore of also non-audio parts to bit-by-bit the original file in the original format. (Monkey's/OptimFROG/TAK do the same to the input formats they support.) Also WavPack can handle too large noncompliant "WAVE" files (can still be restored to bit-identical the same as the flawed input file – or to formats that provide for larger files). | ||
* Recompression: Can recompress .wv files in place, with tag transfer. (Like FLAC on .flac files.) | * Recompression: Can recompress .wv files in place, with tag transfer. (Like FLAC on .flac files.) | ||
* Drag and drop support: Dropping a file on to wavpack.exe/wvunpack.exe will encode/decode it to source directory. (Like FLAC.) From 5.5.0, one can also apply options to drag and drop by renaming the executable, and drop several files. | * Drag and drop support: Dropping a file on to wavpack.exe/wvunpack.exe will encode/decode it to source directory. (Like FLAC.) From 5.5.0, one can also apply options to drag and drop by renaming the executable, and drop several files. | ||
== Limitations == | == Limitations == | ||
WavPack supports nearly every input format that any competing codec handles | The following bullet item list is hardly of interest except for special purposes; WavPack supports nearly every input format that any competing codec handles. One exception is the legacy AU/SND, apparently supported only by Monkey's Audio. | ||
* DSD: Will reject DST-compressed | * DSD: Will reject DST-compressed DSDIFF (which are already compressed heavier than WavPack does) and Wideband Single-bit Data files (apparently, the Tascam and Korg devices which can produce these, can also export to other DSD formats).<br/> Also, DSD files cannot be encoded as hybrid with correction files. | ||
* Certain rare files – largely unsupported by other codecs – may be played back with technical compromise solutions that are unlikely to concern the average end-user. Should one encounter one of those rare AIFF files which have a non-integer sampling rate (something WAVE does not support), WavPack will compress them and wvunpack will restore them bit-identically with no loss of information – but playback will be at integer rate. E.g., a file sampled at 44100.441 Hz will be played back at 0.001 percent wrong speed – unlikely to be noticed by ear, and more likely to be accepted by an audio player. | |||
* 64-bit float is not supported. (Apparently no other lossless audio compressor can support it either.) | |||
* wvunpack can ''force output'' to a different format than input, but like every decoder offering such an option, it does not let the user select any version of the output format. None of the competing codecs can force selection of WAVE format (closest is FLAC, which can enforce RF64 and in an upcoming version will be able to force the original WAVE_FORMAT_PCM over WAVE_FORMAT_EXTENSIBLE); wvunpack's <tt>--wav</tt> will enforce its choice WAVE version (= RF64 iff the file is too big for WAVE, but RF64 cannot be forced otherwise). Only FLAC and WavPack can enforce AIFF output, and only wvunpack can select little-endian (AIFC type "sowt"), but wvunpack will avoid AIFC as long as the signal can be fit in the original AIFF container. And although wvunpack can force DSDIFF encodes to DSF and vice versa, it has no DSD encoder and can not convert PCM to DSD. | |||
* <tt>--import-id3</tt> can currently only import ID3v2.3. (Not ID3v2.4.) Also it has a limit of 1 MB unless <tt>--allow-huge-tags</tt> is specified (use [[Mp3tag]] to copy tags). Tags > 1 MB are warned against for compatibility reasons, but it is not known what applications may reject such files. | |||
* Some third-party implementations have limitations and bugs waiting to be fixed. | * Some third-party implementations have limitations and bugs waiting to be fixed. | ||
WavPack version 5 discontinues some features, like compression to Windows .sfx self-extracting file (cf. OptimFROG) and the <tt>-p</tt> feature. Furthermore, WavPack version 3.x files are no longer supported. To recompress these files (if any are still around, WavPack 4 was released in 2004) to WavPack 5 files (for the fast decoding-free error checking feature), one must first recompress by WavPack 4.80 (still available) or lower, and then by WavPack 5. | WavPack version 5 discontinues some features, like compression to Windows .sfx self-extracting file (cf. OptimFROG) and the <tt>-p</tt> feature. Furthermore, WavPack version 3.x files are no longer supported. To recompress these files (if any are still around, WavPack 4 was released in 2004) to WavPack 5 files (for the fast decoding-free error checking feature), one must first recompress by WavPack 4.80 (still available) or lower, and then by WavPack 5. | ||
Line 62: | Line 63: | ||
As of 5.5.0 and above, MacOS versions must be built with e.g. HomeBrew. For Windows XP, a special executable is required, available at wavpack.com (brought back as of 5.6.0, upgrade is advised). | As of 5.5.0 and above, MacOS versions must be built with e.g. HomeBrew. For Windows XP, a special executable is required, available at wavpack.com (brought back as of 5.6.0, upgrade is advised). | ||
WavPack has traditionally had less hardware support than FLAC ([[Rockbox]] having been the most notable platform, others listed at https://www.wavpack.com/index.html#Hardware ), but with WavPack playback through Android and iOS players, the distinction between "hardware" and "software" is arguably blurred. There have been issues getting certain Android solutions to recognize media files including WavPack.<ref>[https://hydrogenaud.io/index.php/topic,122768 | WavPack has traditionally had less hardware support than FLAC ([[Rockbox]] having been the most notable platform, others listed at https://www.wavpack.com/index.html#Hardware ), but with WavPack playback through Android and iOS players, the distinction between "hardware" and "software" is arguably blurred. There have been issues getting certain Android solutions to recognize media files including WavPack.<ref>[https://hydrogenaud.io/index.php/topic,122768 HA thread with link to Android bug report by the Monkey's Audio author]</ref> | ||
Third-party support for hybrid-encoded lossless playback (the correction files, see below) is known to be limited. | Third-party support for hybrid-encoded lossless playback (the correction files, see below) is known to be limited. | ||
Line 71: | Line 72: | ||
Unlike most other codecs, WavPack has separate encoding and decoding executables (wavpack and wvunpack). | Unlike most other codecs, WavPack has separate encoding and decoding executables (wavpack and wvunpack). | ||
== | == Encoding/decoding by drag and drop (Windows) == | ||
The simplest encoding/decoding might be ''dragging and dropping'' a (supported) file to wavpack.exe (/wvunpack.exe). Then the file will be encoded/decoded with the default options. Dropping a .wv file onto wavpack.exe will recompress it, prompting before overwrite (again, using default settings – possibly a bad deal if it was encoded with high -x switches). Drag and drop also works on a shortcut to the executable. It is not possible to drop a folder, but from version 5.5.0, there is a way to drag and drop ''several'' files. | The simplest encoding/decoding might be ''dragging and dropping'' a (supported) file to wavpack.exe (/wvunpack.exe). Then the file will be encoded/decoded with the default options. Dropping a .wv file onto wavpack.exe will recompress it, prompting before overwrite (again, using default settings – possibly a bad deal if it was encoded with high -x switches). Drag and drop also works on a shortcut to the executable. It is not possible to drop a folder, but from version 5.5.0, there is a way to drag and drop ''several'' files. | ||
From version 5.5.0, drag and drop supports ''options'' by renaming the executable. The user can rename a copy of the executable according to preferred settings, which will be applied to the process upon drag and drop. The example given by the developer in [https://hydrogenaud.io/index.php/topic,122626.msg1012159.html#msg1012159 in this HA forum post]<ref>[https://hydrogenaud.io/index.php/topic,122626.msg1012159.html#msg1012159 HA forum post on how to rename executable for drag and drop]</ref> uses encoding options that many WavPack users will recommend (better compression than default, verification and MD5 fingerprinting), and novice users can choose to copy that filename for the executable. For fine-tuning performance or for more specialized tasks, more options are described below. | From version 5.5.0, drag and drop supports ''options'' by renaming the executable. The user can rename a copy of the executable according to preferred settings, which will be applied to the process upon drag and drop. The example given by the developer in [https://hydrogenaud.io/index.php/topic,122626.msg1012159.html#msg1012159 in this HA forum post]<ref>[https://hydrogenaud.io/index.php/topic,122626.msg1012159.html#msg1012159 HA forum post on how to rename executable for drag and drop]</ref> uses encoding options that many WavPack users will recommend (better compression than default, verification and MD5 fingerprinting), and novice users can choose to copy that filename for the executable. For fine-tuning performance or for more specialized tasks, more options are described below. | ||
== Basic command line | == Basic command line encoding/decoding [[Windows_command_line_tips|(for Windows: command-line hints here)]] == | ||
The basic ''encoding'' usage is <tt>wavpack filename.extension</tt> (which creates <tt>filename.wv</tt>) – this is what drag and drop accomplishes. Wildcards are supported, e.g. <tt>wavpack *.wav</tt>. For a ''single'' input file, one can specify output like e.g. <tt>wavpack infilename.wav -o outfilename.wv</tt> (on Windows, the <tt>-o</tt> can be omitted). Input file extension ".wav" can be dropped, and output ".wv" extension as well – but <tt>wavpack foo</tt> will only find foo.wav, not e.g. foo.w64. | The basic ''encoding'' usage is <tt>wavpack filename.extension</tt> (which creates <tt>filename.wv</tt>) – this is what drag and drop accomplishes. Wildcards are supported, e.g. <tt>wavpack *.wav</tt> (but not simply <tt>wavpack *</tt>). For a ''single'' input file, one can specify output like e.g. <tt>wavpack infilename.wav -o outfilename.wv</tt> (on Windows, the <tt>-o</tt> can be omitted). Input file extension ".wav" can be dropped, and output ".wv" extension as well – but <tt>wavpack foo</tt> will only find foo.wav, not e.g. foo.w64. | ||
The basic ''decoding'' usage – as will be accomplished by drag and drop – is <tt>wvunpack filename.wv</tt>. By default, wvunpack will restore the exact same file (metadata and file structure and all | The basic ''decoding'' usage – as will be accomplished by drag and drop – is <tt>wvunpack filename.wv</tt>. By default, wvunpack will restore the exact same file (metadata and file structure and all; it will know the original file name extension but not the rest of the file name – timestamp can be stored by using <tt>-t</tt>.) If only audio was encoded (conversion from a ''player'' would usually work this way), output defaults to filename.wav. | ||
Just like for the wavpack encoder, file extensions can be dropped; e.g., | Just like for the wavpack encoder, file extensions can be dropped; e.g., <tt>wvunpack foo bar</tt> will decode foo.wv to bar.<original file's extension>. This is arguably advisable, as setting a full filename is ''not going to override format'', only make a potentially misleading output extension: E.g. if the input was a CAF file, <tt>wvunpack foo bar.w64</tt> is still a CAF file. To force output format, see the [[#Decoding options]] paragraph. | ||
=== Several input files === | === Several input files === | ||
Wildcards are supported, like <tt>wavpack *.wav</tt>. To give several filenames as input to wavpack/wvunpack, there are slight differences between the Windows version and the *n*xes: | Wildcards are supported, like <tt>wavpack *.wav</tt>. To give several filenames as input to wavpack/wvunpack, there are slight differences between the Windows version and the *n*xes: | ||
Windows (requires WavPack 5.5.0): use the <tt>--drop</tt> option as in the above example given by the developer. It is intended for drag and drop (hence the name of the option) and will write the output to same directory as source. However it can also be used with command-line: <tt>wavpack --drop firstfile secondfile</tt> will compress firstfile.wav to firstfile.wv and secondfile.wav to secondfile.wv. Note that without the <tt>--drop</tt>, the command <tt>wavpack firstfile secondfile</tt> will compress firstfile.wav to secondfile.wv, as <tt>-o</tt> is optional on Windows – indeed that is why the <tt>--drop</tt> had to be introduced. An arbitrary number of files can be processed, e.g. <tt>wvunpack --drop firstfile secondfile thirdfile fourthfile fifthfile</tt> will decode firstfile.wv, ..., fifthfile.wv. | Windows (requires WavPack 5.5.0): use the <tt>--drop</tt> option as in the above example given by the developer. It is intended for drag and drop (hence the name of the option) and will write the output to same directory as source. However it can also be used with command-line: <tt>wavpack --drop firstfile secondfile</tt> will compress firstfile.wav to firstfile.wv and secondfile.wav to secondfile.wv. Note that without the <tt>--drop</tt>, the command <tt>wavpack firstfile secondfile</tt> will compress firstfile.wav to secondfile.wv, as <tt>-o</tt> is optional on Windows – indeed that is why the <tt>--drop</tt> had to be introduced. An arbitrary number of files can be processed, e.g. <tt>wvunpack --drop firstfile secondfile thirdfile fourthfile fifthfile</tt> will decode firstfile.wv, ..., fifthfile.wv. | ||
For *n*x, one can omit the <tt>--drop</tt> | For *n*x, one can omit the <tt>--drop</tt>. | ||
== Applying options == | == Applying options == | ||
For tuning performance or other settings, one might want to apply command-line options. Some external applications can apply options without the user having to type – e.g. encoding with [[foobar2000]], there are two compression sliders, one for the fast-to-extra-high and one for the <tt>-x</tt> settings (see below) – but in the Windows GUI one will want to type them in. Options can be concatenated for short, like for example writing <tt>-hh -x2 -m -v -y</tt> as <tt>-hhx2mvy</tt>. | For tuning performance or other settings, one might want to apply command-line options. Some external applications can apply options without the user having to type – e.g. encoding with [[foobar2000]], there are two compression sliders, one for the fast-to-extra-high and one for the <tt>-x</tt> settings (see below) – but in the Windows GUI one will want to type them in. Options can be concatenated for short, like for example writing <tt>-hh -x2 -m -v -y</tt> as <tt>-hhx2mvy</tt>. | ||
The user should beware that the wavpack encoder and the wvunpack decoder (and wvtag/wvgain) have to "re-use letters" | The user should beware that the wavpack encoder and the wvunpack decoder (and wvtag/wvgain) have to "re-use letters". While some do the same in the wvunpack and wavpack (like <tt>-d</tt> for delete input file, <tt>-y</tt> for "yes to all", <tt>-t</tt> to preserve timestamp, and <tt>-l</tt> for (Windows only) "run with low priority") and others cover the same purpose in both executables (like <tt>-m</tt> and <tt>-v</tt>), the user may be warned that certain letters do not. E.g. <tt>-b</tt>, <tt>-c</tt>, <tt>-n</tt> cover completely urelated functions upon decoding vs upon encoding. | ||
=== Encoding options (lossless) === | === Encoding options (lossless) === | ||
Encoding using <tt>-hxm</tt> seems a sensible trade-off between compression and CPU load. The manual (online, or included as wavpack_doc.html in the distribution) gives an exhaustive reference, and the following is merely a selection. | Encoding using <tt>-hxm</tt> seems a sensible trade-off between compression and CPU load. The manual (online, or included as wavpack_doc.html in the distribution) gives an exhaustive reference, and the following is merely a selection. | ||
* Compression. WavPack has four compression modes that affect compression as well as encoding ''and'' decoding time: fast (<tt>-f</tt>), default, high (<tt>-h</tt>) and very high (<tt>-hh</tt>). The CPU load of <tt>-hh</tt> is measured to around twice that of <tt>-f</tt> (and could in the early 2000s be too heavy for portable players, although it does decode faster than any Monkey's). On top these modes, the optional extra processing <tt>-x1</tt> to <tt>-x6</tt> settings will apply extra compression effort that does not increase ''decoding'' CPU load. <tt>-x</tt> without number is synonymous to <tt>-x1</tt>, which is often recommended (in all modes, fast/normal/high/extra high). The official manual calls <tt>-x4</tt> to <tt>-x6</tt> "extremely slow", but the size gains might be significant for high resolution audio in particular (van Beurden's revision 5, testing <tt>-x4</tt>). | * Compression. WavPack has four compression modes that affect compression as well as encoding ''and'' decoding time: fast (<tt>-f</tt>), default, high (<tt>-h</tt>) and very high (<tt>-hh</tt>). The CPU load of <tt>-hh</tt> is measured to around twice that of <tt>-f</tt> (and could in the early 2000s be too heavy for portable players, although it does decode faster than any Monkey's). On top these modes, the optional extra processing <tt>-x1</tt> to <tt>-x6</tt> settings will apply extra compression effort that does not increase ''decoding'' CPU load. <tt>-x</tt> without number is synonymous to <tt>-x1</tt>, which is often recommended (in all modes, fast/normal/high/extra high). The official manual calls <tt>-x4</tt> to <tt>-x6</tt> "extremely slow", but the size gains might be significant for high resolution audio in particular (van Beurden's revision 5, testing <tt>-x4</tt>). | ||
** 5.5.0 introduces optional switches for the default compression: <tt>-g</tt> for normal mode and <tt>-x0</tt> for "no <tt>-x</tt>". These are redundant for basic use, but can be used to switch off options already given (e.g. in renamed executables, or custom builds): <tt>-x6 -x0</tt> will switch off the extra processing, and <tt>-h -f -g</tt> will encode as normal, whereas previous versions would abort with an error. | |||
5.5.0 introduces optional switches for the default compression: <tt>-g</tt> for normal mode and <tt>-x0</tt> for "no <tt>-x</tt>". These are redundant for basic use, but can be used to switch off options already given (e.g. in renamed executables, or custom builds): <tt>-x6 -x0</tt> will switch off the extra processing, and <tt>-h -f -g</tt> will encode as normal, whereas previous versions would abort with an error. | ** With DSD files, there are only two compression settings, normal and high; the option <tt>-f</tt> will select normal, <tt>-h</tt>/<tt>-hh</tt> will both select high, and the <tt>-x</tt> switches are silently ignored. | ||
* Guarding against errors upon encoding: The "<tt>-m</tt>" switch will compute an audio MD5 sum (like FLAC does by default) and store it for later verification. The "<tt>-v</tt>" switch will verify by decoding the file after encoding and writing the file to disk<ref>[https://hydrogenaud.io/index.php?topic=121714.msg1008108#msg1008108 HA forum comment:] verification checks the written file after closing and reopening</ref>. <tt>-vm</tt> will do both – that is, calculate the MD5s to verify, and store it. (Using the corresponding switches in wvunpack will check without producing output file, however wvunpack also has a faster corruption check switch <tt>-vv</tt> for WavPack 5-encoded files.) | * Guarding against errors upon encoding: The "<tt>-m</tt>" switch will compute an audio MD5 sum (like FLAC does by default) and store it for later verification. The "<tt>-v</tt>" switch will verify by decoding the file after encoding and writing the file to disk<ref>[https://hydrogenaud.io/index.php?topic=121714.msg1008108#msg1008108 HA forum comment:] verification checks the written file after closing and reopening</ref>. <tt>-vm</tt> will do both – that is, calculate the MD5s to verify, and store it. (Using the corresponding switches in wvunpack will check without producing output file, however wvunpack also has a faster corruption check switch <tt>-vv</tt> for WavPack 5-encoded files.) | ||
* <tt>--import-id3</tt> will import ID3v2.3 tags (currently not v2.4 nor v2.2) present in the source file – typically in Sony DSF files – and convert them to WavPack's preferred APE tags. (It will still keep the chunk for restoring the original file.) By default, importing is limited to 1 MB; for more, use <tt>--allow-huge-tags</tt>. Same option works in wvtag. | * <tt>--import-id3</tt> will import ID3v2.3 tags (currently not v2.4 nor v2.2) present in the source file – typically in Sony DSF files – and convert them to WavPack's preferred APE tags. (It will still keep the chunk for restoring the original file.) By default, importing is limited to 1 MB; for more, use <tt>--allow-huge-tags</tt>. Same option works in wvtag. | ||
* <tt>-r</tt>: remove | * <tt>-r</tt>: remove non-audio chunks. By default, WavPack will store these in the .wv file for later bit-by-bit restoration of everything, not only the audio. Use <tt>-r</tt> to throw them away and encode audio only – like encoding through most players appear to do. | ||
* <tt>-t</tt>: copy input file's time stamp. (To restore the file with the original time stamp, use <tt>-t</tt> both when encoding and when decoding.) | * <tt>-t</tt>: copy input file's time stamp. (To restore the file with the original time stamp, use <tt>-t</tt> both when encoding and when decoding.) | ||
* <tt>--pause</tt>: (Windows only!) waits for keypress at the end. Useful for reading output before exit when calling wavpack/wvunpack in a separate window (which both drag-and-drop the Windows front-end do). | * <tt>--pause</tt>: (Windows only!) waits for keypress at the end. Useful for reading output before exit when calling wavpack/wvunpack in a separate window (which both drag-and-drop the Windows front-end do). | ||
Line 119: | Line 120: | ||
WavPack will refuse to recompress lossy-generated .wv to "lossless .wv" as that would make a false pretense of being a lossless file. It will also refuse so even in the presence of .wvc; you will have to wvunpack it and and then wavpack it again. | WavPack will refuse to recompress lossy-generated .wv to "lossless .wv" as that would make a false pretense of being a lossless file. It will also refuse so even in the presence of .wvc; you will have to wvunpack it and and then wavpack it again. | ||
=== Decoding options === | |||
In addition to the basic usage above (drag and drop or <tt>wvunpack filename.wv</tt>), the wvunpack executable offers several options. For use with the Windows front-end or drag and drop, the Windows-only <tt>--pause</tt> (waits for keypress at the end, like for wavpack.exe) is essential to read the output report. Also Windows-only options like <tt>--drop</tt> and <tt>-l</tt> work as for wavpack.exe, and so do <tt>-d</tt> (use with caution!) and <tt>-y</tt> (ditto!) as well as <tt>-t</tt>. | |||
* Output ''filename'' can be set with <tt>wvunpack infilename.wv -o outfilename </tt> (the <tt>-o</tt> being superfluous on Windows, where – in the absence of <tt>--drop</tt> – the second filename will be taken ). Then wvunpack will affix the file extension of the original file (say, outfilename.wav if the wavpacked file was somefilename.wav). Specifying a full file name with extension will override the ''name'' but not the ''type'': to do that, output must be forced explicitly. | |||
* To force output ''file format,'' one needs to apply options to wvunpack. The following are for PCM output: <tt>--raw-pcm</tt>, <tt>--wav</tt>, <tt>--w64</tt>, <tt>--caf-be</tt>, <tt>--caf-le</tt>, and from version 5.6.0 on also <tt>--aif</tt> and <tt>--aif-le</tt>. | |||
** These will delete non-audio chunks and replace them with a fresh file header: there is no option to "unpack to WAVE and restore the original headers if the original file was WAVE". <tt>wvunpack --wav</tt> will select RF64 if (and only if) exceeding WAVE's 4 GB limit, and wvunpack will select old AIFF over AIFF-C if the audio data permit it. | |||
** For DSD, those format switches will also force a – necessarily lossy – conversion to PCM. To switch losslessly ''between'' DSD formats, there are also <tt>--dsf</tt> and <tt>--dff</tt> (the latter being synonymous to <tt>--dsdiff</tt>) which again delete non-audio chunks. Note that WavPack cannot force any (also necessarily lossy) conversion ''to'' DSD, having no DSD encoder. | |||
** <tt>--raw</tt> outputs both PCM and DSD as headerless streams (lossless for both; <tt>-r</tt> is synonymous; beware that this is not precisely the same as the same letter switch upon encoding). | |||
In addition to decimating DSD for conversion to PCM, there are other options where power users can utilize certain ''lossy'' operations by wvunpack, e.g. normalizing floating-point files (recommended before conversion to integer), dropping correction files from hybrid encodes – and <tt>--skip</tt> and/or <tt>--until</tt> to decode only a segment of the file. See the documentation. <br/> | |||
Other options include <tt>-b</tt> to "blindly" decode until end disregarding errors and corruption (potentially useful to save as much as possible from a destroyed file). | |||
wvunpack is also the utility to display information from .wv files even when it does not involve decoding, see the next section. | wvunpack is also the utility to display information from .wv files even when it does not involve decoding, see the next section. Inter alia, <tt> -s</tt> can be used to find the input file type in case the output extension is misleading (like a .wav extension disguising an AIFF file). | ||
== Other file handling | === Other file handling: verification / error checking, and other file info (incomplete) === | ||
wvunpack can get information about WavPack files without decoding to file: | wvunpack can get information about WavPack files without decoding to file: | ||
* <tt>-vv</tt>: Quick verify without decoding (WavPack 5 files only). | * <tt>-vv</tt>: Quick verify without decoding (WavPack 5 files only; from 5.5.0 there is also a more verbose <tt>-vvv</tt>). Quick verify seems to be unavailable outside the official wvunpack; other applications which verify will fall back to the next item, <tt>-v</tt>. | ||
* <tt>-v</tt>: Verify (will decode to check that everything is OK – but not write any file). | * <tt>-v</tt>: Verify (will do a decode to check that everything is OK – but not write any file). | ||
* <tt>-s</tt>/<tt>-ss</tt>: <tt>-s</tt> displays summary of the file, <tt>-ss</tt> a long summary including tags | * <tt>-s</tt>/<tt>-ss</tt>: <tt>-s</tt> displays summary of the file, <tt>-ss</tt> a long summary including tags. Also there is <tt>-f</tt> for parseable output, see documentation. | ||
* <tt>-x</tt> FIELD: Shows tag, e.g. <tt> -x comment </tt> shows the <comment> field. | * <tt>-n</tt> is the generic "do not decode" for use e.g. to extract tags (which can also be accomplished with the <tt>wvtag</tt> utility, but wvunpack will do if one does not want to write tags): | ||
* <tt>-x</tt> FIELD: Shows tag, e.g. <tt> -x comment </tt> shows the <comment> field. <tt>-c</tt> is synonymous to <tt> -x cuesheet</tt>. Also <tt> wvtag -x </tt> resp. <tt> wvtag -c </tt> do the same thing. <tt>-xx</tt> (same option for wvtag) can output to file, see documentation. | |||
=== (To fill in:) Tagging (wvtag) and replaygain management (wvgain) === | === (To fill in:) Tagging (wvtag) and replaygain management (wvgain) === | ||
Line 149: | Line 148: | ||
= Using WavPack with 3rd party tools (FFmpeg & more) = | = Using WavPack with 3rd party tools (FFmpeg & more) = | ||
Some applications may behave slightly surprising. FFmpeg has its own WavPack implementation and has a few known | Some applications may behave slightly surprising. FFmpeg has its own WavPack implementation and has a few known peculiarities, some which are expected to be fixed and others of unknown status. As referenced above Android users may need to use the player application's folder to get WavPack files recognized. The tl;dr are that as long as it plays, it plays – but to failsafe against loss of information (e.g. upon conversion), use the official tools. | ||
== Splitting WavPack files by cuesheet == | == Splitting WavPack files by cuesheet == | ||
Line 162: | Line 161: | ||
Some limitations: | Some limitations: | ||
* FFmpeg can decode WavPack 5 files, but will only write WavPack 4 files (hence no ''fast verification''). | * FFmpeg can decode WavPack 5 files, but will only write WavPack 4 files (hence no ''fast verification''). | ||
* Above 16 channels, when the WavPack 5 format is required, FFmpeg will still attempt encoding to WavPack but will produce unreadable files. (Unfixed as of October 2022.) | |||
* A rare bug in FFmpeg's WavPack decoder was discovered in August 2022<ref>[https://hydrogenaud.io/index.php/topic,122810 HA forum thread on the ffmpeg bug in .wv decoding]</ref> which will cause dropouts in certain files. (The bug is ''"rare"'' in that no such file was discovered in several years.) A fix has been coded, and is expected to find its way into official ffmpeg in a few months. However, players and converters that employ ffmpeg as a decoding engine may or may not update that quickly. | * A rare bug in FFmpeg's WavPack decoder was discovered in August 2022<ref>[https://hydrogenaud.io/index.php/topic,122810 HA forum thread on the ffmpeg bug in .wv decoding]</ref> which will cause dropouts in certain files. (The bug is ''"rare"'' in that no such file was discovered in several years.) A fix has been coded, and is expected to find its way into official ffmpeg in a few months. However, players and converters that employ ffmpeg as a decoding engine may or may not update that quickly. | ||
* There is potential information loss in using FFmpeg; it will ignore hybrid correction files, so decoding/playing hybrid-encoded WavPack with ffmpeg or ffmpeg-based players will be lossy. Furthermore, ffmpeg will as a general rule ''not'' honour the input bit depth: it will default to 16 bits when outputting WAVE/AIFF, whether or not the input file is 16 bits; this could even induce clipping (with no warning!) if the source is a 32-bit float. To force lossless decoding of 24-bit/32-bit files (WavPack/FLAC/ALAC/TAK/uncompressed) to WAVE/AIFF, the user must extract the bit depth information and specify the respective 24-bit/32-bit output format using ffmpeg's command-line syntax. The tl;dr for users who do not have this at their fingertips, is to use other (= official!) decoders when losslessness is desired. | |||
* There is potential information loss in using FFmpeg; it will ignore hybrid correction files, so decoding/playing hybrid-encoded WavPack with ffmpeg or ffmpeg-based players will be lossy. Furthermore, ffmpeg will not honour the input | |||
* FFmpeg will sometimes – depending on input format – output 32-bit WavPack files and lose the information that the source was indeed only 24. Not all players support 32-bit files, and verifying that the operation (or an attempted downconversion to 24) was lossless is not straightforward as even fewer applications are willing to compare a 32-bit and a 24-bit file for differences. Also information that bit depth is not an integer number of bytes, is lost; WAVE/AIFF/CAF can handle "17 bit" files by storing 24 and employing a flag to disregard the 7 LSBs, and ffmpeg will lose this flag even when encoding to / decoding from codecs which support it, WavPack and FLAC. | * FFmpeg will sometimes – depending on input format – output 32-bit WavPack files and lose the information that the source was indeed only 24. Not all players support 32-bit files, and verifying that the operation (or an attempted downconversion to 24) was lossless is not straightforward as even fewer applications are willing to compare a 32-bit and a 24-bit file for differences. Also information that bit depth is not an integer number of bytes, is lost; WAVE/AIFF/CAF can handle "17 bit" files by storing 24 and employing a flag to disregard the 7 LSBs, and ffmpeg will lose this flag even when encoding to / decoding from codecs which support it, WavPack and FLAC. | ||
* Also ffmpeg will discard RIFF chunks and file structure. It has no ambition of preserving file structure – however it ''will'' by default transfer metadata it supports. | * Also ffmpeg will discard RIFF chunks and file structure. It has no ambition of preserving file structure – however it ''will'' by default transfer metadata it supports. | ||
Line 199: | Line 198: | ||
* [http://www.logipole.com/index.html Konvertor] | * [http://www.logipole.com/index.html Konvertor] | ||
* [http://cuetools.net CUETools] converter and AccurateRip/CTDB checker | * [http://cuetools.net CUETools] converter and AccurateRip/CTDB checker | ||
* [https://github.com/nu774/qaac refalac] (user must copy the wavpackdll.dll file) | * [https://github.com/nu774/qaac refalac] (user must copy the wavpackdll.dll file to the appropriate directory) | ||
== Taggers and audio info utilities == | == Taggers and audio info utilities == | ||
Line 212: | Line 211: | ||
* [[Audacity]] has WavPack support (using official libraries) from version 3.2.0 (2022)<ref>[https://github.com/audacity/audacity/releases/tag/Audacity-3.2.0 Audacity 3.2.0 release notes]</ref>. | * [[Audacity]] has WavPack support (using official libraries) from version 3.2.0 (2022)<ref>[https://github.com/audacity/audacity/releases/tag/Audacity-3.2.0 Audacity 3.2.0 release notes]</ref>. | ||
* [[Adobe Audition]] and Cool Edit (filter with 32-bit floats & extra info save support) | * [[Adobe Audition]] and Cool Edit (filter with 32-bit floats & extra info save support) | ||
* [http://www.bunkus.org/videotools/mkvtoolnix/ mkvtoolnix] | * [http://www.bunkus.org/videotools/mkvtoolnix/ mkvtoolnix] – tool to multiplex streams in Matroska container files. | ||
''It's worth mentioning the [[Matroska]] guys decided to concentrate on WavPack as the lossless compressor of choice for their container. Quite an honor... :-)'' | ''It's worth mentioning the [[Matroska]] guys decided to concentrate on WavPack as the lossless compressor of choice for their container. Quite an honor... :-)'' | ||
* [https://support.pkware.com/display/PKSZLU/PKZIP+Toolkit+for+Windows PKWare]'s .zip format compresses audio by WavPack since version 6.3.2 (2007). Beware that there is no expectation that other decompression software handles these zip files; even if PKWare co-designed the format and PKZip was the original .zip implementation, their subsequent compression methods are outside the ISO/IEC standardized zip format specification. | * [https://support.pkware.com/display/PKSZLU/PKZIP+Toolkit+for+Windows PKWare]'s .zip format compresses audio by WavPack since version 6.3.2 (2007). Beware that there is no expectation that other decompression software handles these zip files; even if PKWare co-designed the format and PKZip was the original .zip implementation, their subsequent compression methods are outside the ISO/IEC standardized zip format specification. | ||
Line 220: | Line 219: | ||
* [http://www.wavpack.com/ Official website] | * [http://www.wavpack.com/ Official website] | ||
* [https://github.com/dbry/WavPack Github repository] | * [https://github.com/dbry/WavPack Github repository] | ||
* [http://www.rarewares.org/lossless.html Unofficial 5.50 | * [http://www.rarewares.org/lossless.html Unofficial compiles] at RareWares, at the moment 5.50 for Windows and 4.32 multiplatform | ||
* [https://en.wikipedia.org/wiki/WavPack WavPack at Wikipedia] | * [https://en.wikipedia.org/wiki/WavPack WavPack at Wikipedia] | ||
* [https://wiki.multimedia.cx/index.php/WavPack WavPack at Multimediawiki] (not updated with version 5) | * [https://wiki.multimedia.cx/index.php/WavPack WavPack at Multimediawiki] (not updated with version 5) |
Revision as of 00:35, 3 December 2022
Developer(s) | David Bryant |
Release information | |
Stable release | 5.6.0 (2022-11-23) |
Preview release | None |
Compatibility | |
Operating system | Windows, MacOSX, Linux/BSD/Unix, ... |
Additional information | |
Use | Encoder/Decoder |
License | BSD license |
Website | http://www.wavpack.com/ |
WavPack (pronounced "wave-pack") is a lossless audio codec, also offering optionally a hybrid lossless/lossy mode. It is distributed as a free open-source encoder/decoder with a library and a large number of tools, including a Windows GUI and a range of plugins for both audio players and other software. Third party implementations are available, including ffmpeg. WavPack supports and/or can be played back on a large number of platforms/OSes including mobile (Android, iOS), portable (Rockbox) and even web apps.
WavPack is arguably the most feature-rich lossless compressor, supporting a unique range of audio signals including Direct-Stream Digital. Everyday use is supported by a wide range of players and taggers, but conversion is likely safest done with applications that invoke the official tools (rather than e.g. ffmpeg's implementation) – and special features might require the user to apply the WavPack executable directly, for example with drag+drop, see the #Using WavPack section below.
Performance-wise, WavPack defaults to a fast codec – less CPU intensive than ALAC, but typically not as fast as FLAC or TAK, especially in decoding CPU usage.[1] In the age of low-power portable Rockbox-equipped players, WavPack could be seen as a reasonable middle ground between FLAC's low CPU footprint and long battery life, and the smaller files but more CPU-intensive Monkey's Audio[2] – invoking WavPacks high mode and extra compression that would compress to smaller sizes than FLAC.
WavPack has inspired other codecs[3] and their features[4]. For more on WavPack, including on its history and technology, see the Wikipedia entry.
Features
For an end-user considering WavPack as an audio format, its feature-richness might be the big selling point. WavPack supports pretty much all the more common features noted at HA Wiki's Lossless Codec Comparison as in the following first list, but several users might consider the more unique features listed under the subsequent headline.
- Seekable and streaming playback.
- Error handling: upon playback, it will detect and report corrupted frames, mute to protect against static/noise output, and continue playback. Since version 5, WavPack can also check for corruption without decoding, hence quicker than any decoding format. Optional MD5 audio checksum can also be added upon encoding for file fingerprinting.
- High-resolution audio support (see next headline).
- Multichannel support: currently capped at 256 channels, supports WAVEFORMATEXTENSIBLE channel masks.
- Piping support for encoding, and support for RAW PCM input/output.
- Non-audio chunks (RIFF and similar) stored; by default, WavPack will not only decode the audio losslessly, but restore the non-audio chunks to file bit-identical to the original.
- Tagging: APEv2. (ID3v1 is possible, but not advisable.)
- Cuesheet support. In practice, some applications handle embedded cuesheets better in WavPack than in some other formats.
- Unicode support.
- Can be used in the Matroska container.
- Windows GUI available.
WavPack also handles bit depths not divisible by 8, and is known to employ a "wasted bits" strategy: Say, if a WAVE file contains a 20 bit signal mono signal (which in WAVE takes up three bytes per sample anyway), but the two least significant bits are always zero, WavPack will compress it to the same size as if it were specified as the actual information content of eighteen bits – and will display it as 20 as per the WAVE's header flags (and restore it that way).
Special/unique features
Most of these features are shared with only a few if any notable codecs, or extend to signal types or file types others do not support (comparisons given).
- DSD support: can losslessly compress Philips DSDIFF and Sony DSF files (see "Using WavPack" below; no other end-user codec compresses DSD.) ID3v2.3 tags can be imported.
- High-resolution support for bit depth 1-bit to 32-bit integer and sampling rates up to 2 GiHz in integer steps. (Officially, 1 GHz is supported – it is gigaherz, not MHz, the upper limit being in the UHF radio frequency band. Monkey's Audio, OptimFROG and MPEG-4 ALS support the entire WAVE range up to 4 GiHz.) Can also compress AIFF files of non-integer sampling rates and recreate them bit-perfectly, but will round off sampling rate upon playback.
- 32-bit floating-point supported – also including CoolEdit/Adobe Audition's own float format (use the -a option only if the .wav was generated by CoolEdit/Audition). (This line like OptimFROG.)
- As much as 256 channels currently supported (from version 5.5.0 on; can be extended to the thousands – for even more, MPEG-4 ALS supports 66536.)
- Hybrid lossy/lossless mode (can also be used as lossy – OptimFROG also has such a mode.)
- For LPCM it can read and output to WAVE including extensions like RF64, to Sony's Wave64, AIFF/AIFC (both endiannesses) and CAF (ditto) – with full restore of also non-audio parts to bit-by-bit the original file in the original format. (Monkey's/OptimFROG/TAK do the same to the input formats they support.) Also WavPack can handle too large noncompliant "WAVE" files (can still be restored to bit-identical the same as the flawed input file – or to formats that provide for larger files).
- Recompression: Can recompress .wv files in place, with tag transfer. (Like FLAC on .flac files.)
- Drag and drop support: Dropping a file on to wavpack.exe/wvunpack.exe will encode/decode it to source directory. (Like FLAC.) From 5.5.0, one can also apply options to drag and drop by renaming the executable, and drop several files.
Limitations
The following bullet item list is hardly of interest except for special purposes; WavPack supports nearly every input format that any competing codec handles. One exception is the legacy AU/SND, apparently supported only by Monkey's Audio.
- DSD: Will reject DST-compressed DSDIFF (which are already compressed heavier than WavPack does) and Wideband Single-bit Data files (apparently, the Tascam and Korg devices which can produce these, can also export to other DSD formats).
Also, DSD files cannot be encoded as hybrid with correction files. - Certain rare files – largely unsupported by other codecs – may be played back with technical compromise solutions that are unlikely to concern the average end-user. Should one encounter one of those rare AIFF files which have a non-integer sampling rate (something WAVE does not support), WavPack will compress them and wvunpack will restore them bit-identically with no loss of information – but playback will be at integer rate. E.g., a file sampled at 44100.441 Hz will be played back at 0.001 percent wrong speed – unlikely to be noticed by ear, and more likely to be accepted by an audio player.
- 64-bit float is not supported. (Apparently no other lossless audio compressor can support it either.)
- wvunpack can force output to a different format than input, but like every decoder offering such an option, it does not let the user select any version of the output format. None of the competing codecs can force selection of WAVE format (closest is FLAC, which can enforce RF64 and in an upcoming version will be able to force the original WAVE_FORMAT_PCM over WAVE_FORMAT_EXTENSIBLE); wvunpack's --wav will enforce its choice WAVE version (= RF64 iff the file is too big for WAVE, but RF64 cannot be forced otherwise). Only FLAC and WavPack can enforce AIFF output, and only wvunpack can select little-endian (AIFC type "sowt"), but wvunpack will avoid AIFC as long as the signal can be fit in the original AIFF container. And although wvunpack can force DSDIFF encodes to DSF and vice versa, it has no DSD encoder and can not convert PCM to DSD.
- --import-id3 can currently only import ID3v2.3. (Not ID3v2.4.) Also it has a limit of 1 MB unless --allow-huge-tags is specified (use Mp3tag to copy tags). Tags > 1 MB are warned against for compatibility reasons, but it is not known what applications may reject such files.
- Some third-party implementations have limitations and bugs waiting to be fixed.
WavPack version 5 discontinues some features, like compression to Windows .sfx self-extracting file (cf. OptimFROG) and the -p feature. Furthermore, WavPack version 3.x files are no longer supported. To recompress these files (if any are still around, WavPack 4 was released in 2004) to WavPack 5 files (for the fast decoding-free error checking feature), one must first recompress by WavPack 4.80 (still available) or lower, and then by WavPack 5.
As of 5.5.0 and above, MacOS versions must be built with e.g. HomeBrew. For Windows XP, a special executable is required, available at wavpack.com (brought back as of 5.6.0, upgrade is advised).
WavPack has traditionally had less hardware support than FLAC (Rockbox having been the most notable platform, others listed at https://www.wavpack.com/index.html#Hardware ), but with WavPack playback through Android and iOS players, the distinction between "hardware" and "software" is arguably blurred. There have been issues getting certain Android solutions to recognize media files including WavPack.[5] Third-party support for hybrid-encoded lossless playback (the correction files, see below) is known to be limited.
Using WavPack
WavPack files can be played back in supported players (see below), and several of these can encode to WavPack, invoking the official tools. However, there are situations where certain WavPack features are accessible only through the WavPack executables directly. For example, you cannot expect non-audio data (for full file restore) to be preserved when encoding/decoding through players, as they usually pass on only the audio. Also, the input format might exceed the player's internal decoding; e.g. trying to convert 32-bit integer or DSD with foobar2000 will yield a warning that it will not be lossless (also, converting DSD to PCM leads to files many times the size, being inherently different formats).
Unlike most other codecs, WavPack has separate encoding and decoding executables (wavpack and wvunpack).
Encoding/decoding by drag and drop (Windows)
The simplest encoding/decoding might be dragging and dropping a (supported) file to wavpack.exe (/wvunpack.exe). Then the file will be encoded/decoded with the default options. Dropping a .wv file onto wavpack.exe will recompress it, prompting before overwrite (again, using default settings – possibly a bad deal if it was encoded with high -x switches). Drag and drop also works on a shortcut to the executable. It is not possible to drop a folder, but from version 5.5.0, there is a way to drag and drop several files.
From version 5.5.0, drag and drop supports options by renaming the executable. The user can rename a copy of the executable according to preferred settings, which will be applied to the process upon drag and drop. The example given by the developer in in this HA forum post[6] uses encoding options that many WavPack users will recommend (better compression than default, verification and MD5 fingerprinting), and novice users can choose to copy that filename for the executable. For fine-tuning performance or for more specialized tasks, more options are described below.
Basic command line encoding/decoding (for Windows: command-line hints here)
The basic encoding usage is wavpack filename.extension (which creates filename.wv) – this is what drag and drop accomplishes. Wildcards are supported, e.g. wavpack *.wav (but not simply wavpack *). For a single input file, one can specify output like e.g. wavpack infilename.wav -o outfilename.wv (on Windows, the -o can be omitted). Input file extension ".wav" can be dropped, and output ".wv" extension as well – but wavpack foo will only find foo.wav, not e.g. foo.w64.
The basic decoding usage – as will be accomplished by drag and drop – is wvunpack filename.wv. By default, wvunpack will restore the exact same file (metadata and file structure and all; it will know the original file name extension but not the rest of the file name – timestamp can be stored by using -t.) If only audio was encoded (conversion from a player would usually work this way), output defaults to filename.wav. Just like for the wavpack encoder, file extensions can be dropped; e.g., wvunpack foo bar will decode foo.wv to bar.<original file's extension>. This is arguably advisable, as setting a full filename is not going to override format, only make a potentially misleading output extension: E.g. if the input was a CAF file, wvunpack foo bar.w64 is still a CAF file. To force output format, see the #Decoding options paragraph.
Several input files
Wildcards are supported, like wavpack *.wav. To give several filenames as input to wavpack/wvunpack, there are slight differences between the Windows version and the *n*xes: Windows (requires WavPack 5.5.0): use the --drop option as in the above example given by the developer. It is intended for drag and drop (hence the name of the option) and will write the output to same directory as source. However it can also be used with command-line: wavpack --drop firstfile secondfile will compress firstfile.wav to firstfile.wv and secondfile.wav to secondfile.wv. Note that without the --drop, the command wavpack firstfile secondfile will compress firstfile.wav to secondfile.wv, as -o is optional on Windows – indeed that is why the --drop had to be introduced. An arbitrary number of files can be processed, e.g. wvunpack --drop firstfile secondfile thirdfile fourthfile fifthfile will decode firstfile.wv, ..., fifthfile.wv. For *n*x, one can omit the --drop.
Applying options
For tuning performance or other settings, one might want to apply command-line options. Some external applications can apply options without the user having to type – e.g. encoding with foobar2000, there are two compression sliders, one for the fast-to-extra-high and one for the -x settings (see below) – but in the Windows GUI one will want to type them in. Options can be concatenated for short, like for example writing -hh -x2 -m -v -y as -hhx2mvy.
The user should beware that the wavpack encoder and the wvunpack decoder (and wvtag/wvgain) have to "re-use letters". While some do the same in the wvunpack and wavpack (like -d for delete input file, -y for "yes to all", -t to preserve timestamp, and -l for (Windows only) "run with low priority") and others cover the same purpose in both executables (like -m and -v), the user may be warned that certain letters do not. E.g. -b, -c, -n cover completely urelated functions upon decoding vs upon encoding.
Encoding options (lossless)
Encoding using -hxm seems a sensible trade-off between compression and CPU load. The manual (online, or included as wavpack_doc.html in the distribution) gives an exhaustive reference, and the following is merely a selection.
- Compression. WavPack has four compression modes that affect compression as well as encoding and decoding time: fast (-f), default, high (-h) and very high (-hh). The CPU load of -hh is measured to around twice that of -f (and could in the early 2000s be too heavy for portable players, although it does decode faster than any Monkey's). On top these modes, the optional extra processing -x1 to -x6 settings will apply extra compression effort that does not increase decoding CPU load. -x without number is synonymous to -x1, which is often recommended (in all modes, fast/normal/high/extra high). The official manual calls -x4 to -x6 "extremely slow", but the size gains might be significant for high resolution audio in particular (van Beurden's revision 5, testing -x4).
- 5.5.0 introduces optional switches for the default compression: -g for normal mode and -x0 for "no -x". These are redundant for basic use, but can be used to switch off options already given (e.g. in renamed executables, or custom builds): -x6 -x0 will switch off the extra processing, and -h -f -g will encode as normal, whereas previous versions would abort with an error.
- With DSD files, there are only two compression settings, normal and high; the option -f will select normal, -h/-hh will both select high, and the -x switches are silently ignored.
- Guarding against errors upon encoding: The "-m" switch will compute an audio MD5 sum (like FLAC does by default) and store it for later verification. The "-v" switch will verify by decoding the file after encoding and writing the file to disk[7]. -vm will do both – that is, calculate the MD5s to verify, and store it. (Using the corresponding switches in wvunpack will check without producing output file, however wvunpack also has a faster corruption check switch -vv for WavPack 5-encoded files.)
- --import-id3 will import ID3v2.3 tags (currently not v2.4 nor v2.2) present in the source file – typically in Sony DSF files – and convert them to WavPack's preferred APE tags. (It will still keep the chunk for restoring the original file.) By default, importing is limited to 1 MB; for more, use --allow-huge-tags. Same option works in wvtag.
- -r: remove non-audio chunks. By default, WavPack will store these in the .wv file for later bit-by-bit restoration of everything, not only the audio. Use -r to throw them away and encode audio only – like encoding through most players appear to do.
- -t: copy input file's time stamp. (To restore the file with the original time stamp, use -t both when encoding and when decoding.)
- --pause: (Windows only!) waits for keypress at the end. Useful for reading output before exit when calling wavpack/wvunpack in a separate window (which both drag-and-drop the Windows front-end do).
- -y: "yes" to everything. Use with caution, will overwrite. From 5.5.0 there is also a --no-overwrite that will skip instead of asking to overwrite.
- -d: delete source file upon successful completion. Again, use with caution.
- -l will force WavPack to run at low priority (Windows only)
- -c with -b to select lossy quality: hybrid lossless/lossy use, see below.
WavPack can recompress .wv files in place (using a temporary file until done). For example, wavpack -hx4mvy wavpackfile.wv will recompress wavpackfile.wv the file in high mode using -x4 extra processing, write audio MD5 to it, open the temp file and re-read for verification – and once verified, replace the old wavpackfile.wv. Tags will be transferred. wavpack -hx4rlmvy wavpackfile.wv will also run with low priority (assuming the Windows platform), and will discard non-audio chunks – that is, the ones used to restore the original file's metadata; the .wv file's APE tags will still be copied. As an example, one can compress an ID3v2.4-tagged DSF file by drag and drop; WavPack will then store the tag chunk, but WavPack cannot import v2.4 to its own (APEv2) tags. Therefore, open both in Mp3tag, and copy the ID3v2.4 tags to the WavPack file. If then you decide that there is no need to restore the original file's ID3v2.4 upon any unpacking, you can apply the wavpack -hx4rlmvy wavpackfile.wv command; it will then discard that chunk (but keep the tags that Mp3tag wrote!), recompress using high (silently ignoring the -x4 that has no effect on DSD) with low priority, write an MD5 sum, verify the process and replace the .wv file by the new recompressed file.
(Incomplete:) hybrid lossless & lossy encoding
(Needs to be expanded. Notes: DSD can currently not be hybrid-encoded and floating-point files should not be. The correction file will be omitted by a lot of applications/players, including ffmpeg; thus, using ffmpeg or ffmpeg-based players to convert/play hybrid-encoded WavPack will be lossy.)
Basic use: the -b switch – and for losslessness, with -c to create a correction file. The b takes a numerical value signifying bits per sample if < 24 and kbit/second if 24 to 9600. E.g. -b12.5 (no space in between, with . even if your locale uses comma for decimal point). wavpack -b234.56 -c filename will create filename.wv file and correction file filename.wvc. As long as both are present, playback and decoding (by wvunpack filename the ordinary way) will be lossless. The file filename.wv – which is at most 234.56 kbit/s – can be copied to a different location and played back stand-alone as a lossy compressed file. The same will happen if the .wvc file is deleted or not found (it has to be same path/filename except with the ".wvc" suffix in place of ".wv") – or equivalently, if the -c is omitted during encoding, then no correction file will be created in the first place. For example: wavpack -b13.5 -hx filename will create a lossy filename.wv compressed with the -hx option, size constrained to 13.5 bits per sample. (Should 13.5 bits be sufficient for lossless encoding, WavPack will tell you at the end of the encoding process – but that information is not stored in the file.)
WavPack will refuse to recompress lossy-generated .wv to "lossless .wv" as that would make a false pretense of being a lossless file. It will also refuse so even in the presence of .wvc; you will have to wvunpack it and and then wavpack it again.
Decoding options
In addition to the basic usage above (drag and drop or wvunpack filename.wv), the wvunpack executable offers several options. For use with the Windows front-end or drag and drop, the Windows-only --pause (waits for keypress at the end, like for wavpack.exe) is essential to read the output report. Also Windows-only options like --drop and -l work as for wavpack.exe, and so do -d (use with caution!) and -y (ditto!) as well as -t.
- Output filename can be set with wvunpack infilename.wv -o outfilename (the -o being superfluous on Windows, where – in the absence of --drop – the second filename will be taken ). Then wvunpack will affix the file extension of the original file (say, outfilename.wav if the wavpacked file was somefilename.wav). Specifying a full file name with extension will override the name but not the type: to do that, output must be forced explicitly.
- To force output file format, one needs to apply options to wvunpack. The following are for PCM output: --raw-pcm, --wav, --w64, --caf-be, --caf-le, and from version 5.6.0 on also --aif and --aif-le.
- These will delete non-audio chunks and replace them with a fresh file header: there is no option to "unpack to WAVE and restore the original headers if the original file was WAVE". wvunpack --wav will select RF64 if (and only if) exceeding WAVE's 4 GB limit, and wvunpack will select old AIFF over AIFF-C if the audio data permit it.
- For DSD, those format switches will also force a – necessarily lossy – conversion to PCM. To switch losslessly between DSD formats, there are also --dsf and --dff (the latter being synonymous to --dsdiff) which again delete non-audio chunks. Note that WavPack cannot force any (also necessarily lossy) conversion to DSD, having no DSD encoder.
- --raw outputs both PCM and DSD as headerless streams (lossless for both; -r is synonymous; beware that this is not precisely the same as the same letter switch upon encoding).
In addition to decimating DSD for conversion to PCM, there are other options where power users can utilize certain lossy operations by wvunpack, e.g. normalizing floating-point files (recommended before conversion to integer), dropping correction files from hybrid encodes – and --skip and/or --until to decode only a segment of the file. See the documentation.
Other options include -b to "blindly" decode until end disregarding errors and corruption (potentially useful to save as much as possible from a destroyed file).
wvunpack is also the utility to display information from .wv files even when it does not involve decoding, see the next section. Inter alia, -s can be used to find the input file type in case the output extension is misleading (like a .wav extension disguising an AIFF file).
Other file handling: verification / error checking, and other file info (incomplete)
wvunpack can get information about WavPack files without decoding to file:
- -vv: Quick verify without decoding (WavPack 5 files only; from 5.5.0 there is also a more verbose -vvv). Quick verify seems to be unavailable outside the official wvunpack; other applications which verify will fall back to the next item, -v.
- -v: Verify (will do a decode to check that everything is OK – but not write any file).
- -s/-ss: -s displays summary of the file, -ss a long summary including tags. Also there is -f for parseable output, see documentation.
- -n is the generic "do not decode" for use e.g. to extract tags (which can also be accomplished with the wvtag utility, but wvunpack will do if one does not want to write tags):
- -x FIELD: Shows tag, e.g. -x comment shows the <comment> field. -c is synonymous to -x cuesheet. Also wvtag -x resp. wvtag -c do the same thing. -xx (same option for wvtag) can output to file, see documentation.
(To fill in:) Tagging (wvtag) and replaygain management (wvgain)
(... most of these options are available in HA's fave taggers/player?)
Using WavPack with 3rd party tools (FFmpeg & more)
Some applications may behave slightly surprising. FFmpeg has its own WavPack implementation and has a few known peculiarities, some which are expected to be fixed and others of unknown status. As referenced above Android users may need to use the player application's folder to get WavPack files recognized. The tl;dr are that as long as it plays, it plays – but to failsafe against loss of information (e.g. upon conversion), use the official tools.
Splitting WavPack files by cuesheet
WavPack is a format with good support for storing an album as one .wv file with embedded cuesheets, but splitting into tracks by way of cuesheets is not straightforward without external tools. Audio players like foobar2000 which support cue sheets can also split upon conversion. Other external applications that will do this splitting – also with more variations of the cue sheet format(s) supported – include
- CUETools can if it is CDDA (44.1 kHz 16-bit stereo), and can re-encode back to WavPack.
- refalac can decode & split by cuesheets with the appropriate (official) WavPack library DLL file[8], outputting WAVE or ALAC-in-MP4.
Both refalac, CUETools and foobar2000 use the official WavPack tools to for the decoding(/encoding).
FFmpeg's WavPack implementation: differences and quirks
FFmpeg can encode/decode to/from WavPack – which may be seen as attractive from how it also can transfer metadata in one go – but with some limitations and maybe unfamiliar behaviour. Compression settings are different: the default is fast but not particularly good compression[9] – while on the other end, FFmpeg offers even slower modes than -hhx6.
Some limitations:
- FFmpeg can decode WavPack 5 files, but will only write WavPack 4 files (hence no fast verification).
- Above 16 channels, when the WavPack 5 format is required, FFmpeg will still attempt encoding to WavPack but will produce unreadable files. (Unfixed as of October 2022.)
- A rare bug in FFmpeg's WavPack decoder was discovered in August 2022[10] which will cause dropouts in certain files. (The bug is "rare" in that no such file was discovered in several years.) A fix has been coded, and is expected to find its way into official ffmpeg in a few months. However, players and converters that employ ffmpeg as a decoding engine may or may not update that quickly.
- There is potential information loss in using FFmpeg; it will ignore hybrid correction files, so decoding/playing hybrid-encoded WavPack with ffmpeg or ffmpeg-based players will be lossy. Furthermore, ffmpeg will as a general rule not honour the input bit depth: it will default to 16 bits when outputting WAVE/AIFF, whether or not the input file is 16 bits; this could even induce clipping (with no warning!) if the source is a 32-bit float. To force lossless decoding of 24-bit/32-bit files (WavPack/FLAC/ALAC/TAK/uncompressed) to WAVE/AIFF, the user must extract the bit depth information and specify the respective 24-bit/32-bit output format using ffmpeg's command-line syntax. The tl;dr for users who do not have this at their fingertips, is to use other (= official!) decoders when losslessness is desired.
- FFmpeg will sometimes – depending on input format – output 32-bit WavPack files and lose the information that the source was indeed only 24. Not all players support 32-bit files, and verifying that the operation (or an attempted downconversion to 24) was lossless is not straightforward as even fewer applications are willing to compare a 32-bit and a 24-bit file for differences. Also information that bit depth is not an integer number of bytes, is lost; WAVE/AIFF/CAF can handle "17 bit" files by storing 24 and employing a flag to disregard the 7 LSBs, and ffmpeg will lose this flag even when encoding to / decoding from codecs which support it, WavPack and FLAC.
- Also ffmpeg will discard RIFF chunks and file structure. It has no ambition of preserving file structure – however it will by default transfer metadata it supports.
Software support (& hardware)
With Android support and playback through ffmpeg, it might no longer be feasible to maintain a list of applications that can play WavPack files, and the following is most certainly incomplete – as is the list at https://www.wavpack.com/#Software . Also, the distinction between "hardware" and "software" support is not clear in the age of smart devices running Android, and the list at https://www.wavpack.com/#Hardware does not cover those.
Players
- foobar2000 advanced freeware audio player plays/decodes WavPack out of the box on both Windows, MacOS, Android and iOS (Windows: supports encoding if wavpack.exe is installed, and redistributes the official wavpack.exe through its "Free encoder pack" addon for encoding. With ReplayGain & cuesheets support.) Also Boom from the same author.
- VLC multiplatform media player
- VUPlayer (official plugin, supports encoding)
- NullSoft Winamp (plugin with ReplayGain & Media Library support) and Winamp-compatible players
- Windows Media Player and other directshow-based players (MPC, TCMP, RadLight) (with CoreWavPack directshow filter)
- Cog Audio player for MacOS X.
- JRiver Media Center
- XMMS (with Kuniklo's plugin)
- LAMIP (official plugin)
- MPXplay for DOS!
- Aqualung for GNU/Linux
- Cowon JetAudio Player and CD ripper
- XMPlay Plugin required (WavPack input plugin) and (bass library) to play 'wv' files
Converters, CD rippers etc.
Several of the players, like Cowon JetAudio, foobar2000 and VUplayer, also have converters that can create WavPack files. More:
- Custom Windows WavPack frontend (by Speekenbrink)
- dBpowerAMP Music Converter CD ripper/writer / Audio Player / (official addon)
- fre:ac multi-platform CD ripper/converter
- Exact Audio Copy CD Ripper (guide at this wiki[11])
- Nero
- CDex CD ripper
- Ease Audio Converter (Discontinued; shareware / NOT Freeware)
- Media.io Online Audio Converter
- Konvertor
- CUETools converter and AccurateRip/CTDB checker
- refalac (user must copy the wavpackdll.dll file to the appropriate directory)
Taggers and audio info utilities
- Mp3tag Universal Tag Editor
- MusicBrainz Picard Tagger with audio identification
- The GodFather Tagger / Music manager
- Case's Tag command line tagger
- MediaInfo
- Mr. QuestionMan
Audio editors and other tools
- Audacity has WavPack support (using official libraries) from version 3.2.0 (2022)[12].
- Adobe Audition and Cool Edit (filter with 32-bit floats & extra info save support)
- mkvtoolnix – tool to multiplex streams in Matroska container files.
It's worth mentioning the Matroska guys decided to concentrate on WavPack as the lossless compressor of choice for their container. Quite an honor... :-)
- PKWare's .zip format compresses audio by WavPack since version 6.3.2 (2007). Beware that there is no expectation that other decompression software handles these zip files; even if PKWare co-designed the format and PKZip was the original .zip implementation, their subsequent compression methods are outside the ISO/IEC standardized zip format specification.
Links
- Official website
- Github repository
- Unofficial compiles at RareWares, at the moment 5.50 for Windows and 4.32 multiplatform
- WavPack at Wikipedia
- WavPack at Multimediawiki (not updated with version 5)
- HA Wiki's Lossless Codec Comparison originally by Rjamorim
- An older (2005) performance comparison of lossless audio compressors (archived on October 27, 2015) by Speek, using WavPack version 4.0
- ↑ Martijn van Beurden: Lossless audio codec comparison archive, all comparisons in this wiki article consistent with CDDA results from revision 5, 2022, using WavPack 5.4.0.
- ↑ CodecPerformanceComparison at the Rockbox wiki
- ↑ Monkey's Audio FAQ (archived on October 17, 2000)
- ↑ OptimFROG's "DualStream" hybrid encoding – apparently WavPack coined this phrase
- ↑ HA thread with link to Android bug report by the Monkey's Audio author
- ↑ HA forum post on how to rename executable for drag and drop
- ↑ HA forum comment: verification checks the written file after closing and reopening
- ↑ refalac usage includes how to split by cuesheet
- ↑ HA forum comment comparing the compression presets
- ↑ HA forum thread on the ffmpeg bug in .wv decoding
- ↑ HA Wiki: Configuring EAC and WavPack
- ↑ Audacity 3.2.0 release notes
Audio codecs: type/usage | for end-users to encode | on physical media etc. | legacy formats |
---|---|---|---|
Lossless | (Uncompr. LPCM) • ALAC • FLAC • Monkey's Audio • MPEG-4 ALS • OptimFROG • TAK • TTA • WavPack | MLP/Dolby TrueHD | La • LPAC/LTAC • RealAudio Lossless • RK Audio • Shorten • WMA Lossless • (others) |
Lossy | (ADPCM formats) • AAC • AC-3 • MP2 • MP3 • Musepack • Opus • Vorbis | AC-3 • DTS • (Bluetooth codecs) | ATRAC • QDesign • Real Audio • RK Audio (lossy modes) • Speex • VQF • WMA |
Hybrid lossless&lossy | OptimFROG DualStream • WavPack | DTS-HD MA • MPEG-4 SLS | ATRAC Advanced Lossless • mp3HD |