Vapoursynth BWDIF

From wiki.selur.net
Jump to navigation Jump to search

Bwdif ("BobWeaver") is a fast motion-adaptive deinterlacer. It keeps one field of each frame and rebuilds the missing lines from the spatial and temporal neighbors, either at the source frame rate or as a bobber at double rate.

Filtering → (De-)Interlace/Telecine → Deinterlacer

Bwdif controls in Hybrid
Bwdif controls in Hybrid

What it does

Where the picture holds still, Bwdif weaves in the lines of the other field; where there is motion it interpolates them. Its own spatial interpolation is a cubic filter; optionally the spatial prediction can come from NNEDI3 or EEDI3 instead (edeint), which gives cleaner diagonal edges at the cost of speed.

Settings

Control Parameter Range / values Hybrid default Meaning
Field field 0 – 3 2 0/1: same frame rate; 2/3: double frame rate (one frame per field). The parity part (0 = bottom, 1 = top, 2 = start with bottom, 3 = start with top) is overridden by the clip's field order, so in practice the control only chooses single or double rate.
edeint edeint none, NNEDI3, EEDI3 none External clip for the spatial prediction; built from the same clip with the same field setting.
NNEDI3: Neighbourhood nsize 8x6, 16x6, 32x6, 48x6, 8x4, 16x4, 32x4 32x4 Size of the area NNEDI3 looks at (only with edeint NNEDI3).
NNEDI3: Neurons nns 16, 32, 64, 128, 256 32 Size of the neural network; more is slower and slightly better.
NNEDI3: Error etype absolute error, square error absolute error Which set of trained weights NNEDI3 uses.
Tools: nnedi3 / eedi3 – e.g. znedi3, nnedi3cl, eedi3m, vszip – Implementation of the edeint helper; GPU implementations also get a device choice.

The NNEDI3 values are only written when they differ from the defaults; EEDI3 has no settings of its own on this page.

Example

Default settings on an 8-bit YUV 4:2:0 interlaced source (704x576, 25 fps, top field first):

# Deinterlace using Bwdif
clip = core.bwdif.Bwdif(clip, field=2) # new fps: 50
# Making sure content is perceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive

How Hybrid calls it

  • Field order: Hybrid marks the field order on the clip after the source (from the detected scan type or Overwrite input scan type). Bwdif and the NNEDI3/EEDI3 helpers follow this property, so the field parity chosen under Field does not matter as long as the order is known.
  • Output frame rate: Field 0/1 keeps the source rate; Field 2/3 doubles frame rate and frame count.
  • Afterwards the clip counts as progressive. No decimation.
  • Works on 8–16-bit integer YUV; no thresholds need bit-depth scaling.

Background

Bwdif comes from FFmpeg and combines ideas of yadif (motion check) and w3fdif (interpolation filter). The VapourSynth plugin is a port from HomeOfVapourSynthEvolution; besides 8–16-bit integer it also accepts 32-bit float. An external edeint clip must have the same size and format and the same (single rate) or double (double rate) frame count. Bwdif is much faster than QTGMC or QTempGaussMC, but does not remove bob shimmer.

Sources