Current version

v1.10.4 (stable)


Main page
Archived news
Plugin SDK
Knowledge base
Contact info
Other projects

VirtualDub documentation: codecs

Codecs are third-party drivers that export compression and decompression services to Windows applications.
How do I manually add/remove/switch codecs?

Under Windows 95/98, codec entries are stored in SYSTEM.INI:

;VIDC.xxxx = yyyy, where xxxx is the FOURCC for the driver and yyyy is the name
;of the driver's DLL. The driver FOURCC does not have to be the same as the format,
;although the codec may get first shot at handling the format if they are the same.
;It is not unusual for codecs to handle simple formats other than their primary
;ones -- for instance, Huffyuv will act as a decompressor for YUY2/UYVY.

;16-bit codecs are stored under this group
VIDC.MJPG=CAPCDC.drv        ;miroVIDEO DRX MJPEG codec

;32-bit codecs are stored under this group
VIDC.MP43=mpg4c32.dll       ;Microsoft MPEG-4 V3
VIDC.MJPX=pvmjpg20.dll      ;Pegasus PICVideo (secondary MJPEG codec)

These entries appear in the standard Windows codec dialog in the same order that they are listed in SYSTEM.INI, so if you're irritated at seeing Cinepak by default just switch the order of the lines.

In Windows NT/2000, these settings are stored in the Registry, with the VIDC.xxxx part as the key and the driver name as the value.  Most codecs are stored in:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32

You may also find them in a subkey under:


Usually, after a change you only need to restart applications that use codecs, rather than having to restart the entire system.

VirtualDub told me my DivX codecs were hacked. Where can I find the originals?

First, keep in mind that this error message only applies to version 3 of the DivX codecs.  Version 4 is completely different (see below).

Microsoft has been improving their MPEG-4 codecs for some time; build 2700 introduced Microsoft MPEG-4, and when Windows Media Tools 4.0 beta appeared, version introduced the vastly improved V2 and V3 formats.  Unfortunately, by the time 4.0 final came out, Microsoft locked the driver in the final build so that it would only work with Windows Media Encoder.  DivX 3 is actually a copy of this driver with the lock hacked out, and the format tags changed to be distinct from the original.  The most popular version of DivX, 3.11a, is a pair of drivers that derive from Microsoft's and builds.  The "unhacked" version of DivX 3 is the Microsoft driver.

The problem with the Microsoft driver is that none of the final builds that are still being distributed (build 3920 is the latest of this writing) are unlocked for general use.  The DirectShow decoder has been basically unlocked, but it won't encode.  It's a shame that Microsoft won't unlock the codec, especially now that it's rather old, but since unfixed bugs remain in the driver it is probably best that people move on to other codecs.

As a side note, some crazy people have managed to figure out the differences between ISO MPEG-4 and Microsoft MPEG-4, and are now writing open-source decoders that mostly work for decoding MS MPEG-4 V3 content.  This is very, very good.

The DivX site says that DivX isn't a hack.

And you know what? We're both correct.

DivX 4.0 isn't really related to 3.11a.  It's a new codec that has been ramped up partly from scratch and partly from the MuMoSys reference code.  Another major difference is that while DivX 3.11a worked with Microsoft's version of MPEG-4, this codec is supposedly based on a basic profile of real, true, ISO MPEG-4, and its streams should be decodable with other ISO MPEG-4 libraries.  (I have not yet heard of anyone verifying this, however.)  Up until recently DivX 3 and 4 were totally distinct and could not encode or decode each other's formats; DivX 4.0 now has the ability to decode MPEG-4 V3 (DivX3) streams, although with occasional glitches.

Originally, the DivX 4.0 codec started as OpenDivX, with publicly available source code.  (It wasn't open source, at least in the sense of the Open Source Definition, due to problems with its license.)  However, DivXNetworks stopped releasing source code and thus the DivX 4.0 codec is closed-source like most other codecs.  This is why VirtualDub identifies DivX 4.0 files as OpenDivX.

Remember that the people who hacked DivX 3 out of MS MPEG-4 V3 didn't have the source code -- Microsoft wrote the codec.  The same work shouldn't be expected out of the DivX 4 team since they're different people, although it looks like they have a decent chance at surpassing the MPEG-4 V3 codec in quality.

As a side note, Microsoft helped write the MPEG-4 spec and some of the reference code, so even if you find "Microsoft MPEG-4 source code" on the Internet, it's not necessarily the code for the MPG4C32.DLL driver.

How come VirtualDub keeps switching back to Windows Media Audio when I choose DivX audio?

VirtualDub is getting confused because the two codecs are one and the same.

Like DivX 3.11a, DivX Audio is really a hack of the Microsoft Windows Media Audio codec (V1 or V2, depending on version).  Unlike the video codec, however, DivX Audio still uses the same tag as the original codec, so if you have both the original Microsoft codec and the DivX audio codec installed, VirtualDub cannot tell the difference between the formats of the two codecs.  The result is that when VirtualDub does an inverse lookup of the format to find its name, it will stop at whichever one it finds first.

DivX audio is unfortunately a very buggy hack, and has a tendency to die when you try to compress with it, depending on the exact format you choose.  Because of this instability and the conflict mentioned above, I recommend avoiding this codec even if legality is not a concern for you.  As with DivX video, you cannot switch to the original Windows Media Audio codecs because they too are locked against general use.

What's wrong with the AngelPotion Definitive codec?

AngelPotion Definitive isn't a new codec either -- it's yet another version of the Microsoft MPEG-4 V3 codec that someone modified to look original.  While this in itself makes AngelPotion an illegitimate codec, it's not the reason it should be avoided.

The AngelPotion codec consists of two parts, the .APL file that stores a packed version of the Microsoft codec, and the DLL that acts as an intermediary between the Microsoft codec and the application.  It turns out that this DLL has a major flaw in that, during certain calls, it modifies video formats passing through it to MP43 (MS MPEG-4 V3).  As a result, all codecs after AngelPotion during codec negotation see that format.  The effects of this can range from Windows Media Player's automatic codec download breaking, to some programs, notably Avisynth 0.3 and earlier, not decoding AVI files properly.  Since video formats flow through some or all installed codecs when format negotation occurs, this means that AngelPotion can break any video format in an application.

Because AngelPotion isn't actually a new codec, its format can be decoded with any other version of Microsoft MPEG-4 V3, simply by changing the two instances of AP41 in the AVI header to the FOURCC of another MPEG-4 V3 codec.  VirtualDub automatically attempts this during load as part of its codec equivalence mapping when a required codec is not found.  You may find that AngelPotion files load as Microsoft MPEG-4 V3 if you do not have AngelPotion installed.

I have a number of YUV codecs like YUY2, 4:2:0, etc. and none of them seem to work.

These are typically decompression codecs for formats that are generated during video capture.  The codecs don't do encoding because the actual encoding is done during video capture on the capture chip, and so it never needs to be done by the CPU.  Some other codecs tend to be installed by applications for playing back pregenerated video, and since they're not licensed for general use, they refuse to encode or even work at all outside of the application that installed them.  For instance, Eidos' PC port of Final Fantasy VII installs a decode-only version of the Duck TrueMotion codec.

Occasionally, you also might find some really, really old codecs that accept only 8-bit paletted video, such as Microsoft RLE.  VirtualDub cannot use these.

What is the "VirtualDub YUV codec"?

VirtualDub installs an internal decode-only driver into its own process when switching to capture mode, in order to enable YUY2 preview on systems that do not have one already installed.  It should not show up in practice and if it does, it's not usable for anything else.

Why hasn't anyone written an MPEG-1 codec?

A Video for Windows codec on the Windows platform is pretty simple: shove one raw frame in, get one compressed frame out.  Great fun for the whole family and works in reverse as well.  This means that audio and video codecs are separate, and in addition, the frame order must be progressive in the compressed stream.  Unfortunately, MPEG-1 uses a completely different file layout than AVI, and in addition, reorders I and P-frames relative to B-frames in display order.  The different file order makes it impossible to retrofit MPEG-1 support onto applications with codecs alone, and the frame order issue means you can't truly fit MPEG-1 video into AVI.

VirtualDub can read MPEG-1 because it has a separate code path for parsing MPEG-1 files and its own MPEG audio and video decoders.  Some of the more recent applications do so using DirectShow, but this tends to be sloooooowwwww.

My files are showing up as a different video format than the one I chose for encoding!

All that is stored in an AVI with regard to video format is a four-character code (FOURCC) that identifies the format.  The long name you see in most programs comes from the installed codec that is chosen to decompress the video.  If you have a Motion-JPEG file, for example, it might show up as miroVIDEO MJPG[16], Pegasus PICVideo MJPEG, MainConcept MJPEG, etc. depending on which codec is installed for the MJPG format at the time.

What codec should I use to make sure that everyone can play it?

It's rather depressing, but these are the only three video codecs that are available under retail Windows 95, without installing additional software:

  • Radius Cinepak
  • Intel Indeo R3.2
  • Microsoft Video 1

Cinepak is the best of the three, which isn't saying much.  MPEG-1 support did not become available until the introduction of ActiveMovie in Windows 95 OEM Service Release 2 (possibly OSR1 as well), at which time Indeo 4 is also included.