Files
Video-Processing-Scripts/video-processing-scripts/RIFE.md
T

99 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# RIFE 4.26 on Windows 11 — Command-Line Installation Guide
There are two pieces you need: the **binary** (the `rife-ncnn-vulkan` executable) and the **model** (rife-v4.26 weights). The upstream nihui release is stuck at models up to v4.6, so you'll use **TNTwise's fork**, which maintains up-to-date model support including v4.26.
---
## Step 1 — Download the Binary
The actively maintained fork for newer models is TNTwise's `rife-ncnn-vulkan` at [https://github.com/TNTwise/rife-ncnn-vulkan](https://github.com/TNTwise/rife-ncnn-vulkan).
1. Go to: [https://github.com/TNTwise/rife-ncnn-vulkan/releases](https://github.com/TNTwise/rife-ncnn-vulkan/releases)
2. Download the latest Windows zip, e.g. `rife-ncnn-vulkan-YYYYMMDD-windows.zip`
3. Extract it to a folder, e.g. `C:\tools\rife-ncnn-vulkan\`
The package includes all binaries and models required — it is portable, so no CUDA or PyTorch runtime environment is needed.
---
## Step 2 — Add to PATH
To run `rife-ncnn-vulkan.exe` from any directory (instead of always `cd`-ing into the install folder), add the extraction folder to your system **PATH**:
```text
C:\tools\rife-ncnn-vulkan\
```
You must also define the environment variable **RIFE_HOME** and set it to the same folder:
```text
RIFE_HOME=C:\tools\rife-ncnn-vulkan\
```
> **Note:** `RIFE_HOME` must point to the same directory that is added to PATH. RIFE locates its model files via the `-m` command-line flag, not through environment variables, but `RIFE_HOME` is still required.
---
## Step 3 — Basic Usage (Interpolate Between Two Images)
To interpolate between two images and produce a middle frame:
```cmd
rife-ncnn-vulkan.exe -0 frame0.png -1 frame1.png -o middle.png -m %RIFE_HOME%\rife-v4.26
```
To process a whole directory of frames:
```cmd
rife-ncnn-vulkan.exe -i input_frames\ -o output_frames\ -m %RIFE_HOME%\rife-v4.26
```
---
## Full CLI Reference
Key flags:
| Flag | Meaning |
| ------ | --------- |
| `-0 <path>` | First input image (jpg/png/webp) |
| `-1 <path>` | Second input image |
| `-o <path>` | Output image or directory |
| `-m <path>` | Model path (point to your `rife-v4.26` folder) |
| `-g <id>` | GPU device: `0`, `1`, `2` for GPU, **`-1` for CPU** |
| `-j <n:n:n>` | Thread counts for load:proc:save |
| `-n <count>` | Number of frames to generate between the two inputs (default: 1) |
| `-v` | Verbose output |
---
## Running Without a GPU (CPU Mode)
You can run on CPU by setting `-g -1`.
```cmd
rife-ncnn-vulkan.exe -0 frame0.png -1 frame1.png -o middle.png -m %RIFE_HOME%\rife-v4.26 -g -1
```
You can also run on CPU, discrete GPU, and integrated GPU simultaneously:
```cmd
rife-ncnn-vulkan.exe -i input_frames\ -o output_frames\ -g -1,-1,0,1 -j 2:4,4,2,1:4
```
**Important caveat:** CPU mode works but is significantly slower — expect 10–30× slower processing compared to even an integrated GPU. For a single pair of 1080p frames it's tolerable; for video interpolation it will be very slow.
---
## Quick Test Checklist
```cmd
# Verify the binary runs
rife-ncnn-vulkan.exe -h
# Single frame interpolation test (CPU, no GPU needed)
rife-ncnn-vulkan.exe -0 A.png -1 B.png -o middle.png -m %RIFE_HOME%\rife-v4.26 -g -1 -v
```
If you get a Vulkan error with GPU mode, make sure your GPU drivers are up to date. CPU mode (`-g -1`) requires no Vulkan device at all.