Helix MP3 Encoder

From Hydrogenaudio Knowledgebase
Revision as of 14:35, 25 March 2024 by Maikmerten (talk | contribs) (→‎Features: link to related Wiki pages (MP3, CBR, VBR))
Helix MP3 Encoder

Developer(s) RealNetworks,

maikmerten maintains GitHub repo

Release information
Initial release
Stable release
Preview release
Compatibility
Operating system Linux, Windows
Additional information
Use Encoder
License RPSL
Website GitHub repo

The Helix MP3 Encoder was open-sourced by RealNetworks ca. 2005 via the (long-defunct) Helix community project. It originated from the Xing MP3 encoder, which was purchased by RealNetworks.

A current version ("hmp3"), with contributions from HydrogenAudio members, is available as source code over at https://github.com/maikmerten/hmp3. This Wiki page discusses that version.


Features

  • Encodes MP3 in MPEG-1 and MPEG-2 modes
    • 48 kHz, 44.1 kHz, 32 kHz (MPEG-1)
    • 24 kHz, 22.05 kHz, 16 kHz (MPEG-2)
  • LAME headers for gapless playback
  • CBR and VBR encoding

Listening tests

The Helix MP3 encoder participated in several listening tests and demonstrated to be amongst the highest-quality encoders for MP3 available.


Encoder switches

hmp3 is a command-line operated application. The most basic invocation to generate a MP3 file from WAV:

 hmp3 input.wav output.mp3

This creates a ~128 kbps VBR file for 44.1 kHz stereo input.

Encoder switches
Switch Function Example
-B Set per-channel bitrate. Selects CBR encoding. -B64 for a 128 kbps stereo CBR file
-F Frequency cutoff for the encoder lowpass filter. To actually encode anything beyond 16 kHz, also specify the -HF switch. -F19000 for a 19 kHz lowpass
-HF Controls encoding of high frequency content (> 16 kHz). Disabled by default. Valid values are 0 (disabled), 1 (partial, only "mode-1 granules"), 2 (full, "all granules"). Note that high-frequency content will only be encoded if the psychoacoustic model deems encoding high frequencies as beneficial for the given bitrate/quality settings.

High frequencies will only be encoded if -V >= 80 or -B >= 96.

HF2 for unrestricted high-frequency encoding
-M Stereo-mode/Mono selection. 0: stereo, 1: M/S stereo (default), 2: dual channel, 3: mono -M3 to downmix to mono
-N Enable use of Intensity Stereo. Only works with CBR and makes the encoder use "Bit Allocator 1" (see section "Bit Allocators") -N8 to enable Intensity Stereo with 8 bands of M/S stereo
-SBT Threshold for short-block decisions. Lower values mean more short-block usage. Default is 700. -SBT500 for more short-blocks (more responsive to transients, might increase bitrate in VBR)
-V Quality setting for VBR encoding. Ranges from 0 to 150. Default is 50. -V115 for a ~180-200 kbps stereo VBR file
-X Control writing of Xing/LAME header information. 0: No headers, 1: only basic Xing information header, 2: Xing header with VBR-TOC and LAME header (gapless information) (default) -X0 to disable headers (in very rare cases of incompatibility)

Reasonable Settings

Here's a short list of settings for different encoding needs. Note that while comparisons to LAME's VBR settings are provided, these are only very rough estimates to provide guidance regarding potential use cases. LAME and Helix are very different encoders and are expected to perform better and worse in comparison, depending on audio material.

Overview of reasonable hmp3 settings
Setting Approx. Bitrate Description
 -F24000 -HF2 -V150
~ 256 kbps Maximum quality VBR encoding, with full audio spectrum. (ca. LAME -V 0)
 -F19000 -HF2 -V110
~ 195 kbps

High-quality VBR encoding, audio spectrum up to 19 kHz. (ca. LAME -V 2)

This should be close to transparent to most people in most situations.

 -F18000 -HF2 -V80
~ 160 kbps Medium-quality VBR encoding, audio spectrum up to 18 kHz. (ca. LAME -V 4)
 -F16000 -V50
~ 128 kbps

Low-medium-quality VBR encoding, audio spectrum up to 16 kHz. (ca. LAME -V 5-6)

Default setting of the Helix MP3 Encoder. Should be sufficient for casual listening on space-constrained devices, but is not expected to be universally transparent.

Bit allocators

The Helix MP3 Encoder, apparently for historical reasons, has two distinct bit allocators, which are selected depending on operating modes. Bit Allocator 1 (bitallo1.cpp) appears to be the older one, most likely inherited from early Xing days, while Bit Allocator 3 (bitallo3.cpp) is a newer, overall more-capable mechanism that is utilized by default.

Bit allocators
Feature Bit Allocator 1 Bit Allocator 3
CBR supported supported
VBR not supported supported
>16 kHz encoding not supported supported
Long/Short block switching not supported supported
Intensity stereo supported not supported

Bit Allocator 1 thus is mostly interesting for very low-bitrate CBR encodings, where intensity stereo can lead to bitrate savings to spend somewhere else. Example:

 hmp3 input.wav output.mp3 -F16000 -B48 -N8

for somewhat bearable low-bitrate stereo-ish MP3 encoding (the -N parameter enables intensity stereo).

External links