Code the Video Episode 2 : Encoding In XVID !


heyyy all,

i know its been a long time since i wrote the first encoding guide, the episode 1 : encoding guide in WMV,  Glad that everyone liked it :) . So i am back here with a more complicated codec called XVID, probably an successor of DIVX ( written in reverse).

i dont remember using XVID much, cause i was kinda lazy to first export the file as uncompressed avi and then encode it seperately using virtual dub :P , so i used to just output it as WMV, which i still like alot though. But lets try something different now. I am going to tell you how its actually done in a proper way, so that we can achieve the best possible quality on a given bit rate.

Lets get started,
the tools u will b needing are :

Virtual Dub
Sony Vegas(Recommeded, or any editing program will do)
Xvid Codec (Mandatory)
Huffyuv Codec ( Recommended, since it saves you alot of disk space)

Download links ( just in case u r too lazy to google around)

Virtual Dub :
Sony Vegas : Paid Software :P , u have to find the ways to get it urself :)
Xvid Codec :
Huffyuv Codec:

After u r finished installing all of these, lets get started. Though i already assume you have already finished editing stuff in your editing program like sony vegas, after effects or any other.
Our render process will be like this:

Sony Vegas ——> Render As————> Uncompressed Avi ( using Huffyuv )
Uncompressed Avi ————–> Render Using Virtual Dub ————–> to Xvid

i assume that u have finished editing ur video in vegas, as far as the example goes i will b using the screens from a clip edit i did for my friend Dante , his superb clarion ace on dust2.

now lets start the process: go to File > Render As , now as told in the process we will just b using vegas to export the file as Uncompressed Avi using Huffyuv codec . Make the settings as below :


Now i wont recommend using the default settings for render, lets do something more customized, click  CUSTOM button right in front of the template list.

Project Tab : Video rendering Quality: Set to Best
Video Tab : Make the setting as In the screen below.


Click CONFIGURE button in front of Video Format  and make settings as below

click OK.
AUDIO Tab :  the default settings r just fine, we r going to compress the audio anyways, so dont need to worry here.

CLick OK , and save ur AVI file to any location.

Rendering to XVID using Virtual DUB :

start virtual dub, which ever version u have, but virtual dub different versions have different locations of menu items , but i guess that wont b that big of an issue, i m using version 1.9.3 at the time of writing this tutorial .

go to FILE > OPEN video file and open the uncompressed or huffyuv compressed file in vdub. it will appear in the video preview panel vdub has, u can browse through the video here and check how good the quality of uncompressed avi is , our aim in encoding is to achieve the nearest possible quality to uncompressed.

Now for the main step go to Video > COMPRESSION
Browse down to the list, to XVID MPEG-4 Codec , and click on Configure button. Now for the main stuff :

Just pay really careful attention to all the setting we r going to do here, first of all we will be going for a Two pass Encoding and not a single pass one, reason: we get better quality this way. two pass encoding is done in 2 steps, first we need to manually run a ” Two pass – 1st pass” and after that the second one.

Make sure u select


Make sure u select :

Profile @ level : Unrestricted
Encoding type : twopass – 1st Pass
Quality Preset : User Defined

Now click More button in front of Profile @ level and make the changes as given in the picture above

then at the bottom , Quality Present, click More, in Motion Tab


and in the quantization tab:

click ok, we r finished with the profiling .

click ok once more and then 1 more OK

Now we r back to vdub main UI, go to File , and look fo something called, save as queue or add to queue, in my vdub version its in File > Queue Batch Operation > Save as avi,

now wait, this didnt start any render ?? right ?? , good we r on track, actually this process adds the first pass to render queue, this will get more cleare in the next step

now again go to : Video compression, select Xvid ,and click configure
now we need to  queue in a 2nd pass. make sure u have selected twopass- 2nd pass in encoding type .


and for the bitrate i m using 5000 kbps,m make sure the units r set to kbps and not kbytes, if its kbytes, click on tht button once, and then input 5000 as bitrate in KBPS.
bitrate will vary according to ur resolution , i used 960 x 600 i used 5 M and it gives fair enough file size with good quality, if ur resolution is more, keep bitrate high.

we r finished, click ok,
and go to File > Queue Batch Operation > Save as avi AGAIN, this will add another job in the queue, after 1 pass its going to run another pass over it.

once u have done that,

select job control from file menu or press F4, and click on start, and save the file, make sure u save the file at any other location and not with the uncompressed file, else it will get replaced, very childish error, but shud b avoided.


its going to take some time to render based on the size of ur file, booomm, we have encoded our movie as XVID :D :D ….

Any questions r welcomed in comments!!!!

Cheers :) the next tutorial will be on an eased out method of encoding in x264.

July 15, 2009 at 5:21 am | Tutorials | 2 comments

2 Responses to “Code the Video Episode 2 : Encoding In XVID !”

  1. showstopper says:

    nice tutorial there nemesis…pretty helpful for starters for sure…i use the same method and same settings mentioned above, bitrate a bit more higher for smaller clips where u dont need to care abt the size :)

    You could have also added an alternative method..Single pass .. since twopass can be pretty complicated for people who are new to vdub..single pass is also a good option …by giving a higher bitrate, but a tad lesser compression/higher filesize , but the desired quality and lesser render time….:)


  2. Niel Barasona says:

    Hey, Niel here. Just wanted to know a little bit more about the benefits of rendering Two pass vs. Single pass. Not so sure if you’ll reply to this as The last post was at July 16, 2009. But My email is

Leave a Reply