Codec Development

Is there documentation about Xvid and its algorithms?  

It’s always in progress. Have a look at the doc files that come with the Xvid source package. The Xvid source code is also well commented.

How should I start if I want to work on the codec and join the dev team?

If you seriously want to work on the codec you’ll first need some background knowledge on block-based video compression. Have a look at the Links section for a list of links to useful information. Once you feel you have a solid background you should download and study the Xvid sources and have a peek at the more Xvid specific documentation. 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 to do?  

Make sure you have the latest version of nasm installed for your platform: http://nasm.sourceforge.net If you still get experience and you try to compile for a rather new platform you may require the latest cvs version of nasm or should try yasm instead http://www.tortall.net/projects/yasm/ If both doesn’t help you should report your problem at xvid-devel@xvid.org.

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

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

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

Make sure you have the DirectX SDK installed on your development host including the DirectShow SDK. Xvid’s DirectShow filter has been developed using DirectX 8 SDK but also successfully compiled with DirectX 9 and DirectX 10 SDKs.

I’ve compiled Xvid for a new platform but it runs very slow – what can I do?  

First of all: processing digital video is a very demanding task and requires magnitudes more resources than e.g. audio processing. So it’s probably not concerning at all when Xvid, especially the encoder, doesn’t run very fast on your platform. If you really believe it’s running slower than it could then the cause could be that Xvid’s assembly optimizations are not used on your platform. A common reason is that your target platform uses a unsupported instruction set so that no proper assembly optimizations are available. In this case you could try writing optimized code for your platform yourself if you wish to speed up the performance. Typical bottlenecks for video decoding are iDCT, motion compensation, dequantization and mem I/O. For encoding, calculating the sum of absolute differences (SAD) is a very commonly called function requiring lots of computational resources.

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 coding types for slices and quantization parameters for macroblocks and slices. Hence, picture quality is mainly influenced by motion estimation algorithms, R-D optimizations and rate-control. If you’re interested in improving video quality, you should have a look at these algorithms and try out your new ideas.

App Development

How can I interface with Xvid?  

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 through the Xvid API (refer to xvid.h API header in your copy of xvid source code). Under Windows, you could also access Xvid via Video for Windows (VfW) or DirectShow interfaces. Under Linux, Xvid has been integrated into MPlayer/MEncoder, Transcode or GStreamer architecture. So your application could interface with Xvid also through these frameworks.

What’s the preferred interface for my application?  

That depends on your application and your goals and requirements. Interfacing through Xvid API provides you the biggest 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 are OS dependent. So Video for Windows access will only work under windows but could make things simpler and allows you to more easily support also other codecs besides Xvid.

Is there a API documentation available?  

Yes, but always in progress. Watch out the documentation section.

What are the best settings to use for my applications?

That depends and cannot easily be answered. It depends on the intended use of your application. E.g. if you aim at live broadcast of video, selecting the two-pass mode 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 the API docs for more info on the Xvid de- and encoder options.

How can I learn more about what the settings/API options mean and what effect they have?  

Read the API description. Also, have a look at the example applications as a reference on how the API can be used and on what settings make sense. If still in doubt, test yourself which settings are good for you.

What’s the legal implication from using your code?  

The Xvid code is released under the terms of the GPL license. Refer to the license subsection for more information on the license and its implications on you.

For what use-cases can Xvid be a good choice?  

Xvid has been developed with highest quality in mind. Hence, the Xvid encoder is especially good at offline, multi-pass compression for storage or archival purposes. A one-pass, capture mode is implemented too but also optimized for high picture quality and not necessarily targeted towards very low-performance platforms or low-end PCs.

What should I watch out to reach highest-possible 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 in your application too (e.g. capture in YV12 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 unneeded memcpy’s on picture data and instead better exchange pointers to your input/output buffers with Xvid. Especially for HD resolutions, such mem I/O can be costly.

License Questions

Under what license is Xvid 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 within 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?  

Not at all. Just from the fact that the source code of a software is made publicly available you cannot conclude on the license under which it’s distributed. Popular open-source projects are distributed under licenses with highly varying license terms and actually very seldom source code is really released to public domain. Unfortunately, the different license terms behind open-source projects are often not well distinguished in public media.

Xvid is not public domain. The Xvid code is copyright protected and published under the terms of the GNU GPL license. Refer to the license text for more detailed information. Distribution of Xvid is only permitted under the terms of the GPL license. Illegitimate distribution is prosecuted by the copyright holders like with any other copyrighted works.

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 source code only. The Xvid name and logo are trademarks or registered trademarks worldwide. As a recipient of the Xvid code, no rights to use the Xvid name or logo are granted to you by the GPL. If you'd like to use the Xvid name or logo including but not limited to e.g. advertising your software, service or product, you'll have to seek written permission from us prior to any such usage.

Can I distribute Xvid together with my proprietary program?  

If your program calls Xvid functionality upon run-time it’s 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. That 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 Xvid at all, just call through the VfW interface upon run-time – can we distribute with our proprietary software?  

No. It doesn’t matter in which way you link to Xvid or what you count as linking and what not. The GPL doesn’t focus on the term ‘linking’ at all but rather requires combined/derived works to be 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 refrain from distributing it in combination with Xvid.

I’ve seen others distributing Xvid with their proprietary software too – so why don’t you simply release it under BSD license? If you don’t I will distribute it with my proprietary program nonetheless!  

A key goal of the Xvid project is to trigger the further creation of Free, GPLed software. Consequently, Xvid is released under the terms of the GPL to allow free distribution and combination with other GPLed source code – and only GPLed code. Hence, we will not publish the Xvid source code under any other open-source license. It is true that (as with everything in life) there are violators who don’t respect copyright and the GPL license. But violations are prosecuted by the copyright holders. If you choose to violate the GPL on purpose you will realize soon enoogh that illegitimate distribution of Xvid will get you into trouble.

Is it allowed to use Xvid together with MS 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 Xvid 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?  

Yes, you can - provided it’s really just a media CD and you don’t intent to distribute Xvid together with a proprietary application, like e.g. a player. If you distribute Xvid, make sure to fulfil the requirements of the GPL, which means e.g. to also distribute a copy of the GPL along with Xvid. In case you want to distribute a binary version of Xvid, you should also add a copy of the corresponding Xvid source code with your distribution.

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

You should comply to the requirements of the GPL for distribution. That’s e.g. including a copy of the license text and providing 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 I port to and distribute Xvid with my embedded device?  

That depends. You can port the Xvid code for sure without requiring any specific license or being limited by obligations from the GPL. You are permitted to make modifications to the Xvid code and also the act of running the program is not restricted by the GPL, so you could e.g. present or demo your port internally. 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 a derived work and covered by the terms of the GPL as a whole. So e.g. if you want to distribute a software player that uses Xvid upon run-time for video playback it will be covered as a whole by the GPL. That 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 hardware/software together with Xvid. If you cannot or are unsure write us at info@xvid.org and let's dicuss your project.

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

Oh yes, you can. Xvid was created to be used in other GPLed applications. 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, parts of an application are published under a different, incompatible license. This could then pose a problem for combined distribution. If in doubt ask at info@xvid.org.

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

If you decide to release your program under GPL it will mean to provide 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 or to create a new work based on your program. For more information please read the GPL license text and visit http://www.gnu.org

Can I use the Xvid encoder to create video for my website or for my computer game? Or does it require paying a license fee?  

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 Xvid source code you won’t be running into any problems with the GPL license and you also don’t need to ontain any additional license from us.

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

Yes, you can. The output or result from running a program is not covered by the GPL license. Hence, videos created with the Xvid encoder are 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 you release Xvid under LGPL? We’ll make you big then… 

No, thanks. We’re happy the way things are, so we won’t switch to another open-source license than GPL.

Codec Voting

Should Xvid be more easy to use for video streaming in a home network or the web?
Yes, that would be great
No, I want only local file playback
I don't know

Xvid Newsletter

You want to be always up to date? Be informed about new features and the latest Xvid releases: just enter your e-mail address below and subscribe to our newsletter!