Skip to main content

Video Distortion Removal for VapourSynth

Also known as dewobble, warp stabilization, film or VHS distortion fix, atmospheric turbulence mitigation, or heat haze removal.

This is a partial implementation of the Turbulence Mitigation Transformer (only distortion removal, no deblurring). It does not do general video stabilization for shaky footage, only removes distortions within the frames. It is recommented to stabilize first if needed. Thanks to stinkybread for the comparison clips.



Installation

pip install -U vs_undistort --extra-index-url https://pypi.nvidia.com/

To enable the CPU/CUDA backends, install PyTorch with CUDA. (optional)


[!TIP] For VapourSynth R73 and older, follow the manual installation steps.


Usage

from vs_undistort import vs_undistort
clip = vs_undistort(clip, temp_window=10, window_overlap=0, interpolation="bicubic", backend="tensorrt", tiles=1, overlap=8, engine_folder=None)

clip
Distorted clip. Must be in RGBH format.

temp_window
Temporal window length. How many frames are grouped together and processed as a single chunk. Larger means higher VRAM requirements, but better temporal averaging and slower distortions can be removed. If this is too small, some distortions may not get removed, small jumps/hitches may be visible between windows and seams from tiling may become more obvious.

window_overlap (optional)
Overlap between temporal windows. Larger is slower. Increase if jumps/hitches between windows are noticeable.

interpolation (optional)
The interpolation mode used to warp the frames:

  • bilinear More blurry.
  • bicubic No blur, but may oversharpen slightly.

backend (optional)
The backend used to run the model:

  • cpu CPU mode (very slow).
  • cuda GPU mode using CUDA. Requires any Nvidia GPU (fast).
  • tensorrt GPU mode using TensorRT. Requires an Nvidia RTX GPU. On the first run, this mode will automatically build an engine, which may take a few minutes. Changing interpolation, temp_window, or input dimensions will trigger rebuilding, but previously build engines are stored (very fast, low vram).

tiles (optional)
Amount of tiles to split the frames into. A higher amount reduces VRAM requirements, but also worsens spatial averaging. Default tiles=1 uses the full frame.

overlap (optional)
Overlap from one tile to the next. Increase if seams between tiles are visible. Does nothing when tiles=1.

engine_folder (optional)
Optional path to the TensorRT engine storage location. By default engines are stored in vs_undistort/engines. Only affects the TensorRT backend.

[!TIP]

  • If you have an undistorted reference clip, you can also try to align to it with vs_align.
  • If window_overlap does not sufficiently remove jumps/hitches, you can instead try to crossfade with the insert/trim overlaps functions in vs_tiletools.

Benchmarks

Hardware Resolution TensorRT CUDA
RTX 4090 720x480 ~35 fps ~6.5 fps
RTX 4090 1440x1080 ~7.5 fps ~1.5 fps
RTX 4090 2880x2160 ~2 fps ~0.5 fps

Download files

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

Source Distribution

vs_undistort-2.3.0.tar.gz (16.9 MB view details)

Uploaded Source

Built Distribution

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

vs_undistort-2.3.0-py3-none-any.whl (16.8 MB view details)

Uploaded Python 3

File details

Details for the file vs_undistort-2.3.0.tar.gz.

File metadata

  • Download URL: vs_undistort-2.3.0.tar.gz
  • Upload date:
  • Size: 16.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for vs_undistort-2.3.0.tar.gz
Algorithm Hash digest
SHA256 74ba8d184f78c840983d47a53ada3b6ad7044735c2a5645d02190a57efc6abd4
MD5 b4ac345b575dcc531da79cb756b18abb
BLAKE2b-256 27a3ed9fa116c83f5eeaa89678c1199f7ea022e82ec465fe7f1527515613d0ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for vs_undistort-2.3.0.tar.gz:

Publisher: publish.yml on pifroggi/vs_undistort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vs_undistort-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: vs_undistort-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for vs_undistort-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4804b1511184f2220f56ad7edacad82e7673051d762b3ea3d4fcc3f6e2545f29
MD5 9b7a8d69206741ec69be27c799488e19
BLAKE2b-256 42459276351e084e023dbea6805ffbc14dce29e4d4cd18c98f3ad36a4404c00e

See more details on using hashes here.

Provenance

The following attestation bundles were made for vs_undistort-2.3.0-py3-none-any.whl:

Publisher: publish.yml on pifroggi/vs_undistort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.3.0 This release

2 files

2.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page