Vapoursynth TorchDRBA: Difference between revisions

From wiki.selur.net
Jump to navigation Jump to search
New filter page (via create-page on MediaWiki MCP Server)
 
Update to current Hybrid behaviour; code as <pre> (via update-page on MediaWiki MCP Server)
 
Line 11: Line 11:
== Requirements ==
== Requirements ==
* Windows with an NVIDIA graphics card (CUDA) and Hybrid's torch add-on (package vsdrba); without it the method is not offered.
* Windows with an NVIDIA graphics card (CUDA) and Hybrid's torch add-on (package vsdrba); without it the method is not offered.
* TensorRT acceleration needs Torch-TensorRT.
* TensorRT acceleration needs Torch-TensorRT; the TensorRT checkbox is only enabled when it is installed.


== Settings ==
== Settings ==
Line 47: Line 47:
== Example ==
== Example ==
Default settings on a 10-bit YUV 4:2:0 source (640x356, 25 fps), interpolated to 50 fps:
Default settings on a 10-bit YUV 4:2:0 source (640x356, 25 fps), interpolated to 50 fps:
<syntaxhighlight lang="python">
<pre>
clip = misc.SCDetect(clip=clip, threshold=0.100)
clip = misc.SCDetect(clip=clip, threshold=0.100)
from vsdrba import drba_rife
from vsdrba import drba_rife
Line 54: Line 54:
# adjusting frame count&rate with DRBA (torch)
# adjusting frame count&rate with DRBA (torch)
clip = drba_rife(clip, model="4.25", sc=True) # new fps: 50
clip = drba_rife(clip, model="4.25", sc=True) # new fps: 50
</syntaxhighlight>
</pre>


== How Hybrid calls it ==
== How Hybrid calls it ==

Latest revision as of 09:53, 16 November 2026

TorchDRBA (Distance Ratio Based Adjuster) is a RIFE-based frame interpolator aimed at animation. It runs in PyTorch on an NVIDIA GPU, optionally with TensorRT.

Filtering → Vapoursynth → Frame → Interpolation

TorchDRBA controls in Hybrid
TorchDRBA controls in Hybrid

What it does

Anime often holds a drawing for several frames, which plain interpolation turns into uneven motion. DRBA uses RIFE to build the new frames but adjusts where in time they are placed, so that held drawings move more evenly.

Requirements

  • Windows with an NVIDIA graphics card (CUDA) and Hybrid's torch add-on (package vsdrba); without it the method is not offered.
  • TensorRT acceleration needs Torch-TensorRT; the TensorRT checkbox is only enabled when it is installed.

Settings

Tick Frame Interpolation and pick TorchDRBA in the method list.

Control Parameter Range / values Hybrid default Meaning
Factor/FPS – on/off on On: multiple of the input rate; off: absolute target rate.
Factor (num/den) factor_num, factor_den 1 – 120000 2/1 Multiple of the input rate.
FPS (num/den) fps_num, fps_den 1 – 120000 2/1 Target frame rate; the default of 2 fps must be changed before this mode does anything.
Model model 4.0 – 4.26.heavy 4.25 RIFE model version used inside DRBA.
GPU id device_index 0 – 4 0 GPU to use.
FP16 – on/off off Half precision: the clip is fed as 16-bit float RGB.
TensorRT trt on/off off Builds a TensorRT engine; not for models 4.0 and 4.1.
max WSS trt_workspace_size 0 and up 0 TensorRT workspace limit in bytes; 0 = no limit.
CUDA streams trt_max_aux_streams 1 – 64 3 Maximum number of auxiliary TensorRT streams; only with TensorRT.
Scale scale 0.25 – 4.0 1.0 Resolution of the flow estimation; not with Ensemble.
Ensemble ensemble on/off off Ensemble variant of the model (slower).
Scene detection / threshold sc on/off, 0.001 – 1 on, 0.1 Detects cuts before DRBA so they are not interpolated.
Manual scene changes sc on/off, frame list off List of the last frames before each cut; excludes the automatic detection.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356, 25 fps), interpolated to 50 fps:

clip = misc.SCDetect(clip=clip, threshold=0.100)
from vsdrba import drba_rife
# adjusting color space from YUV420P10 to RGBS for vsTorchDRBA
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_in_s="limited", range_s="full")
# adjusting frame count&rate with DRBA (torch)
clip = drba_rife(clip, model="4.25", sc=True) # new fps: 50

How Hybrid calls it

  • The clip is converted to 32-bit float RGB (16-bit with FP16).
  • In factor mode the factor is written only when it is not 2/1; in FPS mode the target rate is always written. If the new rate would not be higher than the input rate, the filter is skipped with a note in the script and the frame rate stays.
  • The model, the GPU id and scene detection (sc) are always written; the package's own default model is 4.26.heavy and its scene detection is off by default. The stream count is written whenever TensorRT is on.
  • With scene detection Hybrid runs the detection itself before DRBA and writes sc=True; manual scene changes mark the listed frames and also write sc=True. With both off, sc=False is written and cuts are interpolated like any other frame.
  • TensorRT engines are cached in Hybrid's temporary folder.

Background

VS-DRBA

VS-DRBA is an MIT-licensed fork of vs-rife by routineLife1. It needs PyTorch, cupy (important for speed) and, for its own scene detection, the misc plugin; the author's benchmark shows it faster than vs-rife. Without its own detection it reads cut markers already set on the frames, which is how Hybrid uses it.

TorchRIFE is plain RIFE in PyTorch.

Sources