DivX AAC Encoder (Beta)

DivX Plus adds the capability for high quality surround sound audio to the DivX ecosystem using Advanced Audio Coding (AAC) technology. When combined in an MKV container with H.264 video at up to 1080p, AAC audio completes a truly cinematic viewing experience. To support the creation of AAC tracks for DivX Plus HD content we've created a command line AAC audio encoder. Read on for more information and to access the download!

About the DivX Plus HD AAC Encoder

The DivX Plus HD AAC encoder is a command line application that will encode uncompressed mono, stereo, or 5.1 surround audio compatible with the DivX Plus HD profile. It accepts as input multichannel WAV files or raw PCM streams and supports encoding Low Complexity (LC) streams including High Efficiency v1 (HEv1) and High Efficiency (HEv2) modes. The AAC encoded stream is ADTS-encapsulated and can be easily muxed into an MKV file along with the accompanying video using MKVMerge, which we discussed previously in our H.264 encoding tutorial.

Using the DivX Plus HD AAC Encoder

After installing the encoder you can open a command console using the shortcut created in your Start menu. Type divxaacenc --help to see the list of the available command line arguments. If you aren't very familiar with using the command interpreter a short introduction is included in our H.264 encoding tutorial that will help get you started. You can also find help in the DivX Plus forum (requires sign-in).

(Click to enlarge)

The most basic form of the command line requires only two options, the name of the input and output files specified using -i and -o respectively:

DivXAACEnc -i "MyInput.wav" -o "MyOutput.aac"

  • Input types

    The easiest input format for the encoder is a WAV audio file. This format has near universal support among audio editors for import and export and the file header includes information about the audio sampling rate, number of channels, and bits per sample so that there is no need to manually provide this information. The encoder expects the channels to be interleaved in order of Front Left (FL), Front Right (FR), Front Center (FC), Low Frequency Effects (LFE), Side Left (SR), Side Right (SR). Although internally WAV files are limited to storing only 4GB of data some applications will write larger files and the encoder will attempt to handle these automatically.

    You can also pass a raw PCM audio file to the encoder. The same channel order is expected and in addition you need to provide the correct sample rate, number of channels, and bits per sample because raw PCM files have no header that provides this information. This is done using the -s, -c, and -l arguments respectively. For example, to encode a 5.1 surround track using raw PCM input at 44.1Khz, 24-bit, you would enter:

    DivXAACEnc -i "MyInput.pcm" -o "MyOutput.aac" -s 44100 -c 6 -l 24

    The encoder expects raw PCM data to be in one of the following formats depending on bits per sample:

    Bits per sample PCM format
    8 Unsigned most significant bit first, interleaved by channel
    16 Signed little endian most significant bit first, interleaved by channel
    24 Signed little endian most significant bit first, interleaved by channel

    Warning: Using an incompatible PCM format or entering the wrong format information can result in loud noise in the output file. Minimize your volume when you first try playing a file!

  • Rate control

    The encoder has two rate control options: Constant Bitrate (CBR) and Variable Bitrate (VBR). CBR is the default mode and allows you to specify how many kilobits per second the encoder can spend when encoding. Higher bitrates will lead to better quality but larger files. The rate is passed using the -b argument and valid rates include (in kbps): 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 640, 768, 896, 1024. For example to encode an input file at 128kbps:

    DivXAACEnc -i "MyInput.wav" -o "MyOutput.aac" -b 128

    The maximum data rates depend on the input sample rate, number of channels, and which if any high efficiency mode is enabled (more on that in a moment!).

    Maximum bitrates for LC mode (kbps)

    Sample rate Mono Stereo Surround
    96000 512 1024 n/a
    88200 512 1024 n/a
    64000 384 768 n/a
    48000 256 512 1024
    44100 256 512 1024
    32000 192 384 1024
    24000 128 256 768
    22050 128 256 768
    16000 96 192 512
    12000 64 128 384
    11025 64 128 384
    8000 48 96 256

    Bitrates for HEv1 mode (kbps)

    Sample rate Mono Stereo Surround
    16000 10 - 40 16 - 56 48 - 128
    22050 10 - 48 16 - 64 48 - 160
    24000 10 - 48 16 - 64 48 - 160
    32000 16 - 56 24 - 80 80 - 192
    44100 16 - 64 32 - 96 96 - 256
    48000 16 - 64 32 - 96 96 - 256

    Bitrates for HEv2 mode (kbps)

    Sample rate Stereo
    16000 10 - 40
    22050 10 - 48
    24000 10 - 48
    32000 16 - 56
    44100 16 - 64
    48000 16 - 64

    VBR encoding takes an alternative approach to rate control and instead of specifying a constant bitrate you indicate a target quality. The encoder will spend as many bits as necessary to achieve the target quality and thus this mode is suitable only when you don't need to know in advance the output file size. VBR modes are enabled by passing -v with a value in the range 1-9, higher values giving better quality but larger files. For example:

    DivXAACEnc -i "MyInput.wav" -o "MyOutput.aac" -v 4

  • High Efficiency Modes

    The encoder includes support for two high-efficiency modes, HEv1 and HEv2. These modes are designed to improve perceptual quality at very low bitrates and are disabled by default so that the encoder provides the best possible quality for typical projects. Enabling either mode limits the sample rates, channel configurations, and range of permitted data rates the encoder will accept. When any high-efficiency mode is enabled only the CBR rate control mode can be used.

    HEv1 mode enables Spectral Band Replication (SBR), where high frequencies are not coded but instead ancillary information is used to aid decoders in later synthesizing similar sounds during playback. At low data rates the synthesized audio does not match the original input but the perceptual quality will be better than if the encoder had attempted to represent all frequencies accurately with too little bandwidth. To enable HEv1 mode use -e 1, for example:

    DivXAACEnc -i "MyInput.wav" -o "MyOutput.aac" -e 1 -b 64

    HEv2 mode additionally enables Parametric Stereo (PS), where the encoder reduces a stereo input to mono while recording ancillary data that allows a decoder to simulate a stereo environment during playback that approximates the original. This improves perceptual quality at extremely low data rates where encoding a true stereo sound with sufficient quality is not possible given the available bandwidth. To enable HEv2 mode use -e 2, for example:

    DivXAACEnc -i "MyInput.wav" -o "MyOutput.aac" -e 2 -b 40

    It's important to note that MKVMerge cannot detect whether SBR is present in an AAC audio stream. Therefore, when using either HEv1 or HEv2 always inform MKVMerge that SBR is present using --aac-is-sbr. For example:

    MKVMerge -o "MyFilm.mkv" --default-duration 0:1/24s "MyVideo.264" --aac-is-sbr 0:1 "MyAudio.aac"

    The high-efficiency modes introduce a coding delay, so when they are later decoded audio will begin slightly later than the absolute beginning of the file. The delay times will be:

    Coding delay by mode (milliseconds)

    Sample rate HEv1 HEv2
    48000 22 40
    44100 24 43
    32000 33 60
    24000 44 80
    22050 48 87
    16000 66 120

    This delay is normally corrected for during muxing. For example, when muxing a 22050hz AAC HEv1 stream with MKVMerge you might use:

    MKVMerge -o "MyFilm.mkv" --default-duration 0:1/24s "MyVideo.264" --sync 0:-48 --aac-is-sbr 0:1 "MyAudio.aac"

  • ADTS protection

    The DivX Plus HD AAC encoder can optionally write CRC values to the ADTS container that allow a decoder to detect errors later introduced in the audio bitstream. This feature can be enabled using the -p argument:

    DivXAACEnc -i "MyInput.wav" -o "MyOutput.aac" -p 1

    The CRC will use approximately 0.1 - 1.5kbps for sample rates in the range 8Khz to 96Khz respectively.

  • Low-pass filter

    The encoder automatically applies a low-pass filter to remove some of the high frequencies from the input signal depending on the encoding bitrate. By reducing the number of bits spent on high frequencies when the bitrate is lowered the overall perceptual quality of the sound is better maintained. The cut-off frequency for the low-pass filter can be manually specified using -f. For example, to cut frequencies above 16Khz:

    DivXAACEnc -i "MyInput.wav" -o "MyOutput.aac" -f 16000

    The range of frequencies represented in an input file is limited to half the sample rate, therefore if your input file has a sample rate of 48Khz the highest frequencies in the audio are 24Khz, and setting the low-pass filter higher than this will have no effect. The low-pass filter can be disabled using -f 0, but this is only recommended at high bitrates.


Audio processing tips

  • Audacity is a handy, free audio-editor that can perform various operations on uncompressed audio files.

  • Sources with one file per channel can be combined into a single WAV file using a tool such as Microsoft's wavavimux utility. This tool will install under \Program Files\Windows Media Components\Tools\WAVAVIMUX by default. To convert 6 individual WAV files into one multi-channel wav you would use:

    wavavimux -o "multichannel.avi" -iwav 6 "FL.wav" "FR.wav" "C.wav" "LFE.wav" "SL.wav" "SR.wav" -mask 63


Known issues for DivX Plus HD AAC Encoder Beta 1

The following are known issues in this version:

  • The CBR mode does not pad frames if the input audio complexity does not require using all of the available bitrate.

  • The AAC encoder outputs error messages to stdout rather than stderr.

  • The low-pass filter cut-off frequency does not automatically adjust for sample rates greater than 48Khz. Therefore, when encoding input files with sample rates in the range 64Khz-96Khz set the cut-off frequency manually using the -f argument.

  • The default bitrate for 6-channel input may be too low. Specify a rate using the -b argument.


Downloading DivX Plus HD AAC Encoder Beta 1

To download this beta you need to create a free DivX Labs account then join the Project Rémoulade Apps group. Downloads for Project Rémoulade are available at the top of the group homepage for signed-in members.


How you can help us

We want to hear your feedback! Please submit your comments and questions to the DivX Plus forum (requires sign-in).


If your feedback relates to performance issues or software stability, please consider attaching some of the following to your post:

  • Screenshots from CPU-Z that show your CPU, memory and mainboard configuration.

  • Screenshots of any crash dialogs, including the details view if available.

  • An export from MSInfo32, which you can launch by simply typing MSInfo32 into the Run box on your Start menu, so that we can see information about the operating system, running software and application errors.