Skip to content

We0M/realtime-RIFE-portable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Realtime RIFE Portable Setup for MPV (MPC-HC) + VapourSynth + vs-mlrt

English | Русский

Step-by-step guide for setting up a fully portable build for real-time video interpolation with RIFE in MPV.

Important

This guide is aimed at NVIDIA RTX on Windows, so interpolation.vpy uses Backend.TRT (TensorRT) — the fastest backend for NVIDIA RTX cards.


Warning

On an RTX 3070 (no undervolt or OC, 240w) with TensorRT, real-time interpolation is available for:

  • x2: source ≤ 1080p ~30 fps - any base model; source == 1440p ~24 fps - 4.17_v2_light, 4.6v2.
  • x3: source ≤ 1080p ~30 fps 4.4v2;

For weaker cards, you may want to consider alternatives:

  • Lossless Scaling
  • SVP (optical flow interpolation)
  • Interpolation to a file, then watch it later:
    • Flowframes
    • enhancr
    • Send VapourSynth output to ffmpeg, then use mkvtoolnix to replace the video track in the original .mkv

Contents

Directory layout

C:\MPV_VS\                           ← root (path with no spaces or Cyrillic)
├── MPV\
│   ├── mpv.exe                      ← mpv player
│   └── portable_config\             ← mpv config
│       ├── mpv.conf
│       ├── input.conf
│       └── vs\
│           └── interpolation.vpy
│
└── VS\                              ← Python + VapourSynth + vs-mlrt
    ├── python.exe
    ├── pythonYYY.dll
    ├── pythonYYY._pth               ← edited (step 1)
    ├── pythonYYY.zip
    ├── pip.pyz                      ← for pip (step 2)
    ├── Lib\site-packages\           ← (step 3.1)
    │   └── vapoursynth\...
    ├── portable.vs                  ← from VS Portable archive (step 3)
    ├── VSScript.dll                 ← from VS Portable archive (step 3)
    ├── VSPipe.exe                   ← from VS Portable archive (step 3)
    ├── other VapourSynth files
    ├── vs-coreplugins\
    ├── vsmlrt.py                    ← (step 4.2)
    ├── vs-plugins\                  ← extracted vs-mlrt (step 4.1)
    │   ├── vstrt.dll / vsort.dll    ← depends on backend
    │   ├── LSMASHSource.dll         ← (step 4.3)
    │   ├── other backend DLLs
    │   └── models\
    │       └── rife\                ← RIFE models (step 4.4)
    │           ├── rife_v4.17_lite.onnx
    │           └── rife_v4.25.onnx
    ├── sdk\
    └── wheel\
        └── vapoursynth-XX-cpYYY-abi3-win_amd64.whl

Step-by-step installation

1. Python Embeddable

Warning

⚠️ The Python version must be AT LEAST the version in the VapourSynth wheel filename. For example: for VapourSynth64-Portable-R73.zip → wheel → vapoursynth-73-cp312-abi3-win_amd64.whl, the minimum Python version is 3.12. For vapoursynth-73-cp38-cp38-win_amd64.whl, cp38-cp38 means Python 3.8 only.

  • Download Python 3.xx.x → "Windows embeddable package (64-bit)" from python.org
  • Extract it to C:\MPV_VS\VS\
  • Required: edit python312._pth — uncomment the last line:
 python312.zip
 .
-#import site
+import site
+Lib/site-packages

⚠️ Without this, pip will not be able to install packages, and the interpreter will not see site-packages.


2. pip.pyz

  • Download pip.pyz and put it in C:\MPV_VS\VS\

3. VapourSynth Portable

  • Download the latest VapourSynth Portable (.zip)
  • Extract it to C:\MPV_VS\VS\ — this will create subfolders like sdk\, vs-plugins\, wheel\, vsgenstubs4 ...

3.1 Installing the VapourSynth Python module

Open cmd in C:\MPV_VS\VS\ and run:

python.exe pip.pyz install wheel/vapoursynth-XX-cpYYY-abi3-win_amd64.whl

⚠️ Replace XX-cpYYY with your downloaded VS version. The exact filename is in wheel\.


4. Installing vs-mlrt

Important

For ORT CUDA and TensorRT, the NVIDIA driver version must match the requirements of the specific vs-mlrt release. Check the release notes. For example, vs-mlrt v15.15 requires CUDA 13, which means NVIDIA >= 581.80.

4.1 Backend archives

Download vsmlrt-windows-x64-tensorrt.v*.7z.001 and vsmlrt-windows-x64-tensorrt.v*.7z.002 from vs-mlrt releases.

Extract them to C:\MPV_VS\VS\vs-plugins\.

4.2 vsmlrt.py

vsmlrt.py is included in the backend archive and after extraction will be in vs-plugins\. It must be moved one level up — to C:\MPV_VS\VS\, so the Python interpreter can import it:

C:\MPV_VS\VS\vs-plugins\vsmlrt.py   →   C:\MPV_VS\VS\vsmlrt.py

4.3 Installing plugins

Download the DLL files from each plugin release and put them in C:\MPV_VS\VS\vs-plugins\:

L-SMASH-Works LSMASHSource.dll

You only need the *.dll file from the archive — everything else can be skipped.

4.4 Additional RIFE models

Download and extract the ONNX files to C:\MPV_VS\VS\vs-plugins\models\rife\

rife_v4.25
rife_v4.17_lite

More versions (for example rife_v4.26, rife_v4.25_heavy): External Models.

Extract them with folder structure preserved to C:\MPV_VS\VS\vs-plugins\models\:

C:\MPV_VS\VS\vs-plugins\models\rife\rife_v4.25.onnx
C:\MPV_VS\VS\vs-plugins\models\rife_v2\rife_v4.25.onnx

Tip

In my internal tests, v2 versions are ~17-23% faster.


5. PATH

Add C:\MPV_VS\VS\ to PATH so vspipe and python are available from any folder.

Option A — via PowerShell (recommended):

$userPath = [Environment]::GetEnvironmentVariable("PATH", "User"); [Environment]::SetEnvironmentVariable("PATH", "$userPath;C:\MPV_VS\VS\", "User")

Option B — via GUI:

Win + Rsystempropertiesadvanced → "Environment Variables" → Path (user) → "New" → C:\MPV_VS\VS\

Option C — via cmd:

Warning

The setx command truncates PATH to 1024 characters. If your PATH is long, use option A or B.

setx PATH "%PATH%;C:\MPV_VS\VS\"

After changing PATH, you must restart the terminal for the changes to take effect.


6. MPV

  • Download mpv
  • Extract it to C:\MPV_VS\MPV\
  • Create these folders:
C:\MPV_VS\MPV\portable_config\
C:\MPV_VS\MPV\portable_config\vs\

If portable_config exists next to mpv.exe, mpv uses it instead of %AppData%\mpv. In configs, ~~/ will point to portable_config\.

Important

The MPV-Config repo also includes a custom MPV config.


7. MPV config and interpolation script

Tip

Using TRT_RTX instead of TRT is not worth it — performance is lower, RGBH and fp16 are unavailable, the portable setup becomes more complicated, and the faster engine compile time is not a meaningful gain for end users.

Choose how to enable interpolation:

  • auto - turns interpolation on at startup for all sources <= 1080p30fps
  • manual - enable it manually with F1

Download and place these files:

interpolation.vpy — ready-to-use TensorRT interpolation script for NVIDIA RTX
⚠️ by default, the script uses the rife_v4.25 model; if playback does not work, use a lighter RIFE model.

File Mode Put here
interpolation.vpy all C:\MPV_VS\MPV\portable_config\vs\
mpv.conf auto C:\MPV_VS\MPV\portable_config\
mpv.conf manual C:\MPV_VS\MPV\portable_config\
input.conf manual C:\MPV_VS\MPV\portable_config\

Warning

The first run may take a long time (up to 5 minutes) because the engine is being compiled. Please be patient.


8. MPC-HC

If MPV does not work for you for any reason, you can use MPC-HC:

  • download it
  • Extract it to C:\MPV_VS\MPC-HC\
  • Download the interpolation script interpolation.vpy and put it in C:\MPV_VS\MPC-HC\_vapoursynth
  • download SynthFilters.zip and extract vapoursynth_filter_64.ax from the archive to C:\MPV_VS\MPC-HC\_vapoursynth
  • download vapoursynth_filter.ini and put it in C:\MPV_VS\MPC-HC
  • Start MPC-HC and open settings:
    • External filters:
      • click Add filter -> Browse and select C:\MPV_VS\MPC-HC\_vapoursynth\vapoursynth_filter_64.ax
      • select the added VapourSynth Filter and enable Prefer
      • double-click VapourSynth Filter to open filter settings, then click Browse and select the interpolation script interpolation.vpy
    • Internal filters -> Video decoder
    • first try Hardware decoder: d3d11 and Hardware Device to use: Automatic(CopyBack).
    • if d3d11 does not work, select Hardware decoder: DXVA2(copy-back) and Hardware Device to use: Automatic
  • After saving the settings, the filter will be applied automatically the next time you play a video.

Warning

In MPC, the filter is applied to all content. Because of that, the script is different from the one used for MPV and includes checks for screen resolution and the maximum supported source fps. The MAX_FPS_ values in the script need to be tuned for your system, because the defaults may limit what your hardware can do.


Tip

If you run into setup issues, feel free to open an issue.

About

Step-by-step guide for setting up a fully portable build for real-time video interpolation with RIFE in MPV.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors