Return to Main Page

Encoding High Quality Divx Movies



Ever wonder how to make those movies you download? It takes a bit of work, but you can easily learn to do it yourself in a short time.

(We are not responsible for any laws you violate while using our guide; it is intended for legitimate backups of DVDs you already own.
With current legislation, it is impossible to know exactly what is legal without a lawyer, and we don't claim to.)


Required Programs

DivX Pro Codec (http://www.divx.com/divx/?src=toptab_divx_from_/index.php)
Razorlame (www.free-codecs.com/download/RazorLame.htm)
GordianKnot Package (contains DVDDecrypter, VirtualDubMod, and DVD2AVI as well) (www.download-freeware-shareware.com/Freeware-Multimedia.php?Type=12264)
Bitrate Calculator (www.divx-digest.com/software/advanced_bc.html)
ASPI Drivers (www.ncf.carleton.ca/~aa571/aspi.htm)

Installing DivX

  1. Run the installer.
  2. Open task manager (control+alt+delete) and kill the “trickler” process.
  3. Start – run – regedit, search for trickler in the entire registry, delete any files found.
  4. Find your divx installation folder, and delete the “trickler” file there.

Installing ASPI

  1. Assuming you have Windows XP, the only OS worthy of my attention, simply run ASPIINST.EXE and you are set.

Installing Gordian Knot package

  1. Install Gordian Knot, VirtualDubMod, Avisynth Plugins, DVDDecrypter, and DVD2AVI 1.76 Commandline

Installing everything else

  1. Just follow the instructions, the rest are pretty much self-explanatory.
  2. Razorlame does not need to be installed, merely unzip the files.


Ripping: DVDDecrypter

Open DVDDecrypter. It should recognize your DVD drive, the DVD, and immediately select the correct part of the DVD. It almost always selects the correct track for ripping, and I would just leave it be until you have gone through the whole process a few times and know what you are doing. Choose your rip directories, and click the “disk to hard drive” icon to begin. An average movie, about 2 hours in length, should take approximately 15 minutes to rip with a P4 2.2 or an AMD 2100+. The ratio of encoding time to processor speed scales properly, so you can figure out the time for your rip using any processor, if you like. It will create VOB files 1GB each, so make sure you have sufficient space before you start. A typical DVD requires about 5-7GB.


Ripping Audio: DVD2AVI

Open DVD2AVI. Go to Audio, Dolby Digital, and select Decode. Go to Audio, MPEG Audio, and select Demux. You only have to set these values one time (when you install the program). Also, I would recommend going to Audio, Normalization, use normalization at value of 98. This levels the volume so you don’t have to turn your speakers way up to hear your movie. Now go to File, Open, and pick the first of your VOB files you made with DVDDecrypter. It will select the others automatically. Click OK. Go to audio, track number, and select track 1, which so far has always been the correct audio track in my experience. Now go to File, Save Project, saving it the same place you ripped the DVD for convenience. It creates a WAV audio file, 800MB to 1.5GB for a typical movie, taking about 5-10 minutes for an average movie with the computer specs I mentioned earlier. While it is working, it displays the aspect ratio in the top right corner. Remember this for later.


Setting Your Video Resolution: Gordian Knot

Open Gordian Knot. Go to the Resolution tab. Click Open in the lower left corner, and select your D2V file you created in DVD2AVI. A new window displaying the video will show up. Check resized in the view menu of that window, then go back to the main window.

In the "input resolution" section, select NTSC if your DVD is from the United States or Asia. Select PAL if the DVD is from Europe.

Next, go to the Input Pixel Aspect Ratio pane and select Display AR. Input here the aspect ratio you would like the video to be at. In other words, input the aspect ratio a DVD player would display. Usually this is 1.333:1 or 1.778:1 or 2.35:1. This will make sure your video is not squashed or stretched. This number is the one you noted earlier in DVD2AVI.

Go to that other window in Gordian Knot, the one that displays the movie. Go to the View menu and check Resized. Using the tracking bar at the bottom, find a well-lit frame of your movie (to contrast with the black bars you are trying to remove). Go back to the main window and adjust the cropping (in the Crop pane) to remove any black bars from the edges of the picture, using Pixel Crop. Although auto-crop works, it is inaccurate, and can shave several pixels off a side or leave too many in, so do it by hand. It is a terrible waste of file space to actually ENCODE black bars into the frame when you get them for free just for watching fullscreen.

Now, look at the Output Resolution pane and find Width and Height. The two Modul things next to them set what multiples they snap to. Set W-Modul to 16 and H-Modul to 16 as well. These limit your resolutions to ones that work well for divx encoding. You will also want to set your resolution as a good fit for your bitrate. If you are making a 1-CD rip of a 2-hour movie, you will want to use a smaller resolution because the higher you have your resolution set, the less information you have on how to display it. If you make your resolution too high for the file size, you will have large macroblocks that will look terrible. If you make your resolution lower, you will not have bad macroblocking, and should still have decent quality. Don’t use a resolution lower than those listed below, though, or it will look very blurry, and each pixel of video will become huge when the movie is played fullscreen. Here are some sample resolutions for various common aspect ratios, converted to multiples of 16.

  1. For 4:3 (1.333) aspect ratio: 640x480, 576x432, 512x384, 448x336, 384x288
  2. For 16:9 (1.778) aspect ratio: 704x400, 656x368, 592x336, 512x288, 480x272
  3. For 2.35:1 (2.350) aspect ratio: 720x304, 672x288, 640x272, 560x240, 448x192

Basically, the first boldfaced resolution is what you should use if you are not being stingy with the bitrate. If you intend to put about 1 hour of video into 700 MB, use this large resolution. If you want a balance between quality and space-saving, and intend to put about 1.5 hours of video into 700 MB, you might want to use the second set of resolutions. If you really want to cram a lot into one CD, like 2 hours or more, but are willing to have things look a little blurry when fullscreened, use the third highlighted res and a low bitrate. Note about the underlined res: if you are using a high bitrate, you should be able to use this res just fine, but notice that the width is actually larger than the DVD source material's width. You may end up with funkiness in your picture if you enlarge it like this. Be aware that you can really use whatever resolution you like, and that preserving the aspect ratio perfectly and keeping all distortion out of your video is not all that important, as the audience will only notice it when it is severely changed.

Finally, go back to the other GKnot window, make sure it doesn’t look squashed (if you can’t tell, neither can the audience), and click “Save & Encode”. A new window appears for your avisynth (AVS) file. Click Edit. Another window appears for editing the avisynth script. Delete the “#” next to the following items:

Under # PLUGINS
#LoadPlugin("decomb.dll")

Under # IVTC
#Telecide(guide=1).Decimate(5)

So, now that you have deleted the # before each of these, those filters will be applied to your video. Both of them are quite basic, and your image will be severely degraded if you don’t use them. Click “Save” to save your AVS file to your rip directory. Close GordianKnot.


Putting It All Together and Encoding: VirtualDubMod

Open VirtualDubMod and click File, Open Video File, then open your AVS file. Go to Streams menu, stream list, and add the stream you encoded with Razorlame (the mp3). It might ask you if a question about timings; click no. In the video menu, click Full Processing Mode.

Now, go to Video, Filters. A new window should appear with a blank list of your filters.

Now scan to the point you want to your video clip to begin. Click the button labeled with the left arrow to set the punch-in frame. Scroll to where you want your clip to end, and press the right arrow key.

Find the total time of your selected piece of video by subtracting the punch-in timecode from the punch-out timecode. Open your Divx 4/5 bitrate calculator. Input the duration of the video, the MP3 audio bitrate, and your target file size. It will spit out a target bitrate, which you should write down. For a 1-CD encode, something like 690 MB is a good target size, so if it goes over a little bit you have some room to spare. Whatever your choice, in Vdub, go to Video, make sure Full Processing Mode is selected, then click Compression. Pick Divx Pro 5.03 Codec on the left, then hit Configure. Under the Advanced Parameter tab, set Performance/Quality to slowest. This will take longer to encode, but will look better. Go to the General Parameters tab and set the Max Keyframe Interval to about 72. This means that at least every 72 frames (3 seconds of video), the divx codec will make another keyframe. A keyframe is a frame that is perfectly defined (rather like a low-compression JPEG) that the following frames base their motion on. Too few keyframes is a common problem with many files you find on the internet. During scenes of high motion where the picture is changing rapidly, you will need lots of keyframes to ensure it doesn’t get choppy. Now go to the Divx Codec tab. Make sure ALL the boxes in this tab are unchecked. Set Variable Bitrate Mode to “2-Pass, First Pass” and enter the number your bitrate calculator gave you into the Encoding Bitrate box. First Pass is a feature that scans the video and records how much motion is in every single frame. This allows Second Pass to actually encode the movie at a variable bitrate while withholding bitrate from some parts of the video while giving higher bitrates to other parts. If it simply encoded in one pass, it would very hard to achieve an accurate target file size. Click OK to exit the DivX Configuration window, then OK again.

With 2-Pass, First Pass selected, go to File, Save As AVI. Check the option “Add operation to job list and defer processing”. Name your file and save it. Go back to Video, Compression, Configure and change the option to 2-Pass, Second Pass. Do Save As AVI again, check “Add operation to job list and defer processing” again, and save your file again. The same name you used for First Pass is perfectly fine. The dummy AVI file created during First Pass is useless and will be overwritten.

If you are doing a 2-part rip, you will need to create two different log files for each part's first pass. In the same window to which you input your target bitrate, find the "Multipass encoding options" pane. Next to "Read log file" and "Write log file" there is a field containing the directory and filename to which the log file will be stored. Click "Select" next to this, and pick a name and directory for the 1st Pass log file to part 1 of your movie. I usually use something like "part 1.log". After part 1's first and second pass are in the queue, change the log file to something else, like "part 2.log". You're asking for trouble if you name both log files the same thing, in the same directory. First, in the middle of the night, it will stop after part 1 and ask you if you're sure you want to overwrite the log file. Second, you won't have part 1's log file anymore after it's done, should something go wrong and you end up needing it.

Finally, with both jobs in the queue, go to File, Job Control. Select the first job and press Start when you are ready to begin.

When you wake up in the morning (or sooner if you have a fast computer), your file(s) should be waiting for you. Give the encode a thorough once-over to make sure you didn’t screw something up. Also check to ensure you have a manageable file size. If your file is too big, you have two options: cutting some of the credits out (assuming you left them in before), or doing the whole thing over again.


written by PrimarScources
edited and updated by the_doc