Home

About

Promote

Links


Quick start

Beginner's Guide

Illustrated Manual

Tutorials

XMPlay FAQ


Skins (146)

Visuals (115)

Input Plug-ins (35)

Output Plug-ins (5)

General Plug-ins (11)

Archive Reader (16)

Input Plug-ins (40)

DSP Plug-ins (10)

Tag Editing Plug-ins (6)

External Encoders (3)

External Add-ons (15)

XMPlay Archive (69)

Extra Tools
8.01 - External encoders
by Dotpitch, 2011-08-09 18:00:00

XMPlay can use external encoders to compress the audio output (see the Output - Encoders page of Options and stuff). The command line syntax required for proper compression depends on the encoder used. On this page the configuration of a number of popular encoders is described more extensively.

Note that XMPlay does not display any messages the encoders might return. This means that debugging is impossible, so you should work out the correct command line syntax before starting to encode your music. Determining the correct syntax is done in Windows' own command prompt (Start > Run > cmd) using a test file. For example, you can try lame - test.mp3 < test.wav to test LAME via stdin.

LAME (MP3)

LAME (LAME Ain't an Mp3 Encoder) is an open source MP3 encoder. It performs very well at medium and high bitrates, especially when using VBR (Variable Bitrate). Get the executable from the Support Site or from RareWares. Put lame.exe in the same folder as xmplay.exe. The rest of the files are not required. The default file extension is mp3 and the resolution is 24-bit.

Basic
The basic syntax for LAME is lame input.wav output.mp3. This will convert input.wav, the input stereo PCM WAV-file, to output.mp3, the output MP3 file, with a constant bitrate of 128 kbit/s (about 1 MB per minute of audio). To use LAME with XMPlay, you should replace the input file with an stdin marker (a -) and the output file with the output field (%o), so lame - %o.

Bitrate
The default setting may not be good enough, but you can easily tune it. One of the first things you can do is change the bitrate with the -b command, like lame -b 256 - %o. Instead of the default 128 kbit/s, this will produce a 256 kbit/s file, with the higher bitrate resulting in a higher quality audio file. Not all bitrates are allowed in MP3 (run lame --longhelp to see which are), and using low bitrates will cause LAME to resample the audio to a lower sample rate.

VBR
One of the strong features of LAME is its implementation of VBR-encoding. You specify a quality parameter, and LAME will determine, for each piece of your file, the bitrate required to achieve this quality. VBR-encoding is activated by using the -V command, so lame -V 4 - %o. The parameter can range from 0 (highest quality and largest file) to 9 (lowest quality and smallest file). 4 is usually good enough for common music, and 2 produces audio that is hardly discernible from the original audio.

Tags
LAME can write an ID3 tag, containing fields like Artist and Title, if you supply it with the information to be put in the tag. Defining tags from the command line is done with --tx "value" pairs (note the double minus), where x defines the type of tag and "value" is the string to be saved. For example, lame -V 4 --tt "title" --ta "artist" --tl "album" --ty "year" --tc "comment" --tn "tracknumber" --tg "genre" - %o. Luckily, XMPlay can provide all these tags directly from the file using the same formatting as with track titles. This results in lame -V 4 --tt %1 --ta %2 --tl %3 --ty %4 --tn %5 --tg %6 --tc %7 - %o.
Note that LAME defaults to a ID3v1 tag, and will only add an ID3v2 tag if one of the fields is longer than v1 would allow.

More
lame --longhelp

Helix (MP3)

The Helix MP3 encoder is created by RealNetworks, based on the code of the Xing encoder, and is currently open source (see the Helix Community). It is aimed at very fast encoding (it's roughly three times as fast as LAME) and prefers VBR (Variable Bitrate). Get the executable from RareWares. Put hmp3.exe in the same folder as xmplay.exe, you won't need the rest of the files. The default file extension is mp3 and the resolution is 16-bit.

Basic
The basic syntax for Helix is hmp3 input.wav output.mp3, to convert input.wav, a stereo PCM WAV-file, to output.mp3, the output MP3 file, with a bitrate of around 128 kbit/s. As with LAME, you should replace the input file with the stdin marker and the output file with the output field, so hmp3 - %o.

VBR
Helix can determine the bitrate required to compress a piece of audio based on a quality setting. VBR-encoding is on by default, but you can specify the quality with the -V command, so hmp3 -V80 - %o. The quality parameter can range from 0 (lowest quality and smallest file) up to 150 (highest quality and largest file). 80 is usually good enough . If you're going for high quality MP3s, you're probably better off with LAME, since that has been tested thoroughly.

High frequencies
Helix by default activates a 16 kHz lowpass filter. If you're annoyed by this, add the high frequency switch -HF2 to allow higher frequencies to be encoded as well, so hmp3 -V80 -HF2 - %o. This requires a VBR quality of at least 80, and will increase the bitrate of the output file.

MP3 TOC
When encoding with VBR, seeking becomes more difficult, because a number of bits does not always correspond to the same number of seconds. XMPlay knows how to handle this, but it's better to tell the encoder to include a sort of map in the output file. This is done by adding the header flag -X2 to the command line, so hmp3 -V80 -HF2 -X2 - %o.

Encoding speed
To reach the maximum encoding speed, you have to tell Helix to use SSE, a processor operation set. This is done by adding the optimization flag -U2 to the command line, so hmp3 -V80 -HF2 -X2 -U2 - %o.

Tags
The Helix MP3 encoder does not write tags. You'll have to apply the tags with an external program, for example Mp3tag.

More
hmp3 -h (though it's not that much...)

OggEnc2 (Ogg Vorbis)

OggEnc2 is an open source Ogg Vorbis encoder based upon the official encoder by Xiph. Get the executable from the Support Site, or get a processor-specific version from RareWares. Put oggenc2.exe in the same folder as xmplay.exe. The default file extension is ogg.

Basic
The basic syntax for Oggenc2 is oggenc2 input.wav, to convert input.wav, a PCM WAV-file (multichannel as well), to input.ogg, the output Ogg Vorbis file, with a bitrate of around 128 kbit/s. To use this encoder with XMPlay, use oggenc2 - -o %o, with the stdin marker and the output field. Note that OggEnc2 needs the output file flag -o, otherwise it won't create an output file.

VBR
Ogg Vorbis is a VBR (Variable Bitrate) codec, so the encoder chooses a bitrate based on a quality setting. With the -q command, you can define a quality setting, so oggenc2 -q 4 - -o %o. The quality parameter can range from -1 (lowest quality and smallest file) to 10 (highest quality and largest file), and fractions are allowed. 4 is pretty good for common music, 9 will preserve pretty much anything you can hear. If you're trying to save disk space, be sure to try 0 as well.
Note that it is possible to specify a target bitrate using the -b flag (oggenc2 -b 256 - -o %o), but that just calculates the quality setting based on the sample rate and the number of channels.

Tags
OggEnc2 can write a Vorbis tag to the output file, containing fields like Artist and Title, if you supply it with the information to be put in the tag. With the various flags, this results in oggenc2 -q 4 -t "title" -a "artist" -l "album" -d "date" -N "tracknumber" -G "genre" -c "comment". To have XMPlay supply the encoder with these tags, use the same formatting as with track titles, so oggenc2 -q 4 -t %1 -a %2 -l %3 -d %4 -N %5 -G %6 -c %7 - -o %o.

More
oggenc2 -h

Nero (MP4)

NeroAacEnc is an AAC encoder built by Nero AG, which outputs files in the MP4 format. Get the executable from the Nero website and put neroAacEnc.exe (from the Win32 folder) in the same folder as xmplay.exe. The rest of the files are not required. The default file extension is m4a and the resolution is 32-bit. Note that mp4 and acc work as well for the extension, and XMPlay supports all of them with xmp-aac. (In reality the encoder puts the AAC audio stream in an MPEG4 box, which can appear with the extension mp4 or m4a, with the latter containing only an audio stream.)

Basic
The basic syntax for neroAacEnc is neroAacEnc -if input.wav -of output.m4a, to convert input.wav, a PCM WAV-file, to output.m4a, the output MA4 file with an AAC audio track with a bitrate of around 175 kbit/s. Replace the input file and the output file with the stdin marker and the output field respectively to use this encoder with XMPlay, so neroAacEnc -if - -of %o.

VBR
The AAC audio in the output MP4 file can be VBR (Variable Bitrate), so the encoder can choose a bitrate based on the requested compression quality. You can select a quality with the -q command, so neroAacEnc -q 40 -if - -of %o. The quality setting can range from 0 (lowest quality and smallest output file) up to 150 (highest quality and largest output file). Generally a setting of 40 should be good enough for common music.

Profiles
AAC has various profiles (see MPEG-4 Part 3 on Wikipedia for more info). The Nero encoder can create audio using three different profiles: Low Complexity (LC), High Efficiency (HE, is LC with SBR) and High Efficiency v2 (HEv2, is LC with SBR and PS). The encoder selects the profile best matching your quality setting (e.g. a low quality setting activates the HEv2 profile), but you can also force the profiles using the -lc, -he or -hev2 commands respectively, so neroAacEnc -q 40 -hev2 -if - -of %o. If you're trying to save disk space, give the HEv2 profile a try. XMPlay can decode all three profiles with xmp-aac. Mobile phones usually support all three profiles, but other (hardware or software) decoders might not.

Tags
The Nero AAC encoder does not write tags. You'll have to apply the tags with an external program, for example Mp3tag.

More
neroAacEnc -help

FLAC (FLAC)

FLAC is the reference Free Lossless Audio Codec encoder. Get the executable from the Support Site or from Rarewares and put flac.exe in the same folder as xmplay.exe. You don't need the rest of the files or sources to encode FLAC files. The default extension is flac, but ogg is possible as well (producing Ogg FLAC files). The resolution is 24-bit.

Basic
The basic syntax for FLAC is flac input.wav -o output.flac, converting the input PCM WAV-file input.wav losslessly to the output FLAC file output.flac. To use the encoder with XMPlay, set it to use stdin and specify the output field, so flac - -o %o.

Compression
The FLAC format is lossless, so it's not possible to select a certain bitrate. What can be selected is the amount of time the encoder spends in trying to compress the data, ranging from -0 (fastest encoding and largest file) to -8 (slowest encoding and smallest file). -5 is the default setting, so flac -5 - -o %o.

Tags
FLAC can write FLAC tags to the output file, but you have to define both the field names and the information they should contain. Using the same formatting as for track titles, this creates the encoder command-line flac -5 --tag=title=%1 --tag=artist=%2 --tag=album=%3 --tag=year=%4 --tag=track=%5 --tag=genre=%6 --tag=comment=%7 - -o %o.

More
flac -h or, with even more detailed information, flac --explain.

Encoding time

In the graph below is the encoding time for a small set of audio files, just to give you an indication .

Encoding times for various encoders, indicative only

Next page: Icecast streaming