KingJohns Guide re-compressing
Back to table of contents

There are a number of reasons why you may want to re-compress a movie, ranging with problems with a particular codec, bad playback, trying to fit more onto a data disk. This guide gives the reasons why you may be having problems, and what you could do to fix them.

However it has to be said that if the home movie has bad frames, then some of these methods wont work correctly, and could cause lip sync. So you should first remove any bad frames by following the guide on this.

Xvid
By far the most complaints is the Xvid codec, still under development and nowhere near perfect, there are many problems with this codec. Some people cannot play home movies made with Xvid at all, some have green frames, not always caused by the Xvid codec, but a simple way to deal with the Xvid problem is to re-encode it to another compression format (codec).

Virtual Dub
Select Video > Compression
http://www.medievaltravel.co.uk image

From this screen you can see what video codecs are available, if you don't have many listed, you need to install a few. When you select the codec from the left hand window you can now click the "Configure" button, another screen will let you set up the codec for bitrate etc.

http://www.medievaltravel.co.uk image

Choose a codec
In this example I have selected DivX 5 you can see that the default keyframe every is set at 10, you can also see the Data Rate default as 910Kbps .

Keyframes
KDDDDDDDDDK Keyframes are used by the player as a reference point, and will keep the video in sync with the sound. Delta frames are those between the keyframes. Keyframes will also show the difference between the changes of frames (Simple explanation).

The keyframe spacing is important if the file was to be edited later and the person was removing bad frames, the part to be deleted would be marked at start and end at keyframes, so a keyframe spacing of 100 would mean 100 frames would be deleted, even if there were only 5 bad frames in-between the next keyframe. Also you will find that movies with keyframe spacing of 100 or more cannot be fast forward easily, as the player is trying to sync to the keyframe so it may look as if there is a problem with the file, lip sync can get worse if you cut a movie at delta frames. The default spacing of 10 is just fine.

Data Rate
Now this is going to effect the quality of the movie, the lower the data rate the smaller the file size, but the lower the quality. It is not possible to say exactly what this setting should be, because the quality of the source is going to be different for each movie, therefore you should experiment to see how low you can get this without dropping the quality too much.

Virtual Dub
Select Audio > Compression
http://www.medievaltravel.co.uk image

From this screen you can see what audio codecs are available, if you don't have many listed, you need to install a few. Mpeg Layer-3 are the most popular, but make sure you can use this legally. When you select the codec from the left hand window you can now select a frequency, mono, stereo and a bitrate from the right hand window.

http://www.medievaltravel.co.uk image

Choose a frequency and a KB/s that closely matches the source, there should be several listed, with a data rate anything from 8Kbps mono to 160Kbps stereo. If you choose the wrong frequency, the sound may end up too fast or too slow. Most DVD rips are 48Khz and others usually 44Khz so choose one of those and select a 128Kbps to start with. Again the lower the Kbps the smaller the file size, but the lower the quality.

In the above example, I have selected MP3, if you have the Fraunhofer Mp3 Pro codec installed you will have a much bigger choice and much higher bitrates available.

How's it done
Xvid Video, with MP3 audio re-compressed to DivX low motion and PCM audio (Uncompressed)

Assuming there are no bad frames, I have chosen to decompress the audio, as this will also help with any playback problems, you could later recompress to MP3 again if you wish.

Vdub
File > Open Video file
Video > Full processing mode
Video > Compression > Codec > DivX Low motion > Default settings
Audio > Full processing mode
Audio > Compression > No Compression (PCM) (Default)
SAVE AVI > Movie1.avi

There is no need to wait to see what its like before realizing your settings was no good, click
the abort button and playback your new file, make any adjustments as necessary, when your happy with the settings, re-compress the whole movie.

Remember Vdub needs to decompress the Xvid video, then compress it to DivX so that takes a little while, the audio in this case is just decompressed and no further compression is done. This will cue most Xvid related problems, and hopefully not cause other problems.

In this example, and an AVI is being used as the source, but you could also use a mpeg 1 (.mpg) but remember the output will now be Mpeg 4 (.AVI) Since this example shows the audio being decompressed to PCM, you should not have any problems if the source is using a variable bitrate for the audio (VBR Warning) if you intend to use MP3 for the output, first use PCM then compress the WAV later.

TMPGEnc
This can also be used, Just load your movie as normal, then select file > output to file >AVI >
http://www.medievaltravel.co.uk image http://www.medievaltravel.co.uk image
Then click the Setting buttons to set up the codecs.