Vapoursynth ReplaceSingle

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

ReplaceSingle replaces single, listed frames – for example a frame with a flash, a glitch or a splice – with a frame interpolated from its two neighbors.

Filtering → Vapoursynth → Frame → Replace

ReplaceSingle controls in Hybrid
ReplaceSingle controls in Hybrid

What it does

Every listed frame N is rebuilt by interpolating between frames N−1 and N+1. The first and the last frame of the clip cannot be replaced, since they lack a neighbor. The clip keeps its length and frame rate. For several consecutive frames use ReplaceMultiple; to simply repeat the previous frame use DuplicateFrames.

Requirements

  • svp, svp_gpu: SVP must be installed (only then are they listed).
  • rife: a Vulkan-capable GPU.
  • mv: CPU; the mvgpu implementation needs Vulkan.

Settings

Control Parameter Range / values Hybrid default Meaning
Frames frames comma-separated frame numbers empty Frames to replace. Empty = the filter does nothing.
Method method mv, svp, svp_gpu, rife mv Interpolator: MVTools, SVP on the CPU, SVP on the GPU, or RIFE.
RIFE: Model – RIFE models rife-v4.5 (ensemble) RIFE model (method rife).
RIFE: TTA / UHD – on/off off / off Test-time augmentation (not available for v4 models); UHD mode for large frames (method rife).
Debug debug on/off off Shows debug information in the preview.
Tools: MV – mvgpu, mvutensils, mv – MVTools implementation (method mv).

Example

Frames 100, 200 (the field is empty by default, which writes nothing), otherwise default settings, on a 10-bit YUV 4:2:0 source (640x356):

from FillDuplicateFrames import FillDuplicateFrames
fdf = FillDuplicateFrames(clip=clip, mode="Replace", frames=[100,200], method="mv", sceneThr=0, tools={'mv': 'mvutensils'})
clip = fdf.out

How Hybrid calls it

  • Color formats: svp and svp_gpu work on 8-bit YUV 4:2:0, mv on 8–16-bit YUV, rife on 32-bit float RGB; the clip is converted as needed.
  • Every listed frame is replaced; there is no duplicate or scene change check.
  • RIFE options are only written for method rife.
  • Replaced frames keep the frame properties (such as the frame duration) of the original frame.
  • Frame count and frame rate do not change.

Background

Interlaced material

Hybrid also allows ReplaceSingle on interlaced material, but the interpolation works on whole frames, not on fields.

Sources