Questions and Answers

Codec Development

Is there documentation about Xvid and its algorithms?

Honestly, documentation could indeed be better. But nobody likes writing documentation, isn't it? The Xvid source code itself and in particular the Xvid API ("xvid.h") are quite well documented and documentation can be extracted with doxygen. Also, there's some lean instructions on how to compile the code in the "/doc" folder.

The DirectShow / MFC filter doesn’t compile. I’m getting lots of errors – what to do?

Make sure you have the Windows Platform SDK installed on your development host. This includes the DirectShow SDK, which is needed to compile the Xvid DirectShow filter. Make sure you also compile the DirectShow baseclasses lib (which is in the samples dir of the SDK) because the Xvid filter links against it.

How should I start if I want to work on the codec and participate in development?

If you seriously want to work on the codec you should first get some background on video coding. Do some read up on the internet how block-based video compression works. Once you feel you have a solid understanding you should begin studying the Xvid source code and take a look at the API documenation. You should also subscribe to the xvid-devel mailing list where you can discuss your ideas with other Xvid developers or post your contributions.

I have problems compiling the asm files – what shall I do?

Make sure you have the latest version of nasm installed for your platform: If you still get experience issues and you try to compile for a rather new platform/OS you may require the latest vcs version of nasm. Alternatively, you can try yasm instead: If both doesn't help please report your problem at

Are there instructions available on how to compile Xvid with my compiler?

Have a look at the INSTALL readme file that comes along with Xvid in the "/doc" folder. It describes how to use the Xvid build scripts to compile Xvid with gcc under Linux or MinGW/CygWin on Windows. Xvid can also be compiled with the Microsoft Visual C++ compiler using the provided project files the "/build/win32" directory. For other compilers you’re pretty much on your own. It should not be very difficult however to make the code compile with a different compiler.

How can video quality be further improved?

Mainly, picture quality depends on the quality of decisions taken by the encoder. Such decisions include finding good motion vectors and modes for each macroblock, determining the best coding types for each picture and the best quantization parameters per macroblock. Hence, picture quality is mainly influenced by motion estimation algorithms, R-D optimizations and bitrate-control. If you’re interested in improving video quality, you should have a look into these algorithms and try out your new ideas.

I've cross-compiled Xvid for a new platform but it runs quite slow – what can I do?

First of all: Processing digital video is a demanding task and requires lot more resources than e.g. audio coding. So it’s probably not unexpected at all that Xvid, especially the encoder, does not run fast on your new platform.

If you think it’s running slower than it should the cause could be that Xvid’s assembly optimizations are not active on your platform. A common reason might be that your target platform uses an instruction set not supported by Xvid's hand-tuned assembly optimizations.

In this case you could try writing optimized code for your platform yourself to speed up the performance. Typical bottlenecks for video decoding are the inverse transform, motion compensation and dequantization. For encoding, calculating the sum of absolute differences (SAD) in motion estimation is a well-known hotspot that needs lots of computational resources.

Application Development

How can I interface with the Xvid codec?

That depends on the platform you develop your application for. On all platforms, you can statically or dymically link against the xvidcore library and interface to it via the Xvid API (refer to the "xvid.h" API header file in your copy of the source code). Under Windows, you can also access Xvid via the Video for Windows (VfW), DirectShow or Media Foundations framework APIs. Under Linux, Xvid has been integrated into MPlayer/MEncoder, FFmpeg or the GStreamer framework. So you may interface with the Xvid codec also through these frameworks.

What's the best interface for my application?

That depends on your application and your specific goals and requirements. Interfacing via the Xvid API provides you the greatest flexibility and platform independence. You could port your application easily to a new operating system and would just have to recompile the xvidcore library. Access through other interfaces is OS dependent. So VfW access will obviously only work under Windows but could make things simpler and may allow you to more easily support also other codecs besides Xvid from your app.

Is there a API documentation available?

Yes, but it could be better. The Xvid API is documented in-line in the "xvid.h" header file (it can be extracted with doxygen). Also, the xvid_decraw and xvid_encraw example programs demonstrate the use of pretty much all xvidcore library features.

What's the legal implications from using your code?

The Xvid code is released under the terms of the GNU General Public License (GPL). Please refer to the License subsection of this FAQ for more information on the license and its practical implications.

What are the best codec settings to use with my application?

That depends and cannot easily be answered. It depends on the use-case of your application. E.g. if you aim at live broadcast of video, selecting the two-pass mode obviously won't make any sense for you. In general, you should select one of the predefined profiles that comes closest to your use-case and adapt the settings from there. Have a look at the "xvid.h" API header file and corresponding docs for more info on the Xvid de- and encoder options.

What should I watch out for to reach the best performance with my app and Xvid?

Xvid internally operates in YV12 colorspace format. So if any possible you should try to work with this colorspace also in your application (e.g. capture video in YV12 format from a camera or render YV12 video directly to the screen) to avoid unneeded colorspace conversions. Such conversions are costly and reduce overall performance. Also, you should try to avoid unnecessary memcopy of picture data and instead better exchange pointers to your input/output buffers with xvidcore.

How can I learn more on what all those settings / API options mean and what effect they have?

Read the API documentation. Also, have a look at the example applications as a reference on how the API can be used and what settings (and defaults) generally make sense. If still in doubt, run some test with different settings on your own to determine which values are good for your use-case.

For what use-cases is the Xvid codec a good choice?

Xvid has been developed with high quality in mind. Hence, the Xvid encoder is especially good at offline, multi-pass compression yielding output files good for efficient storage or quick transmission over network. A single-pass, real-time capture mode is also implemented in Xvid but optimized for high picture quality rather than low-latency.

Open-Source License

Under what license is the Xvid source code published?

The Xvid code is released under the terms of the GNU General Public License (GPL). The GPL is a copyright license that – opposed to other such licenses – grants receivers additional freedoms, like e.g. a redistribution right as well as a right to make modifications to the Xvid code.

There are requirements however: Among others, the GPL requires modified or combined/derived works to be distributed as a whole under the terms of the GPL as well. Refer to the GPL license text, which is included with your copy of the Xvid source code, for more detailed information.

I heard Xvid is free and open-source – so that means it’s public domain?

No. Just from the fact that the source code of a software is available you cannot conclude about the license under which it's distributed. Open-source projects may distribute their code under one of many, diverse open-source licenses. Actually, it's rare source code really is released into public domain. Unfortunately, the different license terms behind different open-source projects are often not well reported.

The Xvid code is not public domain. It is copyrighted and published under the GNU GPL license. Refer to the license text for more detailed information. Note that redistribution of Xvid is permitted only under the terms of the GPL. Infringements are prosecuted by the copyright holders as would be the case also for any other copyrighted work.

Are the Xvid name and logo licensed under the terms of the GPL as well?

No. The GPL is a software license and covers the Xvid program code only. The Xvid name and logo are trademarks and registered trademarks worldwide. As a recipient of the Xvid source code, no rights to use the Xvid name or logo are granted to you. If you'd like to use the Xvid name or logo including but not limited to e.g. use it for advertising your software, service or product, you'll need to obtain permission from us prior to any such usage.

Can I distribute Xvid together with my proprietary program?

If your program calls upon Xvid functionality at run-time it is a derived work and hence, the terms of the GPL apply to the work as a whole including your program. So no, you cannot distribute Xvid together with your proprietary program then. If you want to distribute, you’ll have to publish your program under the GPL as well. This also requires e.g. the provision of the full apps source code. Refer to the GPL license text for more information.

We don’t link to the xvidcore library directly, just call it via the VfW interface upon run-time – can we distribute Xvid with our proprietary software?

No. It doesn't matter in which way you link to Xvid or what you consider as linking and what not. The GPL doesn't focus on the term 'linking' at all but rather requires that combined/derived works are published as a whole under the terms of the GPL. Basically any two (or more) pieces make up a combined work when they are distributed for use in combination. Hence, if your program calls upon Xvid functionality at run-time it would make up a derived work - no matter how you technically implement the calls to Xvid. If you don't want to publish your program under the GPL then simply refrain from distributing it in combination with Xvid.

I've seen others distributing Xvid together with proprietary software – so why do you not simply release it all under BSD license? If you don't I will bundle it with my proprietary program anyway!

A key goal of the Xvid project has always been to trigger the further creation of Free Software. Consequently, Xvid is released under the terms of the GPL to allow free distribution and combination with other GPLed programs – but only GPLed programs. Hence, we do not consider publishing the Xvid source code under any other open-source license than the GPL. It is unfortunately true that there have been also violators who don't respect our copyright and the GPL license. But we strictly prosecute GPL violations. Anyone who deliberately violates the GPL will realize soon enough that it'll get him in trouble.

Does the GPL allow Xvid to be used with closed-source apps like Windows Media Player?

Yes. Usage, so the act of running a program, is not restricted by the GPL license under which Xvid is published. So you can use the Xvid codec with whatever other program you want. Just distribution of Xvid together with proprietary software is restricted. Refer to the GPL license text for detailed information.

Can I distribute Xvid on my media/video CD/DVD?

Yes, you can - provided it's really just a media CD and you don't intend to distribute Xvid together with proprietary programs, like e.g. a video player. If you distribute Xvid, make sure to fulfill the requirements of the GPL, which e.g. includes distributing a copy of the GPL text along with Xvid. If you want to distribute a binary version of Xvid, you should add a copy of the matching Xvid source code to your distribution.

What should I do if I want to redistribute Xvid as a separate package under GPL?

You should comply to the requirements of the GPL for redistribution. This e.g. includes providing a copy of the GPL license text and offering a copy of the corresponding Xvid source code in case you distribute a binary version. Refer to the GPL license text for more information.

Can you not just release Xvid under BSD license? We'll make you guys famous then!

No, thanks. We've expressed before why we prefer the GPL. Switching to another open-source license than GPL is nothing we would currently consider.

Can I link and distribute Xvid together with another GPLed application?

Yes, you can. We created Xvid to be used with other GPLed programs. Just make sure that the app or package you intend to distribute is really licensed as a whole under the GPL or a compatible license (like LGPL). Sometimes, dependencies of an application may be published under a different, incompatible license. This could then pose a problem for combined distribution. If in doubt ask at

What are the requirements for my own application if I release it under GPL too?

If you decide to release your program under GPL it'll impose providing access to the full source code of your program. It also means recipients will be granted a right to redistribute your program, to make modifications to it or to create a new work based on your program. For more info read the GPL license text or visit

Can I use the Xvid encoder to create video for my commercial website or computer game?

The GPL does not restrict the act of running a program. Hence, you can certainly use the Xvid encoder to create video for whatever purpose. As long as you don't distribute Xvid or parts of the Xvid source code you won’t be running into any limitations stemming from the GPL license. You also don't need to obtain any further permission from us.

Can I freely distribute videos created with Xvid? Or is such video also covered by the GPL?

You can freely distribute it. The output or result from running a program is not covered by the GPL license. Hence, video encoded with Xvid is not subject to the terms of the GPL. Note however that you of course can only distribute videos where you hold the copyrights or where you have permission to distribute from the copyright holders. But that has nothing to do with Xvid and should go without saying...

Can I port to and distribute Xvid together with my embedded device?

That depends. You can port the Xvid code to new hardware without requiring any specific license. You are permitted to make modifications to the Xvid source code and running Xvid on your device is not restricted by the GPL, so you may demo your port in-house. As soon as it comes to distribution, you should be aware that all modules you distribute together with Xvid intended for use in combination will be considered a derived work and covered by the terms of the GPL as a whole.

So if you e.g. want to distribute a software player that uses Xvid at run-time for video playback it will be covered as a whole by the GPL. It means that the player application and all other modules (like e.g. other video decoders, demuxers or audio codecs) must be distributed under the terms of the GPL as well. If you can meet these requirements you'll be able to distribute your hardware/software together with Xvid. If you can not or are unsure plese write us at and let's dicuss your project.