VirtualDubMod - What it is and how to use it


Many of you will be familiar with this program already and many more of you will be familiar with its parent, VirtualDub. VirtualDubMod is (in case you hadn't guessed) a modified version of VirtualDub with all sorts of extra features added. This guide will start with the presumption that you have no idea what either of these programs are or do and then go into detail about how to use VirtualDubMod.

What's it for?


VirtualDub was developed by Avery Lee as a general purpose tool to access Video for Windows in order to Capture, Encode and Decode video footage. Its quality, simplicity and efficiency make it invaluable for both capture and encoding video footage in Windows.

VirtualDub was designed for using avi containers to store the video it captures or encodes but VirtualDubMod has extended this so that you can create files in Matroska and Ogg Media containers. It is the avi facilities we will be using for most of the guide.

This guide looks at the following parts of this program. You should read them all but for ease the following links will take you to that section:

Basic Operations

Opening Video Files

VdubMod File Menu

The first thing any traditional VirtualDub user will notice is that VirtualDubMod has two different "Open video file" options in the File menu. These behave in very different ways so let's have a look at what they do:

Open video file... 'Ctrl-O'

This is used for opening all kinds of video files: .avi, .avs, .ogm, .mkv, mpeg1, mpeg2 and so on. The same functionality can be achieved by dragging and dropping a video file from a folder directly into the VirtualDubMod window.

Open video file via Avisynth... 'Ctrl-V'

This is NOT for opening avisynth files, it is for creating them. If you just want to load an avs file you have already made then use the regular Open video file option. Open video file via Avisynth allows you to chose a video file and VirtualDubMod will create an avisynth script using a Template of your choice (see the pull-down menu). The templates listed are:
Default (AVI Source) - This will create a script with AVISource("C:\YourVideo.avi") and load it.

DirectShowSource - Just like AVI source but for things like mpeg1 and certain types of DV.

MPEG2Source ("mpeg2dec.dll") - This is for importing dvd2avi .d2v files will make an avs file with the line MPEG2Source("C:\yourdvd2avifile.d2v")

MPEGSource (Nic) - This is an alternative to 'mpeg2dec' which we will not be using in this guide as it is less useful for random access.

You must remember to choose the correct template when using this option - VirtualDubMod is not intuitive and will not select the correct one for you. Loading an avi with MPEG2Source will not work and vice versa.

Scrubbing the file and selecting areas

When you have a file loaded into VirtualDubMod, you can use the bar and buttons at the bottom of the window to do a variety of things. Here's a version with some red alphanumeric labels so I can talk about the different functions.

VDubMod Scrub Bar

A) This is the Trackbar which you can click and drag to see different parts of the video.

B) This is the Trackbar Pointer which will move when you click the Trackbar. Clicking to the left or right of the pointer will move 50 frames in that direction, dragging will allow you to set the pointer to any frame you like. Note that on videos that use delta frames (divx, mpeg etc.) it will be much faster to scrub the Trackbar looking at only the keyframes. You can do this by holding the SHIFT key when dragging.

1) Stop button. Stops play, pretty simple.

2) Play Input - Plays through the input video file.

3) Play output - Plays the output file which will only be different if you are using any of the internal filters.

4) Skips to the first frame of the video.

5) Skips back one frame

6) Skips forward one frame

7) Skips to the end of the video.

8) Skips to the previous keyframe. With HuffYUV every frame is a keyframe, with avisynth every frame is considered to be a keyframe (even if the source doesn't have keyframes - may take longer to seek) and with divx, mpeg etc. keyframes will be interspersed throughout the file. You can hold shift and click on the Trackbar to scrub along the keyframes of a file.

9) Skips to next keyframe.

12) Set In point (start offset) - this sets the start of an area of a video you want to select. Any exporting will occur between Start and End offsets. By default the whole video is 'selected' but when you select an area it will appear in blue on the Trackbar as shown above.

13) Set Out point (end offset).
There is also a status display to the right of the control buttons, the image above tells us:
'Frame 85' - the frame number being displayed currently

'0:00:03.545' - the time of the displayed frame in Hours:Minutes:Seconds

'[K]' - shows that this is a Keyframe. Other letters are
[] - AVI Delta Frame
[D] - AVI Dropped Frame
[I] - MPEG Keyframe
[P] - MPEG P-frame
[B] - MPEG B-Frame
There is no symbol for AVI B-Frames

'[28.98 MB]' - On video files this will show you how many megabytes are in the file up to this point. Useful for splitting files. Obviously doesn't show anything with avisynth scripts.
All pretty straightforward stuff. Now that you know how to scrub the video file and set start and end points let's have a look at how you would export video in different ways.

The Video Menu


VDubMod Video MenuThe Video menu is where you set all the options for video processing.

Filters... This is where you can choose different things to alter the way your video looks such as resizing and so on. However, all of these things are done much much better in Avisynth. Using this guide you will never use these options - they only operate in RGB32 which is not always what we want.

Frame Rate... This is another option you will never want to use. Firstly the VirtualDub framerate setting isn't very sensible or stable, so it shouldn't be used. If you want to do any frame rate changing you should use Avisynth or AVIfrate which comes in the AMVapp.

Color Depth...
This just sets what bit depth will be displayed during decoding. The defaults are fine

Compression...
Aha! This is an option you will use a lot. This is where you set the Video Compressor you want to use when saving the file. This can be any Video for Windows compressor that is installed - the ones that will be used mostly in this guide will be HuffYUV, PicVideo Mjpeg and XviD.

Select Range... This does the same thing that you can do by scrubbing the Trackbar and setting the Start and End. It's useful if you know exact frame numbers.

Direct Stream Copy - This will take the input video and copy it exactly to an output. This is very useful for extracting sections of avi file. When setting a section to extract you should select keyframes otherwise the exported section may not play back.

Fast recompress - This is the option we will always use for compression. It takes the input video and send it to the Compressor without doing any conversion. As we will almost always use avisynth to process the video we can guarantee it is ready to be sent straight to the compressor.

Normal recompress - This converts the footage to RGB and then sends it to the compressor. Colorspace changes should always be avoided if possible - not recommended.

Full processing mode - This converts the footage to RGB, applies any internal VirtualDub-style filters and send the video to the compressor. Again any processing should be done in Avisynth for quality reasons, so this option will rarely be used if ever.

Copy/snapshot source/output frame - allows you to take the source or output frame and either copy it to clipboard or save it to a file (lossless file types are supported by default).

Scan video stream for errors - This means errors such as corrupted data and you'll probably never need to use it. If you do, you'll probably want to read the help files (press F1) as there's lots to learn about the way virtualdub can deal with corrupt video streams.

Error mode... This allows you to choose how virtualdub will report errors. Default is fine.

OK that should do as an overview of the video options. Before looking at ways to export the video you process in VirtualDubMod you will probably want to know where the audio options are.

Setting the Audio - The Streams Menu

This is the main thing that confuses traditional VirtualDub users. VirtualDubMod has a completely different way of dealing with audio which works in a way which is much more useful for people producing files in containers which can hold all sorts of video, audio and subtitle data. For avi users this extra level of sophistication isn't vastly useful, but there are nonetheless some very useful things offered by the new way of doing things, once you know how they work.

VDubMod Stream MenuVideo comments - This allows you to add things like *ahem* copyright information and other such data to your video file when exporting.

Video chapters - this only works for OGM and MKV streams. Allows you to set chapter information so people can skip to specific points in a file. Not much use for individual amvs but could be handy for projects with lots of different videos.

Stream list - THIS is where all the audio stuff has been hidden. We will have a closer look at this in a moment.

Report - this will display a little text dump of the streams that are going to be contained in your export.

Error mode... identical to the video error mode options.

To find the audio settings you will need to select Stream list. Inside you will get a menu dedicated to audio and subtitle streams.

The 'Stream list' menu
VDubMod Stream List

There's all sorts of things in this menu so let me explain what you can see here.

In this image, there are two audio streams - a WAV stream and an MP3 Stream. The WAV stream has been disabled (which is why it is checked with grey lines). If I exported a video with this stream list then I would get the second stream (the mp3 stream). I can also deselect the speaker icon which means the stream is not previewed in when playing in VirtualDubMod but it will still be exported.

Multiple audio streams are supported by all containers one way or another but will not be of great use to you as an amv creator. If you want to use these options you should read up on multiple audio streams as they sometimes need extra things installed for people to select which stream to hear.

Comments and Chapters - these are duplicates of the menu you saw before except you can put comments on the individual streams.

Save WAV - This is an option that allows you to select a stream in the list and do a direct conversion to a wav file.

Demux - This rips the audio data from the video without converting it to WAV. This will give a wav, mp3, ogg or whatever audio type was being used in the video.

Delete - This deletes a selected stream. If a stream is already part of the video you are working on this button will change to Disable/Enable.

Traditional VirtualDub users may be wondering where the audio processing options are. Fear not. By right-clicking a stream you will bring up a menu that looks just like the old VirtualDub audio menu:

VDUBMod Audio Compression OptionsInterleaving... This will allow you to set how your audio will be 'joined' to the video. Audio is separated and processed in frames just like video and for playback it is best if they are interleaved. You can check out the interleaving option but the default setting of 1 frame is fine for this. This also allows you to set any audio offset but with amvs it is unlikely that your audio will need to be offset to sync with the video, if edited correctly.

Compression...
This allows you to use ACM audio compression codecs. The only one you will even want to consider is 'Lame MP3' - this will be covered later when we look at audio compression.

Use advanced filtering - virtualdub now has options to do interesting things with audio such as Pitch shift, Gain, Chorus effects and so on. It's unlikely you will use them but they are fun to play with. If you select this option the Filters... option will become available to you. It works just like the video filters where you add audio filters one after another and choose their options.

Conversion... 
This is a simplified version of the filtering which does things like convert the sample rate of an audio stream. It is very unlikely that you will want to do this as things like stereo, sample rate, audio bit depth and so on should be kept as they were originally unless you have some particular reason to force a change.

Volume... Straightforward this one, boosts the audio relative to the current audio level. This can cause clipping however and is not as useful as normalisation, which we will discuss in the audio guides.

Direct Stream Copy - This will not process the input audio stream, it will just copy it as it. Useful.

Full processing mode - will convert the audio stream to wav, process it using any selected filters and then compress it using the ACM compressor chosen in the Compression menu. We will look at this in the audio encoding section.

We will return to these features when it comes to compressing audio but it should be clearer now how you use this section for adding and removing audio streams.

Avisynth Processing

This is, in my opinion, VirtualDubMod's most useful function and the main reason for its inclusion in the AMVapp. We've had a look at how you use Avisynth and I'm sure it seemed like an arduous chore to create these text files, load them up, look at them, go back and edit them, load them again.... Arduous no more. VirtualDubMod has a sophisticated Avisynth Script Editor that you can use to edit and see the changes in your avisynth scripts instantly.

When you load a .avs file into VirtualDubMod you can go to the Tools menu and choose Script Editor (or get there the quick way by pressing Ctrl-E) To Illustrate this, open the 'Colorbars' avs file with VirtualDubMod - it is located in 'Program Files/AMVapp/Example Scripts' then press Ctrl-E. This is what you should see something similar to this:

VDubMod AVS EditorThe Avisynth editor is a simple text editor but it has some very nice features, especially in the way it intergrates with VirtualDubMod.

The first thing you might notice is the way the functions are coloured. Functions that have been identified as being present in Avisynth (or in one of the plugins) are highlighted green. If you type in an incorrect function name (or one it doesn't recognise) it will stay black - if it thinks you have made a typo that is similar to a real function it will highlight the word in red.

Inside the brackets we have the function options highlighted blue. File names are usually highlighted in maroon. If you change the settings of colorbars to colorbars(720,4blah) it will be highlighted in red as an obvious error.

So let's try resizing the video and see how this works in VirtualDubMod. Add the following line to the end of the script:
bicubicresize(320,240)
If you have typed it in correctly it should have the correct highlighting. Now press F5.

As if by magic, the changes are shown straight away in VirtualDubMod. What has happened is that the avs script has been saved, reloaded and VirtualDubMod has seeked the video to the last frame you were looking at. This is immensely useful as it means you can apply filters and see exactly how they affect a particular frame straight away. Note that unlike VirtualDubMod's internal filtering, avisynth filtering will be shown in both input and output windows. If it doesn't refresh (rare) then you may have to open the avs file in the program again. You can see this option listed individually in the File menu along with many others - all of them should be pretty self explanatory: just remember that F5 will save your script so you cannot revert if you have looked at the results using F5. You can, thankfully use Undo (Ctrl-Z) as well to undo things you may have done wrong.

This method of playing with avs scripts is so much easier than using wordpad and importing, but you will need to resort to wordpad on occasion - particularly if you have a script which is crashing VirtualDubMod in nasty ways :)

This functionality alone makes this priceless but there are even more tricks that you can do with avs in VirtualDubMod:

Select a Start and End area on the VirtualDubMod Trackbar. Now go to the edit menu and choose Insert Trim with Range (Ctrl T) and you will see that the range you selected has been inserted into your script at the current cursor position as a Trim command. The Edit menu contains lots of handy things like this. Of course, you need to make sure the current cursor position is where you want the function to be pasted.

Other useful things in the Edit menu are:
Insert position (Ctrl P) will type the number of the current frame you are viewing into your script.

Insert filename (Ctrl+Shift+O) will bring up a Windows File explorer for you to locate the file you want to be pasted into your script - you need never suffer from long-winded typing of directory names ever again.

Import Frameset as Trims is a complex function that uses the Mask Area function in the VirtualDubMod edit menu to work out a whole series of Trims. Can easily go wrong, so just stick to one trim at a time :)

Comment/Uncomment selected lines will add a # symbol in front of any selected lines so they are ignored by Avisynth.

Script Handling will allow you to choose what kind of things should be highlighted. By default avisynth function highlighting is selected but there is also an option specifically for getting Decomb options working (Telecide and Decimate).
As you can see this all makes avisynth use much much easier. There is one final option that I haven't talked about and that is [Toff]s Tweaking Mod. If you choose the Help menu you can click the option to see a description of what this can do. It's a handy little function.

Exporting Video

This is the easy part. When you have your source looking the way it should be, your video options set and your audio streams set you are ready to export a video. To do this, all you have to do is go to the File menu, choose Save As... and save the file where you want.

In VirtualDubMod save options there are a few things to note which are not present in the traditional VirtualDub. First of all you can save the file as AVI, OGM or MKV. The others are advanced containers that we will talk about later so until you know more about them save everything as AVI as usual. In VirtualDubMod there is also small section at the bottom of the Save As window which allows you to change the Video processing mode in case you have set it incorrectly and you can also check which compressor is being used (if you are compressing).

One final option which has never been talked about in previous guides is Job Control. You will notice that there is an check box that says: "Don't run this job now, add it to job control so I can run it in batch mode."

When you do this, instead of saving the file it will, as it says, add the command to Job Control. You can then set up more exports and add them to Job Control so you can run them all in one go later. This is especially useful if you are making clips from a dvd source as you can keep adding them to job control and then encode them all in one go. Job control can be accessed from the File menu or by pressing F4.

Job Control

VDubMod Job Control
Most of the Job Control is self-explanatory. Start, Abort and Skip will tell the batch processing to Start, Abort or Skip to the next file. Postpone will set something to postponed so it won't be processed this time - pressing postponed again will reset it to Waiting.

You can save job lists in the File menu in order to load them later and in the Options menu you can choose an option to have your system shutdown when all the jobs are finished.

Possibly the best function of Job Control can be found in the Edit menu and is called Process Directory...

If you have VirtualDubMod set up to compress in a particular way and then go to the Job Control, you can select a Directory in which you will convert every file in that directory using the options you have set. After selecting the source directory it will ask for your output directory for the new files to be saved.

This is really great if you have a bunch of avs files that you want converting into mjpeg files.

One word of warning is that it will select every file, so you may get a whole bunch of things that are not video files that you do not want to convert. You can Delete these from the list manually or make a new folder for all the files you want converting and another for the converted files.

A very useful tool, I'm sure you agree.

I think that's about all for the VirtualDubMod info. There are many other features of this program to explore including the Capturing features and other settings. Some of these we will look at later in the guide and others you can investigate yourself to see if they are of any use to you. It's an essential tool for any Windows video user so I hope this has given you a decent idea about how it works.