# How to create Xvid files from DV avi files in Windows
## Why?

Xvid files are often used to convert DVD files to fit on a CD. They are commonly used to put up big files on Indymedia or similar sites. The file size is quite flexible you can create files that are suitable for screenings which are between 3 Meg and 15 Meg per minute.

## You will need to install

* Virtual dub mod - http://sourceforge.net/project/showfiles.php?group_id=65889 - it has an installer for windows.
* Lame mp3 Codec - http://www.free-codecs.com/Lame_Encoder_download.htm [the stable version - to install unzip the *.zip file, find the lame*.inf in the file - right hand click it and select "Install"
* Panasonic DV codec -
http://www.free-codecs.com/download/Panasonic_DV_Codec.htm"
- Uncompress the files from pdvcodec.zip archive, right-click on the PANADV.INF file and select Install. - You may encounter a prompt saying: "The software you are installing for this hardware... has not passed Windows Logo testing..."; click on the Continue Anyway button. - You should now be able to load DV-AVI Type-2 files with VirtualDub (and any other program that loads AVI files).
* Xvid Codec - http://www.free-codecs.com/download/XviD_Media_Codec.htm - this also has an installer so it's easy to use.

## How to do it

Open Virtual dub Mod and open the DV avi file you have saved from your video project / or created from a DVD / or the avs/d2v file from using Gordian Knot.
File > Open [browse for the file]

### Video

Select Video > Compression .
You willl get a list of the different codecs on your pc. Choose Xvid which should be there.
Select Xvid and then Click on Configure on the right
To make this super easy we are going to do one pass encoding, and select a preset that looks ok for CDroms. At the bottom of the pages click Default Settings. Then click on the Target Quantizer Button.
This should bring up the next setting.
This datarate setting (700 kbps) is OK. It creates a file about 8-9 Meg for one minute of footage. But with modern broadband and computer speeds, we recommend 1600 kbps.
Click OK
Then you need to add a filter to de-interlace your video if it is interlaced - which is normal for dv avis exported from premiere or similar.
Click ADD and select the deinterlace filter.
When given an option select the "Blend" option.
Resize your clip, using the resize filter, as 640 x 480 for 4:3, or 800 x 480 for 16:9.

### Audio

Now we deal with the Audio. This is a "Stream" so we go to the Stream menu and select Stream list.
If your source video file has audio it should be listed as a grey bar with information as seen below. [if you are using Gordian Knot to do this process from a DVD you will need to click ADD and browse for the *.wav file created in that process]
Right hand Click on this bar and select "Full Processing mode".
Then Right hand click again and Select "Compression".
If Conversion is greyed out it's because you haven't selected full processing mode.
You get a list of audio codecs installed on your system, Click on Mpeg Layer 3 - which is mp3.
Choose 48,000 khz, and 128 kps, stereo as a standard thing. If you don't get enough options then you need a) click the show all formats box or b) reinstall your mp3 codec, get the LAME one, it's free.
Click OK, then OK again at the Stream list menu.
You are ready to save your file.
File > Save as Avi
Often it's a good idea to give it a full name for file sharing purposes with the codecs you used.
indymedia_russia_solidarity_action_2005_mp3_xvid.avi
This is to make it easier for other people to know if it is worth watching.

## More advanced Encoding

Below is a quick description of how to do 2-pass encoding with Virtual-Dub provided by Matthew Coulson:
* In the Xvid codec dialog, choose 2pass 1st pass. (Do this just before you are about to save the file). * Then, in VDub, select save as, type in any old filename, checkmark the box underneath that says "Add operation to Jobs List and defer processing", and click "Save".
* Now, back in VDub, go back into the Xvid codec, choose 2pass 2nd pass * Do the same thing to save it - type in the proper filename this time, checkmark the "Add to Jobs List" box again, and click "Save". * Now click on File, Job Control, and you should see the two jobs you've just created * Click on Start, and VDub will go off and process the two, and you'll end up with the two files specified.
* You can delete the first one, and keep the second. Compare it to a 1pass encode and you will notice the difference