Decimate Filter for VirtualDub

This filter acts on the output of the Telecide filter (or any other stream of progressive frames derived from a de-telecined clip) and deletes extra duplicated frames, while enforcing a desired decimation ratio. For example, suppose Telecide has been used to produce a clip containing progressive frames derived from 3:2 pulldown material. Decimate can take the processed clip as input and delete the duplicated frames by deleting one frame out of each group of five. Actually, because VirtualDub filters cannot delete frames, Decimate writes an Avisynth script that is used to do the actual frame deletion. It is acknowledged that this is a cumbersome procedure. The next generation of VirtualDub will allow filters to delete frames. Avisynth is available from a link given on the main page of this site. Version 0.3 (not 1.0 beta 3) is the most stable and reliable version.

First, detailed instructions for using Decimate are given, then the options are described. The following example is for 3:2 pulldown removal.

1. Use Telecide to convert the pulldown material to a clip containing progressive frames. (You can place Telecide ahead of Decimate in the filter chain, or do it separately as in this example.)

2. Start VirtualDub and load the processed clip. Add the Decimate filter and select the Decimate 1 in 5 checkbox. Using the Browse button, specify the path and file name for the Avisynth script to be written. Hit OK twice to close the filter dialog and return to the VirtualDub main window.

3. Hit VirtualDub's rewind button on the timeline player (|<). Now hit the play button (>o). When the clip has finished playing, do not hit any player buttons and exit VirtualDub.

4. Edit the generated Avisynth script as desired. At a minimum this will require you to add a clip source command above the DeleteFrame() lines. For example:

AVISource("d:\don\test.avi")
DeleteFrame(1)
...

Obviously, the specified clip should be the same one that was input to Decimate.

5. Restart VirtualDub and load the Avisynth script. Set the desired compression and set the output frame rate appropriately (4/5 of the original). Save the AVI. The output AVI will be the final inverse telecined product.

The filter has the following configuration options:

Path for Avisynth delete script: Use the Browse button to specify the destination path and filename for the output script.

Decimate 1 in 2: Select this option to remove one of every two frames. For example, you may have a 12fps source that was doubled up to 24fps and then sped up to 25fps for PAL transmission.

Decimate 1 in 5: Select this option to remove one of every 5 frames. This is useful for removing 3:2 pulldown. (Other decimate ratios are under development.)

Threshold: This determines how the frame duplicate detection operates. If you reduce this value, frames must be closer to each other to be considered duplicates. If you increase it, frames can be more different and still be considered duplicates. The value 100 is a good general-purpose setting. If tweaking is necessary, do it in conjunction with the DebugView checkbox, as described below.

DebugView: If the DebugView checkbox is checked, the filter outputs tweaking information that is viewable using the DebugView utility available on the home page of this web site. For example, here is a line that may be emitted after a group of 5 frames in decimate 1 in 5 mode:

10: 10111, deleting 11

The first number, 10 is the starting frame number of the group of 5. The next field is a 5-digit binary number corresponding to the 5 frames in the group. A '0' denotes that the frame was detected as a duplicate of the preceding frame. A '1' denotes that it was not a duplicate of the preceding frame. Thus, in the example, frame 11 has a '0'. The last field indicates which of the frames will be deleted. Please note that the frame numbers here are the absolute frame numbers in the source clip. They do not correspond to the frame numbers used in the Avisynth DeleteFrame() lines because as each frame is deleted all the following frame numbers reduce by one.

The debug output can be used to tweak the threshold. Set a threshold such that only the duplicated frames show up as '0'.

Thanks to Simon Walters for suggesting the idea of writing Avisynth scripts to delete frames (VirtualDub filters cannot delete frames).

Version 1.0 beta 4 Beta 4 now produces correct video in the output pane to allow Telecide to be placed ahead of it in the filter chain and produce correct final output. Also, the filter now uses the DebugView utility instead of writing an alternate script file.

Beta 3 fixed problems with the Browse function: 1) it now works in Windows 2000; 2) doesn't clear the filename edit box if you hit cancel in the file dialog; and 3) defaults to file type *.avs.

Beta 2 is functionally identical to beta 1 but much faster.

[Назад]