Vapoursynth AnimDeblend

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

AnimDeblend removes blended frames from animation (cartoons, anime) that follows no fixed telecine pattern. Each blend is replaced by the drawing it mostly shows, so frame count and frame rate stay the same.

Filtering → Vapoursynth → Frame → Deblend

AnimDeblend controls in Hybrid
AnimDeblend controls in Hybrid

What it does

AnimDeblend handles drawings with irregular timing that were blended into their neighbors, blends that recur every 2–8 frames, single blends, and – with Unghost – faint copies of a neighbor in fast pans. Two analyses are available: anchor treats every frame as either a drawing or a blend of the surrounding drawings, cadence looks for blends that repeat with a period of 2–8 frames plus single clear blends; both runs both. A detected blend is replaced by its dominant drawing. The filter is meant for animation only: smooth live-action motion is easily mistaken for blends.

Settings

Control Parameter Range / values Hybrid default Meaning
Mode mode anchor, cadence, both anchor Which analysis finds the blends.
Strength strength 0.0 – 1.0 1.0 1 replaces a blend fully, lower values mix towards the replacement; with Unghost it also scales the ghost removal.
MinWeight minweight 0.01 – 0.49 0.1 Smallest share of the weaker drawing that still counts as a blend.
Unghost unghost on/off off Subtract faint copies of a neighbor in fast pans.
Fill fill on/off on Fill gaps of up to 3 frames in a regular run of blends and extend a run by one frame.
Rho rho 0.01 – 1.0 0.1 Anchor analysis: larger values find more blends (VHS sources: about 0.2). Not used by cadence.
MaxGap maxgap 2 – 100000 4 Anchor analysis: longest distance between two drawings. Not used by cadence.
Kappa kappa 0.1 – 20 3.0 Anchor analysis: cost of a drawing in noise units. Not used by cadence.
Switch switch 0 – 10 1.5 Cadence analysis: cost of starting, ending or changing a cadence. Only with cadence or both.
Width width 16 – 1920 (step 16) 160 Width of the downscaled luma used for the blend analysis; the ghost analysis runs at 720.
Block block 0 – 100000 512 Frames analysed per block when first requested; 0 = whole clip at once.
Overlap overlap 0 – 4096 128 Context frames on each side of a block.
Show – on/off off Print the detection results (blend, the two drawings, weight, ghost) onto the frame.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# removing blends in animation with AnimDeblend
clip = core.exblend.AnimDeblend(clip)

How Hybrid calls it

  • AnimDeblend works on 8–16-bit integer and 32-bit float YUV and gray clips, as they are. It needs progressive input; interlaced material is deinterlaced first.
  • Values are only written when they differ from the defaults (Hybrid's defaults are the plugin's); mode-specific options only in the modes that use them. No value depends on the bit depth.
  • Frame count and frame rate do not change.
  • Show adds a text overlay of the detection frame properties after the filter.
  • The analysis works in blocks: jumping to a new place in the preview takes a few seconds.
  • AnimDeblend also offers the common options (Gimmick only).

Background

ExBlend plugin

AnimDeblend is part of the ExBlend plugin (VapourSynth only), next to Vapoursynth ExBlend, which handles blended telecine with a fixed pattern. The plugin stores its decisions in frame properties (blend flag, the two source drawings and the weight, and the ghost values), which Show prints. It runs on the CPU.

Sources