- Buy Video Games for Consoles and PC - From Japan, Korea
and other Regions!
Need service manuals for your car? Or perhaps Hyundai Hi-Scan Pro emulator?

avi2divx and mpeg2divx

THESE TOOLS ARE OBSOLETE. USE mencoder OR transcode. Uli 2003/07/10.

These are some tools I hacked up that are able to convert all(?) AVI and MPEG files to AVIs with DivX ;-) video and MP3 audio.

They are based on two great libraries that enabled me to complete the first version of avi2divx in one long night and mpeg2divx within an hour or so.

avifile allows you to use Windows AVI codecs under Linux/i386 and is just as powerful as undocumented.

libmpeg3 enables you to decode just about every kind of MPEG stream with a minimum of effort.


new release 0.10a
Here's a bugfix release almost entirely done by our man JPC. Building should be a lot easier, and the -A and -V options in mpeg2divx might even work now. See the ChangeLog for details.
As you may have already noticed I don't have much time for this (or any other) project. The reason for that is that I'm taking correspondence classes in CS, which, along with my job, gives me a 60-hour week.
As a side note, I did a port of the FCE Ultra emulator to the Qtopia palmtop environment. Runs fine, but I don't have time to polish it for a release or to update it to a recent FCEU release. If you would like to continue with this project, tell me and I'll send you the sources.

new release 0.10
I hacked this up in some three hours, so don't expect too much...

  • nasty memleak stuffed (it only recently showed up here, but some people have reported it ages ago)
  • new option --startframe (thanks to Yves)
  • new option --skipvideo (Yves again)
  • preliminary OpenDivx support (only works with divx.dll Win32 codec, Divx4Linux fails unless I remove the fix for the aforementioned memleak...)
No binaries this time, doesn't make sense until avifile 0.6 final is out.

x2divx mailing list
lots of people keep sending me lots of code, and most of it is rotting in my inbox. As a quick fix I've created a mailing list. Send mail to to subscribe.

brown paper bag release 0.9a
Ouch. 0.9 didn't build with avifile 0.6 unless you had an old version flying around. This one should.

new release 0.9
I've been really lazy for the last couple of months, but I finally managed to get myself together for a few hours, so here it is: a brand new release! Most stuff has been done by JPC, thanks a billion!

  • option parsing now done by getopt (JPC)
  • tons of bugfixes (mostly JPC)
  • port to avifile 0.6 (Athos and me, should build with both 0.53.x and 0.6)
  • new options "-k" (keyframe rate), "-C" (crispness), both only with avifile 0.6 (Athos)
  • no longer ships with libmpeg3, you have to get that seperately from now on
Binaries have been built against avifile 0.6 CVS. Have fun!

new release 0.8
People have been showering me with patches, so there's quite a number of new features in this release:

  • real scaling support replaces decimation (thanks to Hans Fuchs)
  • 5.1 downmix support for mpeg2divx (untested, ported from xmovie by Cyclic) replaces "-l" and "-r" options
  • SMP support for MPEG decoding (thanks to Joakim Verona)
  • code cleanups and Makefile fixes (thanks to Jan Tomasek)
  • possibility to chose different audio and video streams in mpeg2divx (untested, again thanks to Hans Fuchs)
The binaries have been built against avifile 0.53.4 on SuSE Linux 7.1. x2divx now ships with libmpeg3-1.2.3, this should fix problems some people have with compiling it on newer distributions. Have fun!

more MJPEG fun
It seems that the m3jpeg32.dll contained in the file on the avifile homepage doesn't work. So if you get segfaults when trying to encode MJPEG AVIs, go get the old codec at Morgan Multimedia's site. It's an EXE file, but it can be unpacked under Linux using unzip. Copy the M3JPEG32.dll in it to your /usr/lib/win32 directory (make sure you get the case right, it should be all lowercase) and everything should be fine again. Thanks to Marcel Janssen for pointing out this one.

new release 0.7a
This release doesn't actually have anything new other than that it now builds against avifile 0.53.1. If you're using version 0.51 I strongly recommend to upgrade since 0.51 has some serious bugs that also affect x2divx.

new release 0.7
OK, here's the release that works with (and only with) avifile 0.51. There's also a new patch that solves a problem 0.51 is having with the Morgan MJPEG codec. Apply it if avifile keeps saying that the codec doesn't support 16 bit output (which you don't need for avi2divx).

about avifile 0.51
x2divx currently does not work with the new version 0.51 as it's missing some important methods (namely SetDirection() and SetBitDepth()). I'll look into it as soon as I find some free time.

bugfix release 0.6a
another fix for encoding single audio channel MPEGs with mpeg2divx (sound plays too fast). Thanks to Marcel Ritter for pointing out that issue.

new release 0.6
includes fix for bug reported by Morten Berg and others that breaks audio on input MPEGs with more than two channels
new feature allows to specify an offset for black border clipping

old news

Important note for Pentium III and Celeron/Coppermine users:

The DivX ;-) codec used by avifile autodetects the type of CPU you have and tries to use SSE instructions if available. This, however, is only supported by 2.4 kernels, so you'll probably have to upgrade to get my tools working. With a 2.2 kernel you'll get an "Illegal instruction" error.


Note: All this only applies to avifile versions older than 0.6.

Version 0.50 of avifile comes with a proof-of-concept open-source MJPEG codec which is extremely buggy. I suggest you delete it ( from /usr/lib/win32 so avifile will use the Morgan Windows codec instead. Note that for this to work m3jpeg32.dll has to have the right permissions, so if it doesn't work, do a "chmod 644 /usr/lib/win32/m3jpeg32.dll".

You should also know that the version of m3jpeg32.dll contained in has expired on 2000/11/01. If you want to use it you need the shareware workaround patch for avifile 0.50 and up from the download section.

For avifile 0.51 to 0.53.1 you also need the 16 bit patch.


Both tools are licensed under the GNU Public License v2.


x2divx-0.10a sources

x2divx-0.9 binaries

Patch for bitrate problem in avifile 0.50 and 0.51; not necessary for current versions

Shareware workaround patch for avifile 0.50 to 0.53.1. This should make the Morgan MJPEG shareware codec run 'til judgement day.

Patch removing 16 bit output check in avifile 0.51 to 0.53.1 that makes the MJPEG codec (and maybe others) fail even if you don't need 16 bit; not necessary for current versions

Other stuff you need

The avifile library. Don't forget to download and install the Win32 codec binaries, too.

libmpeg3 is statically linked to the binaries and included in the source distribution, so you don't need to download it separately. Anyway, here's the libmpeg3 homepage.

Contact me if you have any suggestions or patches or want to give general feedback.

Back to