Skip to main content

Add Temporal Coherence to AI Upscales in VapourSynth

When using SISR models (single image super resolution) on video, they tend to create slightly different results each frame. TemporalFix is a post filter that averages these results over multiple frames, removing temporal inconsistencies like fizzle or wiggly lines. Also known as stabilization, deshimmering, temporal denoising, or temporal fix.


https://github.com/user-attachments/assets/13f05267-cd61-4de9-ad7f-ce8030102465


Installation

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

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

[!TIP] For older VapourSynth versions below R74, follow the manual installation steps here.


TemporalFix AI Model

The newest and most capable version of temporalfix. It is easy to use and can run very fast on Nvidia GPUs.

import vs_temporalfix
clip = vs_temporalfix.model(clip, strength=2.0, exclude=None, backend="tensorrt", tiles=1, num_streams=1, engine_folder=None)

clip
Temporally unstable upscaled clip. Must be in RGBH format.

strength
Suppression strength of temporal inconsistencies in the 0.0-3.0 range. Higher means more aggressive.
Higher resolution tends to need higher strength. Too high may oversmooth small movements.

exclude (optional)
Optionally exclude scenes with intended temporal inconsistencies.
Brackets define excluded frame ranges. Example for two scenes: exclude="[10 20] [600 900]"

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

  • cpu CPU mode using PyTorch (very slow).
  • cuda GPU mode using PyTorch with CUDA support. Requires any Nvidia GPU (fast).
  • tensorrt GPU 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 strength or input dimensions will trigger rebuilding, but previously build engines are stored (very fast).

tiles (optional)
A higher amount of tiles will reduce VRAM usage at the cost of speed.
This should only be needed on low end hardware. Default tiles=1 uses the full frame, which is fastest.

num_streams (optional)
Number of parallel TensorRT streams. For high end GPUs higher can be 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_temporalfix/engines. Only affects the TensorRT backend.

[!TIP] Feedback is much appreciated. If the model does not work well for you or causes issues, feel free to open an issue, or contact me via Discord (pifroggi or tepete) and provide a sample. That will help improve it over time.


TemporalFix Classic

The original CPU based version. It is harder to tune, may miss some areas, and only works well for 2D animation.

import vs_temporalfix
clip = vs_temporalfix.classic(clip, strength=500, tr=6, denoise=False, exclude=None, debug=False)

clip
Temporally unstable upscaled clip. Any format.

strength
Suppression strength of temporal inconsistencies. Higher means more aggressive. 400-700 works great in most cases.
The best way to finetune is to find a static scene and adjust till lines and details are stable.
Reduce if you get blending/ghosting on small movements, especially in dark or hazy scenes.

tr
Temporal radius sets the number of frames to average over.
Higher means more stable, especially on slow pans and zooms, but is slower. 6 works great in most cases.
The best way to finetune is to find a slow pan or zoom and adjust till lines and details are stable.

denoise (optional)
Removes grain and low frequency noise/flicker left over by the main processing step. Only enable if these issues actually exist! It risks to remove some details like every denoiser, but is useful if you're planning to denoise anyway and has the benefit of almost no performance impact compared to using an additional denoising filter.

exclude (optional)
Optionally exclude scenes with intended temporal inconsistencies.
Brackets define excluded frame ranges. Example for two scenes: exclude="[10 20] [600 900]"

debug (optional)
Shows areas that will not be fixed in pink. This includes areas with high motion, scene changes and excluded scenes. Can help while tuning parameters to see if the area is even affected.

[!TIP]

  • Crop any black borders on the input clip! In temporalfix classic they can cause ghosting on bright frames.
  • If slow, try increasing your cache: core.max_cache_size = 10000 (not needed on VapourSynth R78 and up)

Benchmarks

Model benchmarks were done on a RTX 4090 GPU and Classic benchmarks on a Ryzen 5900X CPU.

AI Model
Resolution TensorRT CUDA
720x480 ~320 fps ~70 fps
1440x1080 ~80 fps ~32 fps
2880x2160 ~20 fps ~8 fps
Classic
Resolution YUV444 YUV420 GRAY
720x480 ~70 fps ~90 fps ~120 fps
1440x1080 ~15 fps ~20 fps ~25 fps
2880x2160 ~7.5 fps ~11 fps ~14 fps

Third-Party Integrations

Several projects integrated TemporalFix to simplify usage without the need for VapourSynth knowledge. Feel free to contact me if you want to be part of this list.

  • Vapourkit (Windows only)
    Video filter and upscaling program with an easy GUI. This is the easiest way to use it. Just click on add filter and add one of the two TemporalFix versions.
  • Hybrid (Windows and Linux)
    Video filter toolbox with a GUI. Can be a bit overwhelming due to the amount of features and filters, but TemporalFix is one of them.
  • VSGAN-tensorrt-docker (Windows and Linux)
    Command line AI upscale and interpolation toolbox that comes with both versions of TemporalFix. Rudimentary knowledge of Docker and VapourSynth is recommended, but the readme also explains it.
  • mpv-cHiDeNoise-AI (Windows only)
    AI upscaling video player based on mpv, which includes the TemporalFix AI Models and a lighter modified version of TemporalFix Classic for real-time playback. Mainly intended for japanese audience.

Download files

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

Source Distribution

vs_temporalfix-2.3.0.tar.gz (11.3 MB view details)

Uploaded Source

Built Distribution

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

vs_temporalfix-2.3.0-py3-none-any.whl (11.3 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vs_temporalfix-2.3.0.tar.gz
Algorithm Hash digest
SHA256 4fc0fb6a8357948a785a8faca193c40c10fd44534bd63965c6ca329439a49db6
MD5 263ad77a54581ce549ddf4e2babc8586
BLAKE2b-256 5771ae2e626d00e3c93489aef8d77ec19bb1d4f7c7031048b739473610ef164d

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on pifroggi/vs_temporalfix

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_temporalfix-2.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for vs_temporalfix-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6c133d72737c8d3c83546372e553b3c51b8fb57b5b0fc39c0147f53e12c7bca
MD5 da5df70dddf56e30e98166387d49a15d
BLAKE2b-256 0154b6511016e923a8b2492d74e58299f2666baaae0b97bc00b38f393687b4c0

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on pifroggi/vs_temporalfix

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

Supported by

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