Smart Bob Filter for VirtualDub

This filter acts similarly to the Smart Deinterlacer filter, except that it produces a doubled frame rate output file. For example, if the input is 30 frames per second (fps) interlaced, the output will be 60 fps progressive. Each output frame is created from a single input field by either interpolating data or by using data from the previous frame (=field, see below), depending upon whether the area is detected as moving or not. The filter uses bicubic interpolation for best results. It also provides a "dumb bob" mode by which the entire frame can be interpolated regardless of motion.

This filter thus allows the maximum possible spatial and temporal information to be extracted from an interlaced input clip. If the frame rate is left at double the input rate, and if the hardware can play at or near that rate, then very smooth movement (double the temporal resolution) results. If the frame rate is set back to the original input frame rate in the AVI header, a very smooth half speed slow-motion effect results. This latter mode is highly useful for analysing clips of sports or other actions that need to be studied.

The Smart Bob filter acts on a clip after it has had its fields split into frames. There are two ways to achieve this. First, if you have an MJPEG clip encoded with 2 fields, you can use VirtualDub's extended open options. When opening your input file, check the "Popup extended open options" checkbox. Then, when the extended open dialog appears check "Split interlaced frame into two fields". You can use the swapped version if your capture card has reversed field dominance (you can tell because when you single-step, things move backward every other frame). Second, for clips that are not MJPEG encoded with two fields, Ben Rudiak-Gould's excellent utility, Avisynth, can be used as a preprocessor to split the fields into frames. It is very easy to use.

To use Avisynth, first download the Avisynth DLL from:

    www.math.berkeley.edu/~benrg/avisynth.html

Install it as described in the zip file. Then create a file called "clip.avs" that contains:

    clip=AVISource("f:\capture.avi")
    clip.SeparateFields

Note that the AVISource() call contains the path to the input clip. Now, when you open "clip.avs" in VirtualDub, you'll get the input clip with its fields changed into half-height frames. If your capture card has reversed field dominance (you can tell because when you single-step, things move backward every other frame), then use:

    clip.ComplementParity.SeparateFields

Finally, if you have a pathological codec and your video appears upside-down, contact me or Ben to get an external FlipVertical filter that is not included in the current release of Avisynth (0.3 as of this writing), or use VirtualDub's internal "flip vertical" filter.

After setting up the splitting of fields to frames, you now simply add the Smart Bob filter in the usual way. For those familiar with the Smart Deinterlacer filter, you should know that Smart Bob always uses field-only differencing, and compares the luminance of pixels to determine motion. Motion map denoising is optional. A future version may add the same options that Smart Deinterlacer has.

The following options are available:

Show motion areas only  When selected, only the moving areas of the image are displayed; static areas are black. This option can be used to assess the suitability of the choice of threshold. Note that this mode is designed only for assessing the threshold suitability; therefore, it uses line doubling and does not shift every other field up a line, so you will see slight up and down oscillation. The fully processed output, of course, uses bicubic interpolation and shifts every other frame up to align the fields.

Even-numbered frames (0-based) contain top fields  After the fields were split, the bottom field was placed into a separate frame. In effect, this makes it one-half line higher than it should be relative to the top field. To correct this, after the frames are resized to full height, the frame containing the top field gets shifted up by one full line (the height was doubled so a half-line shift becomes a full-line shift). This checkbox tells the filter which frames contain the top and bottom fields after the split. This may vary depending upon the field dominance of the input clip.

Threshold  This value determines the sensitivity of the motion detection process. A threshold that is too low will cause too much of the image to be treated as moving, reducing the perceived resolution. A too low threshold will also tend to emphasize noise. A threshold in the range of 10 to 25 will be good for most clips. You can view the effect of threshold on motion detection by selecting the "Show motion areas only" checkbox. Try to find a threshold that displays only the moving areas in this mode.

If the threshold is set to 0, all areas of the frame are considered to be moving. The result is a "dumb bob" in which no data from the previous frame (=field) is used and the vertical size doubling is achieved using interpolation for all of the frame.

Motion map denoising  When this checkbox is checked, extra filtering is added in the motion detection pipeline (not in the main video pipeline, so the ouput video is not compromised) that does a good job of suppressing false motion noise. The downside is that the filter may run slower. But it may run faster too, if there is little motion.

Use the "Show motion areas only" option to tweak the threshold fairly low without introducing false motion noise.

Slow-motion effect  If you set the frame rate back to the input clip's rate using VirtualDub prior to saving the output file, you will obtain a very smooth half-speed slow-motion effect.

Note that due to the nature of interlaced video, some "flutter" may result from horizontal features of one or a few pixels. Flutter can be reduced by using motion-map denoising and a higher threshold. Additionally, some clips can benefit from the application of the dynamic noise reduction filter with a relatively high threshold applied after this filter.

Version 1.1 beta 2 [Source code]

Version 1.1 beta 2 corrects a problem that caused a spurious black line at the top of the frame.

Version 1.1 beta 1 made the following changes: 1) The executable was reduced from 56K to 24K. 2) The interpolation was made bicubic instead of bilinear. 3) A "dumb bob" mode wass provided. 4) The filter was made faster. 5) The help file was changed to HTML. 6) The "show motion only" mode was changed to pass moving video through instead of displaying white. 7) The source code implementation was dramatically improved and optimized.

Version 1.0 beta 1 changed the label on the checkbox that determines which frames contain the top and bottom fields from the input clip, and revises the help file accordingly. Beta 2 added an option to turn on/off motion map denoising, and set better parameters for the denoising filter.

[up to home page]