Introduction | Record a demo | Demo to TGA | Demo to WAV | TGA to AVI | Compression with Gordian Knot

 

Gordian Knot - compressibility check and compressing

Applications needed:
Gordian Knot Rip Pack
Gordian Knot Codec Pack

As noted earlier our folder with the screenshots become large pretty fast, and our uncompressed AVI-file will be correspondingly large. Therefore we'll be looking for a way to decrease the size of our AVI-file whitout losing too much in visual quality. The key to accomplishing this is to use an application that can compress the file for us. There are many such programs available, one of them being the popular application by Avery Lee called VirtualDub. The application I'm going to use however is one called Gordian Knot (which incorporates the work of Avery Lee). Gordian Knot is a program package developed to make it easy to backup DVD movies, and it admits the possibility to resize video clips as well as aid in performing optimization tasks. Even if we're not interested in making DVD backups, Gordian Knot is well suited to our needs.

When coding a movie we are very often forced to make a trade-off between size and quality. The problem is that when using an application like VirtualDub by itself it's rather hard to tell in advance what bitrate to chose in order to achieve a certain quality. It's a game of making qualified guessings. Not so with Gordian Knot though.

Before we start our compression we need to install Gordian Knot and a package containing some codecs. First install Gordian Knot Rip Pack and then Gordian Knot Codec Pack. We will not need all the different codecs and applications included in the two packages for this guide, but rather than detailing every application, what it does and so on, I simply recommend installing it all. Personally they have never caused me any problems what so ever, but for safety's sake I recommend creating a system restore point (if your system supports it) in case you would run into problems.
During installation of the DivX3 codec Windows will probably protest by saying that the codec has not been through Microsoft's compatibility test, and that it therefore may cause harm to your system now or in the future. This can, even if I take no responsibility for problems arising, safely be ignored and the installation request accepted.

The codec pack contains among other things the latest version of the DivX codec, which contains adware. the adware application will occasionally attempt to access the internet. In case you are concerned with your privacy you can block the applicaton's access attempts by means of a firewall application, for example the free app ZoneAlarm. Some parts fo the adware can not be removed without also causing the codec not to function. For more details about how to protect yourself, I suggest visiting this thread over at the Doom9 forum.

There are at least two things besides making DVD backups that Gordian Knot is good for, and they are

1) to perform compressibility checks for the purpose of in advance giving a hint as to what quality will be acheived at a particular bitrate and resolution

and

2) to perform the entire encoding process in 2-pass mode, with or without adding an audio track.

I will describe both steps in turn. All the different steps in the compressibility test and the encoding process are described in the list below and every list item corresponds to a number marked in the images referred to in the different steps.

Compressibility check

Begin by starting Gordian Knot

Begin by starting GordianKnot. The different steps are shown here and here.

  1. The first thing we do is to name the project. Push the button "Rename" and enter a name and then press ENTER.
     
  2. Click on "Open" and browse to the location of our AVI-file. A new window will open in which you can see the imported video file. Keep that window in the background, but don't close it. At the bottom left in the main window you can see the framerate and frame count of the clip.
     
  3. Check the radio button indicating that we wish to use the DivX5 codec.
     
  4. If we know that we wish to use an audio track in the form of an .mp3-file, we indicate that by checking the button labelled "1x vbr-mp3."
     
  5. In the dropdown meny we also set the bitrate we wish to use for our audio track. This is just for bitrate calculation purposes, and wont affect the actual bitrate of the audio track.
     
  6. This field is useful when we wish to set the final size for our movie. In step 12 we perform the compressibility check, which means that the codec will test how much the source clip can be comressed. A number is returned which in turn will determine the value shown in field 6 (not shown until after step 12). 100% means that the codec is at its maximum, and a bitrate increase (which is synonymous with increased size) will not produce better visual quality. Between 60% and 80% seem like a good figure, but I suggest you experiment by changing the value in field 7.
     
  7. This is were we set the size we want our final file to have. If we don't check the radio button in step 4 and set a bitrate in step 5 but afterwards add an audio track our final file size will exceed the value in field 7. A typical full song lenghted MP3-file is rather small in size compared to the video track, so it's not the end of the world if the button isn't checked and no bitrate set.
     
  8. Make sure this value is the same as the resolution of the source clip.
     
  9. This is the hight-width ratio of the source file pixels. I assume the ratio is 1:1, so check the corresponding radio button.
     
  10. Pull the slider in order to set the resolution of the final clip. The value in field 6 is affected by the resolution. It is therefore important to decidec what resolution to use before moving on to step 12 as well as setting the file size (since it too is affected by the value in field 6.)
     
  11. Switch to the window opened in step 1. Click on "View" and then "Resize" to see the clip in the resolution set in step 10. Then click on "File" and "Save&Encode" which will open up a new window. Under the header "Resize" there is a number of different options. I use Lanczos , but as always I recommend that you experiment a little in order to find the one best suited for your needs.
     
  12. Check the button next to "Use" and then click "Edit." A new window will open up having the title "Avisynth Comp.test Frameserver." Find the line that says UnDot() and add on a new line above it the text ConvertToYV12() and then press the button "Comp Check." A small window with the label "Press 'OK' to start a DivX5 compressibility check now. Please wait a few minutes, you can not use Gordian Knot until encoding is finished" opens up. Click on OK. A new application (VirtualDubMod) is started and it will run a short compressibility test and then close again. If we now look in field 6 we'll find that a number has appeared. Change the value in field 7 to something that gives a value in field 6 within the range we wish to use - that is 50% to 100% (the optimal value is something that may be debated, but once found it should hold true for most files).
     
  13. Switch back to the window opened in step 2, and once again click on "Save & Encode" and in the new window that opens on "Edit." Again look for the line that says UnDot() and insert on a new line above ConvertToYV12() and then click on "Save & Encode." Chose were to save the AVISynth-script (yourmovie-avs). A new window should open up. Click on "Select" and find the audio track you wish to use. As you will note, most formats are acceptable. I'll chose an existing MP3-file and select the radio button labelled "Just Mux." This means that Gordian Knot will simply add the audio track without doing anything with it. If we know that the audio and video track are out of synch, we can correct that now by entering a value (in milliseconds) in the field called "Delay." This value tells Gordian Knot how much to move the audio track in relation to the video track. If the sounds are late compared to the video track events, we check the box "negative."
    We can also chose to add an uncompressed WAV-file, for example our in-game sound, and tell Gordian Knot to encode it as an MP3 track. This is done by checking one of the MP3 radio buttons and entering a bitrate. VBR = variable bitrate, CBR = constant bitrate.
     
  14. Click the tab labelled "DivX5" and a window looking something like this should open up. Click the button "First Pass" and another window looking like this opens up. If we made a compressibility check then the suggested bitrate is already set. Make sure the field "Variable Bitrate Mode" is set to "Multipass, 1st pass" and then click the button "Select Profile Wizard" and then "Disable Profile Wizard" in the window that opens. This way we wont have to deal with the preset DivX profiles associated with hardware compatibility issues (for those who definately wish their creations to play on DivX capable hardware players I suggest using one of the profiles of course). Click "Next" and then check the box "Use GMC" as well as "Use Bidirectional Encoding." Click OK. Move the "Performance / Quality" slider to "Slow" and then click "OK." Now click the button labelled "Nthpass" upon which a window looking like the previous one opens up. Make sure all the settings are the same except for "Variable Bitrate Mode" which should be set to "Multipass, nth pass." In case we'd like to encode using more than two passes we simply increase the number in the dropdown menu "Number of passes" to the number of passes we'd like to use. When "Performance / Quality" is set to "Slow" more than two passes is hardly required.
     
  15. Click the button "Add job to encoding queue." We are presented with the question whether or not to start the encoding. Answer "Yes" upon which VirtualDubMod opens up and the encoding process begins. Wait until the encoding is finished before closing Gordian Knot. You can now browse to your encoded file and open it up in the media player of your choice.

Links -->