Step by Step on Capturing and Editing
with AVI-IO and Virtual Dub

Hi. This page was intended to help people get setup quickly and easily to capture (record) and edit video footage from their TV-Card easily, using a 3 step process. Step 1 Capture, Step 2 Edit, Step 3 Encode.

First Off you will need to download two programs, AVI_IO and Virtual Dub. You will also require 2 Codecs, Huffyuv and Div-X 5.x.x. You may or may not be interested in LAME MP3 audio codec.

Suggested Downloads

PROGRAM Official Location My unofficial location File Size
Virtual Dub version 1.5.3 Home Page n/a n/a bytes.
AVI_IO Version C 03.24 Home Page n/a 82,494 bytes.
Div-X version 5.0.2 Build 487 HomePage My Page Version 5.0.0 Build 413 2,744,189 bytes.
Huffyuv version 2.1.1 HomePage My Page. Version 2.1.1 15,098 bytes.
Lame version 3.93.1 HomePage Download My Page. Version 3.93.1 774,938 bytes.
Brightness / Contrast Ui Enhanced version 1.0 n/a My Page. Version 1.0 17,740 bytes

Once you have downloaded and installed those, we're ready to begin. To install the filters if you wish to, just unzip the files into your Virtual dub Plugins directory. If Virtual dub is running, close it down and when you restart it, it will detect the plugin.

Configuring AVI_IO

We need to configure AVI_IO. This is the main screen for AVI_IO. Menu Options may appear different depending on what brand and model capture card you have, and what drivers you use.
The AVI_IO Main Screen LEFT : As you can see AVI_IO is a very small and compact program that is easy to navigate, but don't let that fool you. It is a fantastic program. In this picture you can see the show is being broadcast in widescreen format. Note the black bars top and bottom of the image. These are not officially black bars, but are actually unused portions of the display. For more information on AVI_IO, please refer to the official Home Page.
RIGHT : The first step is to make sure AVI_IO is using the correct input device. Choose Devices from the Menu. If you have multiple devices, you may wish to run tests later to see which one gives you the best output quality Select Device
Select Video Settings Select Device LEFT : Now Click on the Video Settings menu option and choose Format. This is where you select the size of the video you wish to capture, and the Frame Image format. I have selected 384 x 288 resolution and that is 1/2 PAL resolution the footage is scaled down to the size you select. The Frame Image format is a little more complex. There are many options and depending on which codec you wish to use and what your capture card supports, it's really just a personal preference. For this tutorial, we are going to use Huffyuv codec and that prefers YUY2 frame Image format. So please select that now if your capture card support it. Usually in this list, any image formats above YUY2 in theory should be higher quality and any below it should be lower in quality. RGB would be the highest quality, but I don't believe all capture cards directly support RGB formats, and not all codecs do either. Also something worth pointing out. RGB uses more CPU power than YUY2 does. So experiment to find which settings you prefer the most. To explain Frame Image Format very briefly, imagine for a second that each frame is a single picture, like a JPEG or Bitmap, so at 25frames per second non-interlaced that means there are 25 pictures per second. So the Frame Image Format is what type of picture format you want to use for each frame. That is why some codecs will not work with some Image Formats.
RIGHT : From Video Settings Menu option, select Compression. If you installed Huffyuv and Div-x correctly they should now appear in the scrolldown list. Select Huffyuv v2.1.1. Then Select Configure Select Video Settings Select Device
Select Device LEFT : Now you must configure Huffyuv. Choose the same settings as displayed in the picture
RIGHT : We should configure the Audio next, so from Video Settings select Audio Settings. AVI_IO at this stage only supports PCM audio. This is uncompressed audio, so we will be compressing that to MP3 in Virtual dub. I have selected 44khz, 16bit Stereo and the bitrate of 172kbit/s. In Virtual Dub I encode to MP3 at 128kbit/s so I don't want anything lower than 128kbit/s. Select Video Settings Select Device
Select Capture Settings
ABOVE : Lastly we need to setup the Capture Settings. As I capture in PAL, I setup my Frames per Second to 25. If you use NTSC, this should be set to 30 FPS. I have selected Allow capture to resume. This means that during the capture I can press ESC to pause the capturing. This is fantastic for skipping Advertisements or footage you don't want to capture. Helps save lots of disk space.

Make sure you have Selected Record Audio. As the maximum limit for AVI files is 4096MB (4GB) you can select here what size segments you wish to use. I have mine set to the maximum of 4GB. If you only have fat16 drives, then this limit can only be 2GB. Now there is a slight bug with AVI_IO. This Maximum Filesize in MB number, is ALSO the minimum filesize in MB. SO if you have for instance 6GB of disk space free. You capture 3GB of footage, even though you still have 3GB free, when you next start recording AVI_IO will Crash as it can't find 4gb free. I've reported this "feature" to the author.

Assign Sessionnumbers is very helpful when capturing multiple segments.

For the Disc information, you can specify a number of partitions/disks that will be used for capturing. This is great if you don't have ALL of your free disk space on one drive. With the Filenames, Get into a good routine for naming your files. I name all my files like this: {CODEC} - {SHOWNAME}.avi For the CODEC bit I abbreviate, so HUFF is for Huffyuv etc. and the SHOWNAME this example is for the movie Panic Room.

OK, now AVI_IO is setup, (apart from channels, you will have to configure that aspect yourself, as everyone lives in such different areas using different sources, it's pointless for me to cover that aspect of set up.). Choose a channel, or input source (such as RCA, Tuner or S-Video) and record some footage, (for however long you like). AVI_IO displays on the bottom status line how many frames you have captured, the duration of the capture and the Buffer levels. Make sure the buffers stay under 20. Press ESC or click on the Stop button when you're done. We will need the file(s) you just created in the next step.

Editing and Configuring Virtual Dub

Configuring Virtual Dub is a little more complex that AVI_IO, but once you get the basic idea of how Virtual Dub operates you'll be a master in only a matter of minutes.
Virtual Dub Main Screen
ABOVE : Click on File and select Open Video File. Choose the first segment from your capture. If your capture (from STEP 1) is only a single file, then select that. Virtual Dub will automatically load any additional segments if they are found and will display on the bottom line (the status line) how many segments it auto-loaded.

With Virtual Dub the screen is divided into two sections. By default the Left image is the input source and the right image is the output source, so any filters etc you add you will see the effect immediately.

The buttons on the bottom you will be using quite a bit, I'll give you a quick rundown on what each one does. From left to right. STOP, PLAY input, PLAY input & output, Return to first frame, Previous frame, Next Frame, Move to last frame, Move to previous Keyframe, Move to next Keyframe, Scene reverse, Scene Forward, Mark in, Mark out.

The Scene reverse and forward buttons I use lots, it's a quick way to advance forward and back, Virtual dub stops at each scene change. The next two buttons, the Mark in and out also get used lots. To cut (remove) some frames, move to the first frame you wish to remove, then click on the Mark in button, now move to the last frame you wish to remove and click on the Mark out button, you will see that section of footage highlighted in blue on the slider bar. If you wish to delete this footage, just press the Delete key. You can experiment with other options and features from the Edit menu option. Ok, once you have done all your editing, it's time to add any filters and do any cropping.
Setting Video Options Setting Video Options
ABOVE LEFT : Select the Video Menu. Make Sure FULL PROCESSING MODE is Selected. If it is not then you will not be able to select or add any filters.
From the Video menu select Filters, By default there are No filters loaded. ABOVE RIGHT : Select ADD
RIGHT : I have a few additional filters installed, For my example I'll select Brightness/Contrast UI Enhanced as I wish to brighten and lighten the footage, plus I wish to crop the footage (to remove the top/bottom unused screen portions). You can use other filters to crop with, or the Null Transform if you just wish to crop, however read the F.A.Q section as to why I always add a Brightness Contrast Filter. So Select Brightness/Contrast UI Enhanced, or the standard Brightness / Contrast if you did not install the UI version. Then click on OK. This will now add the selected filter to the main filter window (from the last step above). Setting Video Options
Setting Video Options
ABOVE : This is the default internal Brightness / Contrast Filter display. It's pretty basic but does a good job. It's difficult to tell by how much you've adjusted the levels, and there is no preview option.
Setting Video Options
ABOVE : This is the UI Enhanced version. You can see the differences. It's easier to adjust the values, and there is a preview option so you can see your adjustments instantly. For this test, I will adjust the Brightness to +10 and the Contrast to - 93%
Now you must select the brightness/contrast filter from the filter list (where you clicked on ADD 2 steps back). With it selected the CROPPING button will then become available. Click on CROPPING.

Setting Video Options LEFT : In the crop screen you can now enter how many lines you wish to remove from all edges of the footage. For this test I only need to remove the lines from top and bottom, So I will enter numbers (or use the arrows) for Y1 Offset and Y2 Offset. You will see the image in the preview window change size as you adjust those values, so you can see by how much you need to adjust. *NOTE* If you wish to encode to Div-X it is advisable that you try and keep to a divisible by 16 ratio, or at the very least divisible by 8. If you make it divisible by 4 or some odd number then the compression ratio Will NOT BE AS GOOD !.!.! You can use the progress slider to advance anywhere in the footage that you want. This is good if you want to check all parts of the show, or if you wish to select a lighter section to make it easier to see how many lines you need to remove.

If you are wondering why on earth bother with Cropping, well the answer is simple. FILESIZE If you intend to encode to Div-X you can gain a HUGE benefit in filesize by cropping unused screen sections. If however you intend to make MPEG files, then cropping is indeed useless as mpeg takes no advantage from cropping. You can visit my Test page for examples of filesize savings by Cropping.
Virtual Dub Main Screen
ABOVE : As you can see in the above picture, the Output screen is now smaller and slightly brighter, This is because the filters take effect immediately. If you use multiple filters, you will have to experiment as the order they appear (or are added) is extremely important. For instance you would not want to add the Brightness/Contrast filter Before a resize filter.

Configuring Div-X and Creating your final AVI file with Virtual Dub

We now have to setup the Codec and generate the final file. We will be using Divx version 5.0.0 for this test

Setting Video Options Setting Video Options
ABOVE : Click on Video and Make Sure FULL PROCESSING MODE is Selected. If it is not then you will not, select it now else you will not be able to select a video codec.
From the Video Menu select Compression. You will now get a list of codecs to choose from. Select Divx 5.0 Codec and then choose CONFIGURE.

Setting Video Options LEFT : We Now need to configure Div-X. Most of the time I encode using 1 Pass Quality Based, and set the quality limit to 93%. This is a good compromise between Filesize and Quality. The reason Quality Based is better than Constant Bit Rate (CBR) (such as MPEG) Is each frame is treated individually. For example say there is a frame which is just a plain plaster wall, this would be classified as a frame with very little detail, now compare that with a room full of people with lots of decorations. That would be classified as a high detail frame. Now Quality based encoding would remove more detail from the Plain wall frame than it would from the crowded room frame. This helps preserve quality. But Constant Bit Rate encoding (like MPEG) would remove the exact same amount of detail from each frame, so the plain wall would look great, but the crowded room may not (all depending on what bitrate (kbit/s) you used). Div-X also has 1-pass and 2-pass CBR encoding settings, however they do not operate like the basic CBR. Div-X still runs some quality based algorithms if it deems the bitrate you set to be to low for that particular frame, so Div-X does its best to retain quality.
RIGHT : Make Sure FULL PROCESSING MODE is Selected. If it is not then you will not be able to select or add an audio codec.
We Now have to configure what Audio Compression we wish to use. So click on the Audio menu, then on Compression.
Setting Audio Options
Setting Audio Options LEFT : I am going to use a good MP3 encoder called LAME. In the right top box is what level of compression you wish to use I selected 44khz and 16bit Stereo at a bitrate of 16KB/s (this is KiloBytes). 16KB/s is the same as 128kbit/s (kilobits). Some people prefer to encode audio higher than that, at 224kbit/s, but I see no point for what I capture, maybe if my captures were more based on audio (such as film clips) but if it's only movies which is mainly speaking 128kbit/s is fine. Once again it's a personal preference

Lastly we now have to create the file. To do that we have to start the encoding process.

Saving your File LEFT : From the File menu, you can just choose Save As AVI. Virtual Dub will then display a process screen, showing you how much time is remaining, the average encoding Frame Rate, and some information about the video and audio segments plus the projected filesize. You can click on the VIDEO TAB to see the size (as a graph) of each frame and keyframe

Now if you intend to burn your AVI to a CD-R, and you suspect that it's going to be to large for a single 700mb CD-R, then you can select Save Segmented AVI. Once you do that, you will be given the option of entering in how large you wish each segment to be. So for a 700mb CD-R you could enter 700. That way it's easy for you to burn.

Which ever save option you select, just sit back and relax until the encoding is finished.

There are many options and settings with Div-X that you can experiment with, but if you wish to save some time, you can review the results of some tests I have conducted in the past. I compared Quality Based versus Constant Bit rate encoding; MPEG versus Divx and DIVX versus DIVX using different versions. All of these results are on my Codec and Encoder Test Page You can visit this page HERE

That concludes this small tutorial. Hopefully you have found this page to be of some benefit.

Frequenty Asked Questions

QUESTION Why do a 3 Step Capture process, Why not just capture direct to MPEG or DIV-X?
ANSWER Simple, I like quality and flexibility. Capturing and on-the-fly encoding does save time and disk space but it also makes editing more difficult and the slightest problem, or disk hiccup will yield encoding errors.

Encoding on-the-fly uses lots more CPU power (unless your capture card has hardware encoding abilities).

The other main reason is say you capture some footage that is a few hours long, how do you know what setting to use to give maximum quality? If you want to burn that footage to CD-R, you won't know if it will fit onto a CD-R or not. Once you've captured the footage and find out it's to large to fit onto a cd, you have to either edit that footage, or change your capture settings and re-capture it. That wastes more time than my 3 step process.

The benefits of the 3 step capture process means you can perform as many tests as you like without fear of losing quality. This ensures you can produce the final file to exactly meet your requirements.
QUESTION The files I create with Huffyuv or Divx are too large. How can I make them smaller?
ANSWER Filesize is dependant on 2 things A) Your configuration settings and B) Your input quality, or source quality.

Check your source quality, if there is noise, interference or poor signal strength then this will directly affect the codecs ability to encode. None of the codecs can compress noise very well. Constant Bitrate MPEG won't give a dam about the noise level because it doesn't care about the Quality level, it is driven purely by the bitrate setting.

Your capture settings play a very important role. If you capture at large frame sizes, such as 768 x 576 this will use considerably more disk space than 384 x 288. So you will have to compromise between quality and filesize. However if you are happy with your frame size but still want to reduce your filesizes, then I suggest you adjust your Brightness and Contrast settings. If you capture in Huffyuv, then before you capture raise your brightness and contrast values From AVI-IO, to do that I would click on Video Settings and then Source. You may need to do a few tests at different values to see what type of filesize saving you can gain. Here are a few results from my quick tests. Capturing for 2 minutes:

292,849,664 bytes my Normal settings
259,352,576 bytes adjusting brightness and contrast down (darker)
233,142,272 bytes adjusting brightness and contrast up (lighter)

As you can see that's a considerable filesize saving.

The other way to adjust filesize is using a Brightness / Contrast filter in Virtual dub. Here's an example of adjusting the Brightness and Contrast levels using 2 different filter values:

404,819,968 Normal Brightness & Contrast
368,824,320 Brightness up 10% Contrast down 7%
338,188,288 Brightness up 15% Contrast down 13%

Once again the savings are quite substantial. This is (in my humble opinion) a better way to make a movie/show fit onto a single CD-R than adjusting the quality settings. Especially considering Div-X allows you to adjust the Brightness, Contrast and Saturation values while viewing. So you can still view the created AVI Exactly how you like. MPEG doesn't allow you to adjust these settings while viewing.
QUESTION Why bother cropping the frame size?
ANSWER Cropping can help you reduce your filesize considerably. If you encode using Div-X, then cropping can be vitally important. If you intent to use MPEG, then cropping isn't necessary. The main reason for this is Div-X is purely based on Frame size, but mpeg is purely based on Bitrate.

However with Div-X it is recommended that when cropping try and make the framesize divisible by 16, or at the very least, make it divisible by 8. If you have wierd frame sizes you may end up with larger filesizes. Div-X yields its highest compression with framesizes divisible by 16, so 384 x 272 would be better than 384 x 270.
QUESTION What is a Keyframe?
ANSWER A Keyframe is a single frame that is stored in the AVI without any compression. This is like the main frame. By default Div-X stores a keyframe every 300 frames (you can change this if you like). Basically, all the frames stored in the AVI after the keyframe only contain the information that has changed on the Keyframe. These inbetween frames are called Delta Frames.
QUESTION What is bitrate?
ANSWER Bitrate is how many bits of information should be processed each second, normally this is expressed in kb/s or kilobits per second. Bitrate is more relevant to Constant Bitrate Encoding, or every MPEG. If you create lots of MPEGs and you would like to know how to calculate what bitrate you need to use to achieve a certain filesize (such as fitting a movie onto a 700mb CD-R), you can calculate it like this:

Say you wish to encode at 1,150 kbit/s video and 224kbit/s audio and want to know how much disk space that will use:

first add the two bitrates together 1150 + 224 = 1374 kbit/s
Now convert that to KiloBytes 1374 / 8 = 171.75 KB/s
Now convert that from seconds to minutes 171.75 * 60 = 10,305
Now convert that to MegaBytes 10,305 / 1024 = 10.06MB per minute.
so a 700mb CD-R will hold approximately 70minutes of footage at 1,150kbit bitrate.

This Web Site, requires
Microsoft Internet Explorer with JavaScript And Frames Support
Best viewed in 1024 x 768 resolution

This Page was Last updated on:
15th December 2oo2

(C) Narler
If you didn't get to this page from my Main Page, Click here