High Resolution Capture with VirtualDub
If you have completed the preceding sections on tuning, you are finally ready to begin capturing the video to your hard drive. Remember that you will need large amounts of free hard disk space to capture high resolution video. For an explanation of how to calculate the disk space you'll need, visit my Data Rates and File Sizes page. For those of you who want quick information, here is a table that represents the estimated amount of hard disk space you will need to capture your video:
|Huffyuv||MJPEG Q19||MJPEG Q18||MJPEG Q17|
|320 x 480||2.25-3.5 GB||950-1600 MB||600-1100 MB||450-850 MB|
|640 x 480||4.5-7.0 GB||1.9-3.2 GB||1.2-2.2 GB||900-1700 MB|
If you have plenty of disk space and a fast CPU, you can capture with Huffyuv to prevent any loss of quality. To conserve disk space and lower the CPU requirements, you can use the PICVideo MJPEG codec. However, this will cause a slight decrease in quality, and the quality continues to decrease as you lower the quality setting.
Also, if you want to process your video before encoding it, you will probably need to have additional hard disk space to hold the processed video. If your final resolution will be 640 x 480, you will need up to an extra 4.5-7.0 GB of free space to store each 10 minutes of your processed video with Huffyuv. If your final resolution will be 320 x 240, you will need up to an extra 1.5-2.75 GB of free space to store each 10 minutes of your processed video with Huffyuv.
If you want to process your video but don't want to use the extra disk space, read my Frameserving article. Frameserving enables you to process your video and send it to your desired encoder without creating any intermediate files. The disadvantage is that your video will have to be re-processed every time you encode. This will greatly increase the amount of processing time if you like to tweak your encoder settings or encode to multiple formats.
If you have a hardware compression capture card that does not support uncompressed capture, you may not be able to follow all of the parts in this section, if any. In this case, my suggestion is that you capture your video at the highest quality level (highest data rate) that your capture card supports. For a card with hardware compression, you usually have to select "No Recompression" in the video compression dialog (instead of Huffyuv or another codec).
1) Run VirtualDub.exe and enter capture mode by clicking on File -> Capture AVI. If this is your first time using VirtualDub's capture mode, you'll probably see some error messages and possibly some information about your capture card. Just keep clicking OK until you have access to VirtualDub's main capture window:
If you can't get into VirtualDub's capture mode, then you probably either don't have your capture drivers installed correctly or your capture drivers don't support Video for Windows (VFW) capture. Try (re)installing the latest version of your capture drivers and see if that helps. You may post a detailed question in the Message Boards if you really can't get it to work.
2) Next we will check to see if your capture driver is installed properly. To do this, click on Video and look at the very bottom of the menu. You should see a list of one or more capture drivers. If your card has a proper Video for Windows (VFW) capture driver, you should see your capture card in the list. Make sure your card is selected by clicking on the option that corresponds to your card.
If your card has a Windows Driver Model (WDM) capture driver, you may see a driver called "Microsoft WDM Image Capture (Win32)". This driver is actually a wrapper that translates from VFW to WDM. Try to avoid using this driver because it will hurt performance. (If possible, select the entry that corresponds to the name of capture card instead.) However, some cards completely lack VFW support, so you may have no choice but to use the Microsoft VFW -> WDM wrapper.
The following image shows what the Video menu should like when the drivers for your capture card are properly installed and selected. (Note: I have Hauppauge WinTV-Go, so your selected capture device may vary):
During the setup process, you may wish to disable the Overlay and Preview by unselecting them in the Video menu. They can sometimes interfere with Windows dialog boxes or have other strange effects.
3) Now click on File -> Set capture file. From there you can select the file name and default location of the video you will capture. Press the Save button when you are done.
4) Now go to Audio -> Compression. If your source is in stereo, you have a choice of two options: you can capture your audio in mono or in stereo. If you capture in stereo, the audio will sound better but it will take up more file space. When it comes time to compress the video to the final encoded format, using stereo sound will increase the file size of the video. If you are going to encode the video with RealProducer Basic, using stereo sound will decrease the image quality of the video. This is because the audio will have to take data away from the video to handle both audio channels. You can increase the bitrate to increase the image quality, but this will lead to a higher file size.
Basically, using stereo sound will give you better audio quality but increase the file size slightly. I will leave it to your judgment to choose which audio format you want: mono or stereo. Personally, I prefer to use stereo audio if my source is in stereo.
If you decide to capture in mono, configure the Audio settings panel as seen below in the top image. If you wish to capture in stereo, use the bottom image found below:
5) Click on Video -> Format and select a color mode (image format) of YUY2 or UYVY. (Note: If you want to use MJPEG compression, it's best to choose the color mode called RBG24. Although this option requires a faster computer, it will prevent an MJPEG bug that leads to washed out colors.) If you can select the exact resolution that you want to capture in, do that as well. If your desired resolution isn't in the list (such as 480 x 480), just select the next highest resolution. We will try to manually set the resolution in a moment.
Here is what the settings look like if you have a WinTV capture card and are capturing in YUY2:
6) Go to Video -> Source and make sure that the appropriate input type is selected. (e.g. S-Video, Composite, NTSC, PAL, etc.) If you haven't already configured the brightness/contrast/etc. settings, you should go through the Video Tuning page. This is what my settings look like, although yours will probably look quite different:
7) Now click on Video -> Compression and select your desired video compression codec. If you have plenty of hard disk space and want the best quality, choose Huffyuv 2.1.1. If you do not see that option listed, you must go to my Software page to obtain Huffyuv. Once you have selected Huffyuv, click on the Configure button. Depending on the speed of your computer's CPU, you will want to select a certain YUY2 compression method. If your computer is 500-600+ MHz or you are capturing in a lower resolution like 320 x 480, you can try using the "Predict median (best)" option. This will give your captured file the lowest file size while retaining perfect quality. However, if you have a slower computer, your CPU might not be able to compress the video fast enough, causing you to drop frames. If this happens to you, try using the "Predict left (fastest)" option. If your computer still can't handle the compression, you may want to use the PICVideo MJPEG codec (described below) or another MJPEG codec. Here is a picture of Huffyuv configured for the highest compression level:
If you are running low on disk space or have a slower computer, you can use the PICVideo MJPEG codec (available at my Software page) instead of Huffyuv. Using the MJPEG codec will cause a slight loss in quality, so I don't recommend using it unless it's necessary. But if you must use it, try to configure it to a quality level of 19 (best), 18, or 17. You can use lower values to decrease the file size of the video, but quality of your video will decrease even further. See the table at the top of this page for estimated amounts of disk space you will need. (Note: Setting PICVideo MJPEG to a quality level of 20 will produce a file that is about the same size as a Huffyuv compressed file, so that option is usually pointless.)
After selecting the PICVideo MJPEG codec in the video compression screen, hit the Configure button. Then hit the Advanced button and configure everything as shown below. You can select your quality level by adjusting the Compression Quality slider. Please note that the values for the Luminance Quality and Chrominance Quality will vary based on the quality level you choose:
Note: If you are going to be capturing interlaced video, you should probably check the box labeled "2 Fields If More Than" and type in '288' Lines. This will encode each field of video separately, ensuring that the two video fields will not be blended. However, using this option will slightly decrease the quality of your video because each field will have to be encoded as a separate image. If you are capturing with a higher quality level, such as 18 or 19, the PICVideo MJPEG codec may be able to keep the fields adequately separated without using the "2 Fields If More Than" option. In this situation, you may be able to leave the option unchecked.
8) I don't recommend this, but you can enable real-time Noise reduction and/or Cropping during capture by using the options found in the Video menu. You can obtain better quality by cropping and reducing noise after capturing your video, but you could use these options if you wanted to save time. The settings are fairly straightforward and simply require a bit of experimentation, so I'll let you figure them out for yourself.
9) If you know your capture card swaps the fields of video during capture, you should click on Video -> Swap fields. See the Classifying Your High Resolution Video page if you need help determining if your capture card swaps the fields.
10) VirtualDub provides the option to resize your video in real-time to half its original vertical resolution (called 2:1 vertical reduction). This is another option I tend to avoid, but it can be useful in some circumstances. If you are capturing a fully progressive video or a truly interlaced video with little motion, using 2:1 vertical reduction will reduce the file size of your captured AVI while retaining most of the quality you would obtain if you captured without 2:1 vertical reduction and deinterlaced. However, if your video is interlaced, you will see ghosted/blurred images during movement. That's why you probably don't want to use 2:1 vertical reduction with high motion video. Furthermore, using 2:1 vertical reduction will prevent you from inverse telecining your video if it's been telecined.
If you decide that you want to use 2:1 vertical reduction, click on Video -> Vertical reduction -> 2:1 Cubic.
11) If you were unable to select your desired capture resolution or color format, go to Video -> Set custom format. In the windows that appears, select your desired frame size and color (data) format. (Remember, YUY2 or UYVY is usually the optimal color format, except when using an MJPEG codec. Most MJPEG codecs have a bug that produces washed out colors unless you select 24-bit RGB.) The window should look something like this:
When you are done choosing your desired resolution and format, click OK. If VirtualDub gives you an error that reads "Unsupported function", that means your capture device or its driver doesn't support those settings. In this case, you'll have to return to the custom format dialog box and try using a different color format and/or frame size. If possible, choose the next highest frame size that works.
12) VirtualDub 1.4d introduced the BT8X8 Tweaker. This utility enables you to tweak certain settings on your capture card if it's based on a BT8X8 chipset. In order to use the BT8X8 Tweaker, you must download DScaler and copy the following files into your VirtualDub directory: 'dTVdrv.dll', 'dTVdrv95.vxd', and 'dTVdrvNT.sys'.
To be honest, I haven't found any other options in the BT8X8 Tweaker to be useful. The only two options you may wish to experiment with are "Full luminance range" and "Luma peaking". Enabling the full luminance range theoretically could result in better color detail, but I couldn't see any difference. Enabling both checkboxes for Luma peaking and moving the odd/even sliders to the right has a slight sharpening effect on the video. However, the video noise is also sharpened, so you're probably better off using a sharpen filter in post-processing.
Remember that if you do want to try the BT8X8 Tweaker, you should press the Reassert button immediately after your capture starts because capture drivers like to reset the options.
13) Now go to Capture -> Settings. Configure the options as pictured below, but be sure to read the notes for possible variances:
Press OK when you are done configuring the options.
Notes on frame rate:
People using NTSC video have a choice of 29.9706 fps or 29.9697 fps. You can't choose exactly 29.97 fps due to a limitation of the Video for Windows (VFW) capture API. However, if you choose either of the two values I just mentioned, VirtualDub will attempt to lock the frame rate to exactly 29.97 fps. If VirtualDub can't lock to 29.97 fps, I prefer using 29.9706 fps. This is because if you assume the incoming stream is 29.97 fps, using 29.9706 will duplicate 1 frame every 27.78 minutes, whereas using 29.9697 will drop 1 frame every 55.56 minutes.
People using PAL/SECAM video should use 25.0000 as their frame rate.
Notes on buffers:
Increasing the video buffer limit to a value like 50 can sometimes help to reduce frame drops. You can try going higher than 50, but that usually means you have a more serious problem with your setup. Also, using a value of 50 might not work well on all systems. If you have trouble, some other recommended values are 24 or the default of 10.
I recommend leaving the audio options to their defaults. Changing them can cause problems, and the audio data rate is generally insignificant anyways.
Note on "Lock video stream to audio":
This option only has an effect when capturing in VirtualDub's compatibility mode, which should only be used for troubleshooting purposes. You should leave this option unchecked.
14) If desired, you can click on Capture -> Stop conditions and configure when VirtualDub will abort the capture. VirtualDub automatically stops capturing when you run out of disk space, so settings the stop conditions usually isn't necessary. If you do want to use them, make sure you press the Save button instead of the Accept button to actually save your settings for future captures.
15) Next go to Capture -> Timing. Check the box next to "Adjust video clock dynamically to match audio clock" and hit OK.
16) Click on Capture -> Disk I/O. Configure the options as shown below, but be sure to read the notes for possible variances:
Make sure you press the Save button instead of the Accept button to actually save your settings for future captures.
Notes on chunks:
The optimal settings for the Disk I/O will vary depending on your hard drive, system setup, etc. I have found 2 MB x 4 chunks to work the best on my system, which runs Windows 2000 off a 30 GB Maxtor DiamondMax Plus 40. You can try using higher values, but that won't necessarily work better. In fact, you may run into problems if you make the buffer size too large. If 2 MB x 4 chunks doesn't work well for you, some other recommended values are 1 MB x 4 chunks or the default of 512 KB x 2 chunks.
17) If you're not using Windows NT/2000/XP with the NTFS file system or if you want to capture to multiple hard drives, go to Capture -> Capture drives. You must add at least one spill drive by clicking on the "Add spill drive" button. You should keep the threshold at 50 MB. Make sure you click in the Path column and enter the full path for captured files, including the trailing backslash. Leave the minimum and maximum AVI file sizes at their defaults. A properly configured drive should look like this:
If you have more than one hard drive, you can click the "Add spill drive" button again and configure another drive. You also have the option of setting the priority for each drive if you so desire.
When you are finished adding your spill drive(s), click OK.
18) If you're not using Windows NT/2000/XP with the NTFS file system or if you want to capture to multiple hard drives using the spill system, make sure you click on Capture -> Enable multisegment capture.
19) Now click on Capture -> Preferences. From there you should select the capture driver you want to be the default. If desired, you can also set a default capture file. Make sure you select all four options to Save your capture settings.
In the Per-driver settings section, you can select your capture driver and configure whether or not you want VirtualDub to start with the Overlay or Preview enabled. You may want to disable starting with an Overlay/Preview if they cause any problems with your system.
Here is an example of a configured Capture Preferences window:
Of course, press OK when you are done configuring the options. You have now configured VirtualDub for proper video capture.
20) Finally, click on Video Settings -> Preview w/ histogram. If you press play on your video source (perhaps a VCR), you should see the video on your monitor. If you've already tuned your capture card to the proper contrast/brightness/etc. settings for this video, you may move on to the next step. If you've never tuned the contrast/brightness/etc. settings for your capture card, be sure to visit the Video Tuning section of my guide. If you just need to fine-tune the settings for this particular video, follow these steps. First, watch the video for a few moments while paying attention to the use of the color white. If the white objects appear darker than they did when you first tuned your capture card, go to the Video Settings -> Source panel and slightly increase the contrast. If the image looks too bright and has more white in it than it did after you first tuned your capture card, go to the Video Settings -> Source panel and slightly decrease the contrast. Also, it is possible (but less likely) that you will need to adjust the saturation (color). If the colors look duller than when you first tuned your capture card, increase the saturation (color) in the Video Settings -> Source panel. If they look too bright (i.e. almost glowing), decrease the saturation (color) in the Video Settings -> Source panel.
Capturing the Video
Once again, it is important to remember that you will need lots of free disk space to store the captured video. See the table at the top of this page for disk space estimates. Also, don't forget that if you want to process your video, you will probably need even more free hard drive space.
1) You are now ready to capture the video. Before you begin, make sure that you close all programs (other than VirtualDub) that are running in the background.
2) If you're using a VCR, rewind the tape so it is positioned about 15-30 seconds before the program you wish to capture starts. Press stop.
3) For most capture cards, you will need to turn off the
overlay before capturing high resolution video. I recommend doing this
anyway since it may increase capture reliability. It's also a good idea to
the preview because it uses lots of CPU power. VirtualDub 1.4.5 has
support for an experimental preview with hardware acceleration, but it still
uses a chunk of CPU power. (You can try it out by clicking on Video ->
Preview and then going to Capture -> Enable DirectDraw acceleration and
selecting one of the options.)
I recommend setting the overlay/preview to turn off when capturing by clicking on Capture -> Hide on capture. (Note: with the overlay/preview turned off, you won't be able to watch the video while it is capturing. Thus, you will have to stop the capture based on the audio.) The Hide on capture option is never saved, so you have to re-enable it every time you run VirtualDub.
If you have a combination video/capture card and you want to try capturing with the overlay on, you are free to do so. Just remember that if the capture fails or your computer starts dropping frames, you should turn off the overlay for the next capture and see if that helps.
4) As a final step before capturing, it's a good idea to make sure that you have the "Enable multisegment capture" and "Hide on capture" options enabled if you want to use them. (VirtualDub doesn't save these options.) If you're using them, you should see the following when you click on the Capture menu:
5) If you're using a VCR, press play. When your program is a few seconds away from beginning, press the F6 key to start capturing video.
6) Now you will have to wait until your program plays in its entirety. Do not use your computer during this time. When the program reaches its end, stop the capture. (If you've disabled the overlay/preview, you will have to determine this by listening to the audio.) You can stop the capture by pressing ESC a few seconds after your program has ended.
7) If all has gone well, your video will be captured and you will see "Frames dropped: 0" in the capture information panel on the right. If you see a number other than 0 next to "Frames dropped:", it means that your computer dropped some frames of video during the capture. This probably means one of three things:
A) Your computer could not keep up with the rate of video capture. This can be caused by several different things:
1) Your CPU isn't fast enough. To solve this problem, do one of the following. If you are using Huffyuv with the " Predict median (best)" option, use the "Predict left (fastest)" option instead. If you are already using Huffyuv with the " Predict left (fastest)" option, try using the PICVideo MJPEG codec instead. If you are already using the PICVideo MJPEG codec, try selecting a lower quality level.
2) Your hard drive isn't fast enough. There are several possible solutions to this problem. First, make sure that DMA is enabled for your hard drive (in both your BIOS and in Windows' Device Manager). Second, try defragmenting your hard drive if you haven't done so recently. Third, if you have more than one hard drive in your computer, try capturing to another drive. Forth, use the PICVideo MJPEG codec instead of the Huffyuv codec, or configure the MJPEG codec to a lower quality level.
3) Background programs are interfering with the capture. To solve this, try closing all background programs that are running in Windows before capturing. This includes any virus scanners that you may be using.
If you try all this and are still dropping frames, post a question in the Message Boards.
B) You are transferring from a poor video cassette and the capture card had trouble interpreting the video data. This usually shows up in your captured video as a portion with obvious tracking errors and/or video dropouts. You probably can't do anything to fix this, but a hardware device known as a Time Base Corrector (TBC) might help.
C) If you are capturing a video longer than a few minutes, your computer might drop a frame every so often to maintain audio/video synchronization. This can be necessary since sound cards do not record audio with perfect accuracy. The longer the video, the more likely this is to occur. You really can't do anything to fix this except try to purchase a more accurate sound card or a capture card with on-board audio.
Testing the Captured Video
1) First, exit capture mode by clicking on File -> Exit capture mode. Then go to File - > Open Video File, make sure the "Automatically detect and load additional segments" box is checked, and open the file you just captured. (The file name you want to open is usually "capture.00.avi".) If you captured to multiple drives by using VirtualDub's multisegment support, you will have to repeatedly use File -> Append AVI segment and open the all of the AVIs that weren't captured to the initial capture directory. Make sure you follow the correct order (e.g. "capture.00.avi", "capture.01.avi", "capture.02.avi", etc.).
2) Use the slider near the bottom of the VirtualDub window to scroll through the captured video and make sure everything looks okay. You can press the Play button with the little "I" to watch your captured video. Please note that if you have a slower computer, playback of the audio and video may be choppy. This will not affect your final encoded output.
3) While still in VirtualDub, scroll back to the beginning of the video. Then click on Edit -> Move to next dropped frame. If your capture went well, a "No next dropped frame found" message will appear in the status bar at the bottom of the window. If your capture card dropped some frames, VirtualDub will scroll to the first dropped frame in your video. You can continue clicking on Edit -> Move to next dropped frame until the "No next dropped frame found" message appears. Now return to the points where there are dropped frames. If there are lots of dropped frames clumped together and the video noticeably stutters when you play through the portions with dropped frames, you should probably recapture your video. Before you do this, read and follow the suggestions I give in step #7 in the above section, entitled Capturing the Video. If you do this and are still are dropping frames, post a question in the Message Boards.
You should now visit my Audio Overview.