Top

Encoding Audio for DivX® Certified Devices

DivX movies are stored in AVI container files. Within these AVI files, many different audio formats can be combined with the DivX video. However, DivX Certified devices require that the audio format be MP3 audio.

MP3 audio has several advantages over other formats:

  • MP3 audio is supported natively by most operating systems.
  • MP3 audio achieves near CD-quality audio at very low bitrates.
  • Many applications are specifically designed to work with MP3.

There are two main types of MP3 audio available:

  • CBR MP3
    Constant Bitrate MP3 is encoded using a fixed bitrate throughout the audio stream. CBR MP3 often leads to tighter audio/video synchronization during playback as it is very easy to seek accurately through a CBR audio stream. If you use CBR MP3 audio you can use the DivX 5.2 bitrate calculator to calculate your video bitrate automatically.

  • VBR MP3
    Variable Bitrate MP3 is encoded using a variable bitrate throughout the audio stream. VBR MP3 typically leads to slacker audio/video synchronization because it is not as easy to accurately seek through a VBR audio stream. However, because the bitrate is variable, VBR MP3 adapts better to the complexity of the audio signal being encoded and generally achieves better quality than CBR MP3 using an equivalent number of bits. If you use VBR MP3 audio you will not be able to use the DivX 5.2 bitrate calculator to calculate your video bitrate automatically, unless you use an external encoder to create an MP3 file before encoding your DivX movie.

    Average Bitrate MP3, or ABR, is a special case of VBR MP3 where the encoder will vary the bitrate in such a way that it still aims to meet a given average bitrate. If you use ABR MP3 audio you can use the DivX 5.2 bitrate calculator to calculate your video bitrate automatically.

Installing an MP3 Encoder

Before you can encode MP3 audio from most applications, you will need to install an MP3 encoder. For the greatest compatibility, you should install an MP3 codec designed for Microsoft’s Audio Compression Manager (ACM).

Encoding MP3 Audio with your DivX® Video

Once an ACM MP3 encoder has been installed you can use it with any software that supports ACM audio codecs. For the purposes of illustrating the process of audio compression, this guide will use VirtualDubMod, a free, open-source video utility that supports both CBR and VBR audio.

If you normally use VirtualDub to encode DivX video, you may also wish to download VirtualDubMod because VirtualDub does not support VBR audio.

Step 1

Load VirtualDubMod, and open any video file with an audio track.

Step 2

Select Stream list from the Streams menu.

The Available streams dialog will open. In VirtualDubMod all audio tracks are managed as streams. It is possible to add, remove, or re-encode streams using this interface.

This source file has one audio stream, and its uncompressed PCM. Re-encoding this stream as MP3 will make the audio DivX Certified-compatible, and reduce the audio data by 10 to 12 times.

Step 3

Right-click on the audio stream to view its context menu.

VirtualDubMod automatically sets the stream processing mode to Direct stream copy, which means the audio stream will be copied into the output AVI file with no processing applied.

We want to recompress the audio stream, so change the processing mode to Full processing mode.

Step 4

Once a stream is set to Full processing mode, additional context menu items become available for setting processing options.

Right-click on the stream again and choose Compression from the context menu.

The Select audio compression dialog will open.

All installed ACM audio codecs will be listed and, depending on your system configuration, you may see more than one MP3 codec available.

Step 5

In the left-hand pane, select the MP3 codec.

Check the Show all formats box to see all the encoding modes the MP3 codec supports.

Select an appropriate mode for the audio encoding.

For near-CD quality audio, select 44100Hz, 128kbps CBR, Stereo.

Click OK to return to the Available streams dialog.

Step 6

DivX Certified devices require that audio is interleaved every frame for the best possible playback experience. Interleaving describes the layout of audio and video chunks within an AVI file. When audio is interleaved every frame the chunk sequenced in the AVI file will be: Video 1, Audio 1, Video 2, Audio 2, and so on...

Frequent interleaving reduces seek times during play back, and is critical for devices supporting media with poor random access performance, such as CD or DVD media.

Right-click on the audio stream, and select Interleaving from the context menu.

The Audio/Video Interleave Options dialog will open.

Under Audio block placement, set a 500ms preload and interleave audio every 1 frame.

Notice the Audio skew correction control. By entering either a positive or negative value in milliseconds (thousandths of a second), it is possible to fine tune the audio/video synchronization. If you set the audio stream processing mode to Direct stream copy, it is possible to synchronize an AVI file without re-encoding the audio. However, for now set a 0ms delay (no delay), and leave the processing mode set to Full processing mode.

Step 7

If your video has already been encoded with DivX, you may wish to skip this step. If so, select Direct stream copy mode from the Video menu so that the video stream is not re-encoded as VirtualDubMod creates the output AVI file, then move on to Step 10.

Select Normal recompress from the Video menu. By setting the video mode to Normal recompress you instruct VirtualDubMod to recompress the video stream as it writes the output AVI file without applying any filters prior to encoding.

Step 8

Once the processing mode is set to Normal recompress, additional menu items become available for setting processing options.

Select Compression from the Video menu to select and configure the video compressor. The Select video compression dialog will open.

Select the DivX Pro™ 5.2.0 Codec in the left-hand pane. Next, click Configure to open the encoder configuration dialogue.

Step 9

For the sake of simplicity, click the Restore defaults button to set 1-pass encoding mode to Standard quality under Home Theater profile. (Please consult The Official DivX 5.2 User Guide for further information about configuring the DivX encoder.)

DivX Pro 5.2 includes a built-in bitrate calculator that can calculate the video bitrate required to hit a target file size.

Click the Bitrate Calculator button to open the Bitrate calculator dialog.

First enter the duration of the video you are encoding. Next, enter the audio bitrate you selected when configuring the MP3 codec. Finally, enter the target file size for you DivX AVI file. The bitrate calculator will calculate the video bitrate you require automatically.

Click Accept.

Note: You can use the Available streams interface (shown in Step 2) to import external audio files. You may, for example, have separately prepared an mp3 file that you want to use with your DivX video. In this case, set the stream processing mode for the audio track to Direct stream copy and, instead of entering a bitrate in kbps, use the lower of the two Audio Bitrate fields in the bitrate calculator to enter the entire external file size in KB.

Step 10

VirtualDubMod processes the audio and video as it writes the output AVI file.

Select Save As from the File menu.

The Save As dialog will open.

Verify that the settings on the Save As dialog are correct, then enter a file name and click Save. VirtualDubMod should begin processing the file immediately and the VirtualDubMod Status dialog will open.

The status dialog will indicate how many bits have been allocated to both video and audio in the output AVI file in real time.

Note that DivX video uses an average bitrate scheme. This means that the video bitrate may fluctuate during encoding, as may the Projected file size that VirtualDubMod reports. Towards the end of the encoding process the Projected file size should resemble the value you entered in the bitrate calculator.

Audio Tips

Using MP3 audio with other applications

Audio encoding was illustrated here using VirtualDubMod. However, similar methods and interfaces exist in almost all video editing applications. Audio and video compressor configurations can normally be found either in your application's 'Project settings' interface, or during the 'Export movie' stage of the editing process.

After you install an MP3 codec, it should be available as an audio compressor in most video editing applications.

If your application does not support ACM MP3 codecs

If your application does not support ACM MP3 codecs, there are a few workaround solutions to audio encoding:

  • Use the application's own MP3 encoder, if it has one.
  • Export the AVI file with DivX video and uncompressed (PCM) audio. Load the file into VirtualDubMod and set the Video mode to Direct stream copy, then follow Steps 2-6 and Step 10 as illustrated above to re-encode the audio as MP3.
  • Export the AVI file with DivX video, but no audio. Save the audio track separately, load the file into VirtualDubMod and set the Video mode to Direct stream copy, then follow Steps 2-6 and Step 10 as illustrated above to re-encode the audio as MP3.

Encoding audio during multipass

If you wish to perform multipass encoding, it is not necessary to process the audio on every single pass. Double-clicking an audio stream in VirtualDubMod will disable the stream and no processing will take place upon it.

Stream is enabled

Stream is disabled

It is only necessary to process the audio on the final pass you intend to make. Disabling the audio stream for all other passes may reduce the encoding duration significantly.

Other applications may or may not provide a means of disabling the audio track.

Copyright© 2008 DivX, Inc. All rights reserved. DivX® is a registered trademark of DivX, Inc.