Zaaba's Guide to MPEG to DivX *.avi encoding

***

VERSION HISTORY

13.05.2003 - Updated the guide
20.04.2003 - Finished the guide
20.04.2003 - Added graphics
10.03.2003 - Started writing the guide

A .txt no-graphics version of this guide can be found here.

A Spanish translation of the guide can be found here. Credits go to Gabriela. Thanks!
- http://usuarios.lycos.es/w3zonametal/foro/viewtopic.php?t=379

***

THE GUIDE

I wrote this guide because I got kinda lost in the millions of tutorials out there on the internet regarding audio/video conversion. All I wanted was a guide to tell me how to compress them big-ass mpeg tv-torrents I got off Bittorrent. One cd (700mb) could only fit 1 episode (of an 1 hr show) as a 1 hr episode like 24 or CSI on torrent sites are usually 400MB in size.

This guide:

1. Converts .mpeg files (or other compatible files) to .avi ONLY. You could try converting other file types to .avi using the same method, but I have not tested them myself. Feel free to contact me if you have discovered anything.

2. Was written with the program/codec versions below in mind. If you have a different setup, (as in the programs/codecs), can't be of much help unless they are explicitly mentioned here in the guide :P

This guide aims to:

1. Give you a basic tutorial to video conversion/compression using DivX.
2. Ultimately guide you to compress them big 400mb bittorent mpegs to < 230mb in order to fit 3 episodes per cd. (or more if you want...)

Note however, that this method may not provide you with best results if you want to encode DVD movies and fit them onto a single CD. There are other ways to do this in which these methods are heavily documented on the internet. Do a google search and you should be on the right track if DVD encoding is what you are looking for.

The following is a simple schematic on how the whole process works:

1. Calculate the DivX bitrate for conversion (varies with each file!)
2. Convert the file using VirtualDub to *.avi
3. Sync the video and audio if there are audio/video speech sync problems using Synchonizer.

This guide will not go beyond what is necessary to achieve the aims listed above. If you want a more detailed guide to video compression/conversion then you may find this guide too simple for you.

***

PREPERATION

You will need the following tools:

1. The DivX Pro codec (http://www.divx.com)
2. DivXCalc
3. VirtualDub
4. Synchronizer

There are many other programs/codecs out there on the internet that are also free and may offer better solutions to the problem you are facing. So far, these programs have worked for me and the results are VERY satisfactory. If it works for me, it *should* work for you.

You can get the above programs from http://www.doom9.org or http://www.divx-digest.com The latest version of the programs should be listed there so you don't run a risk of running outdated software/codecs. At the time I wrote this, this was my following setup:

Advanced DivX Calculator 1.6
DivX Pro Codec 5.03
NIMO Codecs (for the appropriate mp3 codec) http://nimo.everwicked.com/
VirtualDub 1.5.1
Synchronizer 0.8b

The installer files for the version above can be found at http://www.truedeath.com/programs/

(Edit 20.04.03: The only files on td.com are the DivX Calc, VirtualDub and Synchronizer. The codecs can be found at their respective homepages.)

NB: Please, PLEASE do not leech off td.com!

I'm not totally sure why I chose DivX as my encoding codec of choice. It was probably because of all the hype surrounding it and the talk that it really DID do wonders to video compression (hence the moniker "mp3 for video"). You can read up more about DivX at their homepage http://www.divx.com.

Also, note that the Pro version of the DivX codec is supported by Adware. If you choose not to divulge and make your computer susceptible to spyware, you can either purchase the Pro version off DivX's homepage for a paltry sum of USD$19.99 (10.03.2003) or crack it yourself :( A guide to disabling the GAIN software enclosed with the adware supported version can be found at Doom9's forums page: http://forums.doom9.org

(Edit 17.04.2003: I recently uninstalled my DivXPro Codecs and am using the KazaaLite Codec Pack DivXPro 5.03 codecs instead. These are *hacked* codecs and using VirtualDub with these codecs result in a nasty warning. Use at your own risk!)

***

METHOD

Right, on to the process.

By now, I assume that you've already got all the tools ready for the job.

First, open up VirtualDub. Select File > Open and select the video file you want to encode.

After the MPEG Import Filter has finished processing your file, select File > File Information.

Using the information as to how long the file is (given in mm:ss), open DivXCalc and input the length of the video file into the appropriate boxes.

Also, enter an mp3 bitrate value of 128 kbps. Why this is so I don't really know. What I DO know however is that the compression rate gives us audibly acceptable audio so I guess you can't go wrong with this value. Any larger and the end result file gets bigger, or the video quality gets sacrificed. For the diskspace value, enter a value you want for the max file size to be. I enter 230MB because that ensures that on a 700MB disc, I'd be able to fit 3 200+MB .avi files onto it which is pretty reasonable.

Click on Find next to the bitrate video to get your bitrate value. You can always use the "Always add on top" or "Add % to video bitrate" to tweak this end value until you're satisfied. Conversely, you can do this the other way around. Say for example you are wanting to compress the video to a certain quality, you'd be able to calculate how large the end file size is going to be under a certain mp3 and/or video bitrate .

Now that you have this value, go back to VirtualDub.

Select Audio > Full Processing Mode

Then reselect Audio > Compression

If you have the NEMO Codecs installed, you should be able to select the MPEG Layer-3 type compression with the 128 kBit/s, 44,100 Hz, Stereo, 16KB/s option. If you have another type of audio codec that you wish to use, you may also do so. I personally have not experimented with the other codecs and I do not know the results that ensue... but as I said before, this works for me so it *should* work for you. Next, press OK.

(Edit 17.04.2003: If you have the KazaaLite Codec pack installed, you do not need to install the Nemo codecs. I personally find the KazaaLite codec pack to be more complete in which it provides a larger range of audio codec options available to you)

On the Video option, make sure that the Full Processing Mode option is selected. Why this is so I do not know. You can probably read more of the many other options VirtualDub has to offer in the readme or off Doom9.org.

Select Video > Compression

Then select the DivX Pro 5.X.X Codec. Next press Configure.

If this is your first time tweaking with the codec settings, then all you need to do is enter the value obtained from your earlier calculations using DivXCalc into the Encoding bitrate box. Then press OK. I did not see any need for further tweaking/changing of settings. The obvious next step would be to click OK, then OK again.

To convert the file, just select File > Save as avi (or press F7). Here, you have the option to immediately start converting your file or add the job to job control to run it later. I would suggest the latter if you are going to leave your computer on overnight (what I always do). File conversion takes fucking long to do and the process tends to eat up quite alot of processing power which might slow down your computer if you multitask.

Name your file and click save. Or, you can run job control by checking the checkbox under the file menu or by pressing F4. By adding the file to jobcontrol, you are effectively 'queueing' up the file conversion process. Handy when you have alot of files to convert and you want them all done in one go rather than manually inputting each value individually after each file is done.

Now just wait... and wait... and wait... until the encoding process finishes.

Once your file is ready, open it up to see if the audio and video syncs.

If yes, yippie! You should now be a proud owner of a relatively tiny sized file compared to before. If not, proceed to the next part:

***

SYNCHING

The Golden rule of Audio/Video synchronisation is: NEVER LOSE YOUR SOURCE FILE. Remember *always* to keep a backup of your original file. Synchonizer is *rather* unstable and assigns tricky values to your file. If you fuck up, your entire file is lost and you may need to reencode... don't think we want to walk down that road do we?

First thing to do is to open the file. This should be fairly straightforward.

Then Test the .avi file to see if it syncs using the Preview tab. Obviously, you wouldn't be here if it did.

On the Synch Tab, copy the suggested framerate and then click on the Test button. Normally, this is all you need to do to ensure that the audio and video synch. Make sure you check the beginning, middle and the end of the file to make sure that the new framerate does cause the video and audio to sync in the right places.

If the suggested framerate doesn't work, then you will have to change the framerate manually. This is done by manually increasing/decreasing the framerate until you reach the magic number. This is entirely trial and error so you need to have a real knack for meticulous testing if perfection is what you're looking for.

I usually enter a really large number followed by a significantly smaller number to get the appropriate range of the magic framerate number. Adjust your figure between these numbers, judging by whether speech is faster than the video and vice versa. Sometimes you'll be able to get the number fairly fast. Most of the time you'll just have to be patient.

Once you're done testing the file to see if the synch works, just close the program.

And that concludes the guide. Good luck and happy compressing!

***

LINKS

Here are a few sites to get you started!

- http://www.suprnova.org
- http://www.indianpride.us
- http://www.torrense.cx
- http://bittorrent.bounceme.net

And the uber site for torrent links (at present and to my knowledge). The site below keeps an updated list of the mirrors/temp links of the sites above.

- http://www.bittorrentsites.co.nr/

***

- This guide (©) Reza Baharin @ Zaaba 2003
- Please do not take anything out of this guide nor pass my work as your own without my expressed permission. Translators welcome!
- Reach me via email: zaaba at hotmail dot com
- http://www.truedeath.com