Vapoursynth function to remove video distortions, turbulence, wobble, warp, heat haze, or similar.
Project description
Video Distortion Removal for VapourSynth
Also known as dewobble, warp stabilization, film or VHS distortion fix, rectification, 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.
Check out stinkybread's comparisons here and here.
Installation
pip install -U vs_undistort
- To enable the CPU/CUDA backends, install PyTorch with CUDA. (optional)
For older vapoursynth versions below R74, follow the manual installation steps here.
Usage
from vs_undistort import vs_undistort
clip = vs_undistort(clip, temp_window=10, tiles=1, overlap=8, interpolation="bicubic", backend="tensorrt", num_streams=1, 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.
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.
interpolation (optional)
The interpolation mode used to warp the frames:
bilinearMore blurry.bicubicNo blur, but may oversharpen slightly.
backend (optional)
The backend used to run the model:
cpuCPU mode using PyTorch (very slow).cudaGPU mode using PyTorch with CUDA support. Requires any Nvidia GPU (fast).tensorrtGPU mode using vs-mlrt with TensorRT support. 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).
num_streams (optional)
Number of parallel TensorRT streams. For high end GPUs higher can be a bit faster, but requires more VRAM. Only affects the TensorRT backend.
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 see jumps/hitches between temporal windows, you can crossfade them with vs_tiletools.
- If you have an undistorted reference clip, you can also try to align to it with vs_align.
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 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vs_undistort-2.2.0.tar.gz.
File metadata
- Download URL: vs_undistort-2.2.0.tar.gz
- Upload date:
- Size: 16.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecfb2a5049b93ef1979ddcb2b6d636866b841fda02de463738132940b5feb759
|
|
| MD5 |
8fb0215af7cfe5ec2b274a7977b00147
|
|
| BLAKE2b-256 |
911fdde4d140a23b39daaab401479d7f5eacd68536e21403e096cf394323c42e
|
Provenance
The following attestation bundles were made for vs_undistort-2.2.0.tar.gz:
Publisher:
publish.yml on pifroggi/vs_undistort
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vs_undistort-2.2.0.tar.gz -
Subject digest:
ecfb2a5049b93ef1979ddcb2b6d636866b841fda02de463738132940b5feb759 - Sigstore transparency entry: 2193472793
- Sigstore integration time:
-
Permalink:
pifroggi/vs_undistort@8fc453c9daaf832f6b87b2008cdb1ad94ff68d9c -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/pifroggi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8fc453c9daaf832f6b87b2008cdb1ad94ff68d9c -
Trigger Event:
release
-
Statement type:
File details
Details for the file vs_undistort-2.2.0-py3-none-any.whl.
File metadata
- Download URL: vs_undistort-2.2.0-py3-none-any.whl
- Upload date:
- Size: 16.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da5e0b35354a2d0e8ae647c879954a47aa730dcea3ccd7c33915714b645133f9
|
|
| MD5 |
c38cf1bf7b228dc4511290b167905c3f
|
|
| BLAKE2b-256 |
6ed60a89c95105b014b1dface1edbe1b83ee947bb633ecaffd9f68f0e2516cad
|
Provenance
The following attestation bundles were made for vs_undistort-2.2.0-py3-none-any.whl:
Publisher:
publish.yml on pifroggi/vs_undistort
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vs_undistort-2.2.0-py3-none-any.whl -
Subject digest:
da5e0b35354a2d0e8ae647c879954a47aa730dcea3ccd7c33915714b645133f9 - Sigstore transparency entry: 2193472807
- Sigstore integration time:
-
Permalink:
pifroggi/vs_undistort@8fc453c9daaf832f6b87b2008cdb1ad94ff68d9c -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/pifroggi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8fc453c9daaf832f6b87b2008cdb1ad94ff68d9c -
Trigger Event:
release
-
Statement type: