DivX Ultra authoring in Linux

Since DivXMux.exe runs under Wine on Linux it is possible to author DivX Ultra files with DVD-like menus on Linux. The Matroska video container can also contain MPEG-4 video with DVD-like menus, however Matroska isn't backwords compatible with the avi nor can it be played on any hardware DVD players. The Matroska video container can be parsed by harddisk media players such as the Popcorn Hour and the Western Digital HD Media Player. DivX Ultra menus work on DivX Ultra Certified DVD players such as the Philips DVP5982. Moreover, the files are backwards compatible with all DivX Certified DVD players. It was first suggested in that DivXMux.exe would run under Wine. Since there are already excellent open source MPEG-4 ASP video encoders, such as Xvid, available the only missing component is an authoring tool similar to dvdauthor that can create the complicated xml files that DivXMux.exe needs for input. I've written a program called genxmux to create such a DivXMediaManager xml file from a simpler disk description.

This disk description allows for multiple menus, a spash file that plays before the first menu and a single title track. Although DivX Ultra can contain more than one title, only the first is accessible using a non Ultra player. Therefore, only one title track ensures backwards compatibility. If you have more than one title, join them together and treat them as a single avi feature for input into genxmux. Use separate menus and chapter points to access the single feature track as a first and second title.

I encourage the DivX company to open the DivX Ultra container format to the public before it becomes completely obsolete. The DivX Ultra container format should also be extended so it can hold AVC h264 encoded video. Since h264 can already be stored in avi files, a simple extension to DivXMux.exe is all that's necessary. In a few years most hardware players will have the processing power to decode h264 and I'd sure like to use the better compression.


The current version of genxmux is I wrote the initial version of genxmux in about 2 days and appologize for the coding style. It could be improved in many ways, for example, by Feel free to tackle any of these projects and sent me updates. I lost enthusiasm to polish genxmux after I realized how rough DivXMux.exe was in the first place.

Required Software

Some of the software necessary to make genxmux work is Copy the windows executables in DivXMediaFormat_SDK_r2.rar into the directory /usr/local/exe or edit the paths in genxmux to reflect where you have installed them. Use the Makefile to compile the programs bmppalette and genxmux and install these programs in /usr/local/bin.

Authoring Outline

The program genxmux is designed to allow authoring of a divx file using tools and techniques similar to dvdauthor. Menus are the main thing I like about the DivX Ultra container and to make them easy to create I chose to make the menu input files compatible with dvdauthor.

Create a menu file using using Gimp and spumux exactly as you would for dvdauthor. The first thing genxmux does is to demultiplex the dvdauthor menus, reencode them with ffmpeg and then remultiplex them into avi files using DivXMux.exe. Note that, it is assumed that the dvdauthor menus are still with no sound. If moving menus are required then you will need to modify the code in genxmux, or patch the changes in by hand later to the resulting video.xml file.

To prepare the splash and feature source files it is best to use mencoder. A command such as

$ mencoder <feature.mpg> -ovc xvid -aspect 720:400 \
        -xvidencopts profile=dxnhtntsc:nointerlacing:fixed_quant=7 \
        -oac mp3lame -lameopts preset=medium -idx \
        -vf harddup,kerndeint,scale=720:400 \
        -af resample=44100 -o <feature.avi>
will take an mpeg file, deinterlace and encode it using the xvid encoder. Note the use of the harddup option. This is important to avoid audio/visual desynchronization when the file is remuxed with DivXMux.exe later. If there are still synchonization issues, you may also need to add the -delay xxx option to mencoder.

Now make a backup copy of the spash file because it will get overwritten by what I presume is a bug in DivXMux.exe during the final muxing. It would sure be nice to have a open source version of DivXMux.exe. It would also be nice if DivXMux.exe wasn't so picky about its input files.

Many hardware DivX Ultra players such as the Philips DVP5982 will understand qpel and gmc encoding. If you are not worried about reverse compatibility with older players then replace the profile dxnhtntsc with asp5:gmc:qpel for better quality. You may wish to change the number 7 in fixed_quant=7 to change the resulting bitrate of the movie---the smaller the number the higher the bitrate. Using 2-pass encoding will also increase the quality and lower the bitrate.

After you have created feature.avi the program avidemux2_gtk can be used for finding chapter break points. This allows you to hand select the chapter breaks at GOP frames. If your chapter break point isn't at a GOP frame then DivXMux.exe will round it to the nearest GOP.

Chapters break points may be denoted in the file with the xml line

     <chapter frame="xxx" />
where xxx is the frame number the chapter starts at. Each chapter ends at either the last frame in the video or at the frame before the next greatest chapter start frame. Chapter break points may also be implicitly specified with frame="xxx" in the button commands.

After creating your disk.xml description run genxmux as

$ genxmux disk.xml
to generate the video.xml file and remultiplex the menus. The program genxmux will create the file video.xml and end with an appropriate command command to finish the multiplexing. Again make sure you have backed up the spash file before running DivXMux.exe with the resulting video.xml file.

An simple disk xml example

    <feature src="iiu.avi" />
    <splash src="splash.avi" />
    <chapter frame="0" />
    <chapter frame="3666" />
    <chapter frame="6732" />
    <chapter frame="16639" />
    <chapter frame="24770" />
    <chapter frame="28922" />
    <chapter frame="35397" />
    <chapter frame="42619" />
    <chapter frame="54064" />
    <chapter frame="56932" />
    <chapter frame="62795" />
    <chapter frame="69231" />
    <chapter frame="73101" />
    <chapter frame="81876" />
    <chapter frame="90136" />
    <chapter frame="97823" />
    <chapter frame="109720" />
    <chapter frame="113399" />
    <chapter frame="118455" />
    <chapter frame="124215" />
    <chapter frame="135675" />
    <chapter frame="139611" />
    <menu src="menu-1.mpg">
        <button action="play" frame="0" />

An example with multiple menus

    <feature src="main.avi" />
    <splash src="intro.avi" />
    <menu src="menu-1.mpg">
        <button action="play" frame="0" />
        <button action="play" frame="2250" />
        <button action="play" frame="3895" />
        <button action="play" frame="6087" />
        <button action="play" frame="10156" />
        <button action="play" frame="14069" />
        <button action="play" frame="16916" />
        <button action="play" frame="19354" />
        <button action="play" frame="22112" />
        <button action="goto" menu="2" />
    <menu src="menu-2.mpg">
        <button action="play" frame="27185" />
        <button action="play" frame="30145" />
        <button action="play" frame="33991" />
        <button action="play" frame="37309" />
        <button action="play" frame="42346" />
        <button action="play" frame="45240" />
        <button action="play" frame="48798" />
        <button action="play" frame="53462" />
        <button action="play" frame="60408" />
        <button action="goto" menu="1" />
        <button action="goto" menu="3" />
    <menu src="menu-3.mpg">
        <button action="play" frame="67585" />
        <button action="play" frame="71751" />
        <button action="play" frame="75798" />
        <button action="play" frame="88192" />
        <button action="play" frame="92766" />
        <button action="goto" menu="2" />
Here main.avi is the main feature and intro.avi plays just before the menus. The files menu-1.mpg, menu-2.mpg and menu-3.mpg are generated using spumux from the dvdauthor.

The program genxmux takes the menu-x.mpg files and uses spuunmux to extract the menu bitmaps and remultiplex them into DivXMux compatible menus. It then creates the file video.xml that serves as input to DivXMux.exe. The output as the program runs is here.

The final video file is now muxed with

$ wine ./DivXMux.exe -x video.xml -t temp -o video.avi
DMFChecking: intro.avi
DMFChecking: _menu-1.divx 
DMFChecking: _menu-2.divx 
DMFChecking: _menu-3.divx 
DMFChecking: main.avi 
main.avi The start frame is ok: 0
main.avi moving starting frame: 2094    2250 >> 2393
main.avi moving starting frame: 3888 << 3895    4187
main.avi moving starting frame: 5981    6087 >> 6122
main.avi moving starting frame: 9982    10156 >> 10281
main.avi moving starting frame: 13869    14069 >> 14168
main.avi moving starting frame: 16744    16916 >> 17043
main.avi moving starting frame: 19136    19354 >> 19435
main.avi moving starting frame: 21827    22112 >> 22126
main.avi moving starting frame: 26910    27185 >> 27209
main.avi moving starting frame: 29900    30145 >> 30199
main.avi moving starting frame: 33787    33991 >> 34086
main.avi moving starting frame: 37076    37309 >> 37375
main.avi moving starting frame: 42159    42346 >> 42458
main.avi moving starting frame: 45149 << 45240    45448
main.avi moving starting frame: 48737 << 48798    49036
main.avi moving starting frame: 53222    53462 >> 53521
main.avi moving starting frame: 60398 << 60408    60697
main.avi moving starting frame: 67574 << 67585    67873
main.avi moving starting frame: 71461    71751 >> 71760
main.avi moving starting frame: 75647    75798 >> 75946
main.avi moving starting frame: 87906    88192 >> 88205
main.avi moving starting frame: 92690 << 92766    92989
DivXMux: Version 6.1 Build Num: 36
Output File Streams:

  TrackId 0: Video Stream: From AVI
     Frame Rate: 29.970030
     Resolution: 720x400
  TrackId 1: Audio Stream: From AVI
    Input TrackId 1
    SamplesPerSec: 48000
    BlockAlign: 1152
                                                                     ...Muxing /

Creating Index...

DMFChecking: intro.avi 
DMFChecking: _menu-1.divx 
DMFChecking: _menu-2.divx 
DMFChecking: _menu-3.divx 
DMFChecking: main.avi 
Wine exited with a successful status
Before burning the file video.avi to a CD you may wish to check it with mplayer to make sure it didn't experience audio/visual desynchonization in the final remuxing. If it did you may need to use mencoder to reencode your DivX source file. Note that mplayer does not recognize the Ultra menus so it will simply play the feature file as if this were a regular avi file.


When I heard about DivX Ultra a few years ago, I thought I'd like it better than SVCDs for home video. Time has passed. I can now author a DivX Ultra file using genxmux and DivXmux.exe. However, h264 has better compression ratios while blank DVDs have become cheap and more compatible. It is difficult to know what DivX Ultra is good for. Moreover, documentation and tools that allow mplayer, ogle, vlc and xine to process the menus in a DivX Ultra file are still needed.

Since the above article was written, high-definition h264 video support has been included as part of DivX Version 7. If inexpensive DVD players start supporting this new DivX standard, then this may turn out to be the easiest way to watch and archive home video.

Last Updated: Sun Mar 27 22:12:05 PDT 2011