FAQ using virtualdub plugins

From Avisynth wiki
Revision as of 12:36, 2 July 2018 by Pinterf (Talk | contribs)

Jump to: navigation, search

| Main Page | General Info | Loading clips | Loading Scripts | Common Error Messages | Processing Different Content | Dealing with YV12 | Processing with Virtualdub Plugins |


Contents

Where can I download the latest version of scripts which import filters from VirtualDub?

The AviSynth scripts are on the Shared_functions page, or you can download a package called vdub_filtersv15.zip from [1].


Which filters can be imported?

Most filters. Read the corresponding documentation.


AVS+ Since Avisynth+ r2724 LoadVirtualdubPlugin was updated to support newer interface versions. This update changed the supported interface version from V6 to V20, and Filtermod version 6 (partial support)

Supported extras:

  • VirtualDub2 support with extended colorspaces
  • Allow RGB24, RGB48, RGB64 besides RGB32
  • RGBP/RGBAP 8 bit: since this format is not supported directly by Virtualdub filters, LoadVirtualdubPlugin automatically converts 8 bit Planar RGB to/from RGB24, RGBAP to/from RGB32 (lossless)
  • RGB48/RGBP16/RGBAP16: since this format is not supported directly by Virtualdub filters, LoadVirtualdubPlugin automatically converts them to/from RGB64 (lossless)
  • YUV(A) 8 bits: YV12, YV16, YV24, YV411, YUVA420P8, YUVA422P8, YUVA444P8
  • YUV(A) 10-16 bits (properly set "ref_x" maximum levels, no autoconvert)
  • Supports prefetchProc2 callback (API >= V14 and prefetchProc2 is defined) for multiple input frames from one input clip
  • PrefetchFrameDirect and PrefetchFrame are supported. PrefetchFrameSymbolic not supported
  • Supports prefetchProc callback (API >= V12 and prefetchProc is defined)
  • Supports when filter changes frame count of the output clip
  • Supports specifying some colorspace properties. See rangehint

Do these scripts work in RGB-space or in YUV-space?

You need to convert your clip to RGB32 before applying these scripts.
AVS+ The filter bundled for Avisynth+ r2724 allows to use YUV color spaces, with some 10 and 16 bit formats (both RGB and YUV) as well (Virtualdub2)

How do I make such a script?

Take a look at the following example script (this VirtualDub filter can be downloaded from Donald's homepage):

Smart Bob by Donald Graft:

function VD_SmartBob(clip clip, bool show_motion, int threshold, bool motion_map_denoising)
{
  LoadVirtualdubPlugin("d:\bob.vdf", "_VD_SmartBob", 1)
  return clip.SeparateFields._VD_SmartBob(clip.GetParity?1:0,
    \  default(show_motion,false)?1:0, default(threshold,10),
    \  default(motion_map_denoising,true)?1:0)
}

The VirtualDub plugin is imported with the command "LoadVirtualDubPlugin". The first argument gives the path of the plugin, the second argument the name for the plugin that will be used in the script and the third argument is called the preroll.

The preroll should be set to at least the number of frames the filter needs to pre-process to fill its buffers and/or updates its internal variables. This last argument is used in some filters like: SmartBob, SmartDeinterlace, TemporalCleaner and others. The reason is that due to filtering architecture of VirtualDub the future frames can't be accessed by a filter. Dividee reports: "In the "Add filter" dialog of VirtualDub, some filters have a "Lag:" value in their description. I think this is the value that must be used as preroll. Unfortunately, this indication is not always present. In those cases you have to guess." Of course you can always ask the creator of the filter.

The first step is to find out the sequence of the arguments in the last line where the clip is returned. Configure the script in VirtualDub and select "Save processing Settings" in the File Menu or press Ctrl+S. Open the created .vcf file with a text editor and you should see lines like this:

VirtualDub.video.filters.Add("smart bob (1.1 beta 2)");
VirtualDub.video.filters.instance[0].Config(1, 0, 10, 1);

The order of the arguments is the one that has to be used in AviSynth. To find the role of the arguments, play with them in VirtualDub and examine the resulting lines.

The second step is to test the filter and to compare it with the VirtualDub filter itself. For the programming itself you can learn a lot by looking at the script which are already contained in vdub_filters.avs.

Example script which uses the function VD_SmartBob:

Import("d:\vdub_filters.avs")
AviSource("d:\filename.avi")
ConvertToRGB32()  # only when necessary (but doesn't hurt)
VD_SmartBob(false, 10, true)
ConvertBackToYUY2()  # only when necessary

The package vdub_filtersv15.zip is a bit outdated since many new VirtualDub filters are not in it. If that's the case for your VirtualDub filter and you don't want to create a function yourself (such as VD_SmartBob), could also use the following script:

LoadVirtualdubplugin("d:\bob.vdf", "VD_SmartBob", 1)
VD_SmartBob(1, 0, 10, 1) # parameters taken from the .vcf file


| Main Page | General Info | Loading clips | Loading Scripts | Common Error Messages | Processing Different Content | Dealing with YV12 | Processing with Virtualdub Plugins |

Personal tools