Skip to main content

Vapoursynth plugin for RVRT (Recurrent Video Restoration Transformer)

Project description

VSRVRT: Vapoursynth Plugin for RVRT

A Vapoursynth plugin wrapper for RVRT (Recurrent Video Restoration Transformer), implementing state-of-the-art video denoising, deblurring, and super-resolution. Based on https://github.com/JingyunLiang/RVRT

Features

  • Video Denoising: Non-blind denoising with tunable sigma parameter (0-50)
  • Video Deblurring: Support for both GoPro and DVD dataset models
  • Video Super-Resolution: 4x upscaling with multiple model variants (Extreme VRAM usage)
  • FP16 Support: Half-precision for faster inference and 50% VRAM reduction, optional FP32
  • Preview Mode: Lazy chunk processing for faster preview in vspreview (still slow though)
  • Flexible Chunking: Control chunk size, overlap, and processing strategy
  • Automatic Tiling: VRAM-aware automatic tiling to handle large videos (may not be perfect)
  • RGBS Format: Full support for 32-bit float RGB
  • Pre-built Binaries: No compilation required for PyPI installs

Requirements

  • Python 3.12 or 3.13
  • VapourSynth >= 60
  • PyTorch >= 2.10.0 with CUDA support (see important note below)
  • NVIDIA GPU with CUDA 12.8+ driver

Installation

pip

pip install vsrvrt

Arch Linux (AUR)

yay -S vsrvrt-git

Important Note: PyPI's default index only has CPU-only PyTorch. You must install the CUDA version first:

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128

Building from Source

If you need to build from source (e.g., for development or unsupported platforms):

  1. Prerequisites:

    • CUDA Toolkit 12.8+
    • C++ compiler (MSVC on Windows, GCC on Linux)
    • ninja build system
  2. Build:

    git clone https://github.com/Lyra-Vhess/vs-rvrt/
    cd vs-rvrt
    pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
    pip install ninja
    python build_wheels.py
    pip install dist/vsrvrt-*.whl
    

Usage

Basic Usage

# Convert to RGB (required)
clip = clip.resize.Bicubic(format=vs.RGB24) # or RGBS

# Video Denoising (sigma: 0-50)
denoised = vsrvrt.Denoise(clip, sigma=12.0)

# Video Deblurring
deblurred = vsrvrt.Deblur(clip, model="gopro")  # or "dvd"

# Video Super-Resolution (4x)
upscaled = vsrvrt.SuperRes(clip, scale=4, model="reds")  # or "vimeo_bi", "vimeo_bd"

API Reference

Denoise

vsrvrt.Denoise(
    clip: vs.VideoNode,             # Input clip (RGB format)
    sigma: float = 12.0,            # Noise level (0-50, default: 12)
    tile_size: Tuple[int, int, int] = (64,256,256),    # (Temporal, Height, Width), None for auto
    tile_overlap: Tuple[int, int, int] = (2, 20, 20),  # Overlap for tiling
    use_fp16: [bool] = True,        # Use FP16 precision, (default: True)
    device: [str] = None,           # 'cuda', 'cpu', or auto
    chunk_size: [int] = None,       # Frames per chunk (default: 64)
    chunk_overlap: [int] = None,    # Overlapping frames (default: 16)
    use_chunking: [bool] = None,    # Whether to us chunked processing, (default: True)
    preview_mode: [bool] = False    # Lazy chunk processing for preview
) -> vs.VideoNode

Deblur

vsrvrt.Deblur(
    clip: vs.VideoNode,             # Input clip (RGB format)
    model: str = "gopro",           # 'gopro' or 'dvd'
    tile_size: Tuple[int, int, int] = None,
    tile_overlap: Tuple[int, int, int] = (2, 20, 20),
    use_fp16: [bool] = True,
    device: [str] = None,
    chunk_size: [int] = None,
    chunk_overlap: [int] = None,
    use_chunking: [bool] = None,
    preview_mode: [bool] = False
) -> vs.VideoNode

SuperRes

vsrvrt.SuperRes(
    clip: vs.VideoNode,             # Input clip (RGB format)
    scale: int = 4,                 # Must be 4 (only 4x models available)
    model: str = "reds",            # 'reds', 'vimeo_bi', or 'vimeo_bd'
    tile_size: Optional[Tuple[int, int, int]] = None,
    tile_overlap: Tuple[int, int, int] = (2, 20, 20),
    use_fp16: bool = True,
    device: Optional[str] = None,
    chunk_size: Optional[int] = None,
    chunk_overlap: Optional[int] = None,
    use_chunking: Optional[bool] = None,
    preview_mode: bool = False
) -> vs.VideoNode

Tiling Options

The tile_size parameter controls memory usage:

  • None: Automatic based on available VRAM
  • (0, 0, 0): No tiling (process entire video at once) - requires significant VRAM
  • (T, H, W): Manual tile size (e.g., (64, 256, 256))

Spatial Tile Size Guidelines:

  • As far as I can tell, HxW = 256x256 is ideal because the models were trained with that tile size. Experiment at your own risk.
  • Higher temporal windows appear to improve quality, though there appears to be a ceiling after which you will get artifacts.
  • Temporal windows from 16 to 64 seem safe
  • The interaction between the temporal tiling and chunk length is not entirely clear to me, experiment at your own risk
  • Automatic sizing may not be perfect, consider (16,256,256) as a good default and increase T as memory allows
  • Super-Resolution is extremely memory-hungry and likely requires bare minimal tiling for 12GB GPUs of (8,256,256) with chunk sizes of 16
  • Expect poor SR quality below 16GB of VRAM due to the need for extremely minimal tiling sizes

Note: Tile size must be a multiple of 8 (the model's window size).

Preview Mode (for vspreview)

Preview mode processes chunks on-demand for instant startup:

# Preview mode - faster startup, processes chunks as needed
denoised = vsrvrt.Denoise(clip, sigma=10.0, preview_mode=True)

# Normal mode - process all chunks upfront, best quality but extreme delay
denoised = vsrvrt.Denoise(clip, sigma=10.0, preview_mode=False)

Preview Mode Notes:

  • Each chunk is processed independently (no recurrence from previous chunks)
  • Slight quality trade-off at chunk boundaries
  • Processed chunks are cached for the session
  • Best for quickly checking settings before final encode

Chunk Control

Control how video is processed in chunks:

# Customize chunk processing
denoised = vsrvrt.Denoise(
    clip, 
    sigma=10.0,
    chunk_size=64,        # Frames per chunk (default: 64)
    chunk_overlap=16,     # Overlapping frames (default: 16)
    use_chunking=True     # Use chunked processing
)

# Disable chunking (process entire video at once, extreme memory usage)
denoised = vsrvrt.Denoise(clip, sigma=10.0, use_chunking=False)

Chunk Size Guidelines:

  • 64 frames: Good balance (default)
  • 48-96: Adjust based on VRAM
  • Must be <128 to keep processing on GPU

Model Info

These are the datasets used in training the models, choose the model based on how closely your video matches the dataset.

Dataset Task Resolution Content Type Best For
REDS Super-Resolution 1280×720 Real diverse scenes General upscaling, natural motion
Vimeo-90K Super-Resolution 448×256 Real web videos Web content, user videos
GoPro Deblurring 1280×720 Synthetic blur from real scenes Camera shake, dynamic motion
DVD Deblurring ~1280×720 Hand-held camera blur Smartphone videos, hand shake
DAVIS Denoising 1080p/480p High-quality footage Tunable denoising (sigma 0-50)

Troubleshooting

"requires PyTorch with CUDA support, but you have the CPU-only version"

This means pip installed the CPU-only PyTorch from the default PyPI index. Fix:

pip uninstall torch torchvision -y
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128

"CUDA is not available" (but you have PyTorch with CUDA)

This usually means:

  1. You don't have an NVIDIA GPU
  2. Your GPU driver is too old
  3. CUDA drivers aren't installed

Update your NVIDIA drivers from https://www.nvidia.com/Download/index.aspx

Performance Tips

  1. Use FP16: Enable for 2x speedup and 50% VRAM reduction
  2. Preview Mode: Use preview_mode=True in vspreview for instant feedback
  3. Adjust Tiling: If you get OOM errors, reduce tile_size
  4. Chunk Size: Larger chunks = better quality but more VRAM. Default 64 is a good balance.

Project Structure

vsrvrt/
├── __init__.py             # Package initialization
├── _binary/                # Pre-built CUDA extension binaries
│   ├── __init__.py         # Binary loader
│   ├── win_amd64/          # Windows binaries
│   └── manylinux_x86_64/   # Linux binaries
├── model_configs.py        # Model configurations
├── rvrt_core.py            # Core inference wrapper
├── rvrt_filter.py          # Vapoursynth filter functions
├── models/                 # Downloaded model weights (auto-populated)
├── utils/                  # Utility functions
└── rvrt_src/               # RVRT source code
    ├── models/
    │   ├── network_rvrt.py
    │   └── op/             # CUDA extension source
    └── utils/

Citation

@article{liang2022rvrt,
    title={Recurrent Video Restoration Transformer with Guided Deformable Attention},
    author={Liang, Jingyun and Fan, Yuchen and Xiang, Xiaoyu and Ranjan, Rakesh and Ilg, Eddy  and Green, Simon and Cao, Jiezhang and Zhang, Kai and Timofte, Radu and Van Gool, Luc},
    journal={arXiv preprint arXiv:2206.02146},
    year={2022}
}

License

This plugin follows the same license as RVRT (CC-BY-NC-4.0 for non-commercial use).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vsrvrt-1.1.0.tar.gz (1.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vsrvrt-1.1.0-cp314-none-manylinux2014_x86_64.whl (544.7 kB view details)

Uploaded CPython 3.14

vsrvrt-1.1.0-cp313-none-win_amd64.whl (319.2 kB view details)

Uploaded CPython 3.13Windows x86-64

vsrvrt-1.1.0-cp313-none-manylinux2014_x86_64.whl (522.9 kB view details)

Uploaded CPython 3.13

vsrvrt-1.1.0-cp312-none-win_amd64.whl (319.1 kB view details)

Uploaded CPython 3.12Windows x86-64

vsrvrt-1.1.0-cp312-none-manylinux2014_x86_64.whl (522.8 kB view details)

Uploaded CPython 3.12

File details

Details for the file vsrvrt-1.1.0.tar.gz.

File metadata

  • Download URL: vsrvrt-1.1.0.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for vsrvrt-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1ecd7e0fc01b68bfaa8c51430673ef9d279019a208520a8353d1d39754367276
MD5 bd067e1ec5ba8d1b9c0ce3ffc0ef7158
BLAKE2b-256 dbfe243bfc0621c3c5d631d170e8c0b1fedeff7e79f9df2ba7af444e5fc26212

See more details on using hashes here.

File details

Details for the file vsrvrt-1.1.0-cp314-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vsrvrt-1.1.0-cp314-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 24502ed4e52680cc987e92a4d98ab973f3bb1aa3c1623c4b135d9c6ce08be756
MD5 4cbc856c5a766be528738bc026829d8f
BLAKE2b-256 c03db88d769c8fdb7aa90e0448147cb183adbd8a9c57c4c0b5feed0a7219b750

See more details on using hashes here.

File details

Details for the file vsrvrt-1.1.0-cp313-none-win_amd64.whl.

File metadata

  • Download URL: vsrvrt-1.1.0-cp313-none-win_amd64.whl
  • Upload date:
  • Size: 319.2 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for vsrvrt-1.1.0-cp313-none-win_amd64.whl
Algorithm Hash digest
SHA256 f552c476505a2ea5110e4a44bb658870119a0aa92e9564edaf441d10febb10f7
MD5 12c3ade422705dc7b6141d3f1b5b5c04
BLAKE2b-256 e893bd73268c039b8a27f64b0d5db7351ab9f3ee13e4b91c8e511baadc89d5d6

See more details on using hashes here.

File details

Details for the file vsrvrt-1.1.0-cp313-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vsrvrt-1.1.0-cp313-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9231fa6a0a507ccc146a3ae6989750c76b0d7a73a4758ae5b50966c98b72bbd9
MD5 d86d619fa393787f2debb4ffd34d4736
BLAKE2b-256 c9b12f2e0a74b23016a25fed1370843f74ffd041d419bf83ce924feac5e6d218

See more details on using hashes here.

File details

Details for the file vsrvrt-1.1.0-cp312-none-win_amd64.whl.

File metadata

  • Download URL: vsrvrt-1.1.0-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 319.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for vsrvrt-1.1.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 c7a69ac8dbde0d2d99f0cfb7e403cd5c21ae68c303bb59ab1c930e1590e4c337
MD5 1ce203167b13f774bef9470c3decafbb
BLAKE2b-256 3d46308b2441a3eff0d831d299917b587389c6edf18026644831c79a6e8498f0

See more details on using hashes here.

File details

Details for the file vsrvrt-1.1.0-cp312-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vsrvrt-1.1.0-cp312-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7fb76e4f2f76013fc4429be88beaefd18736aed04d74d58be446867da3e78b1f
MD5 33a81173a37b8dc027f3add6923860c2
BLAKE2b-256 a43b2db0eea73e19492ab376378ff319ca9f381eead688f19fe57948faeada02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page