Skip to main content

Practical-RIFE

V4.0 Anime Demo Video | 迭代经验 | 迭代QA | Colab

This project is based on RIFE and SAFA. We aim to enhance their practicality for users by incorporating various features and designing new models. Since improving the PSNR index is not consistent with subjective perception. This project is intended for engineers and developers. For general users, we recommend the following software:

SVFI (中文) | RIFE-App | FlowFrames

Thanks to SVFI team to support model testing on Animation.

VapourSynth-RIFE | RIFE-ncnn-vulkan | VapourSynth-RIFE-ncnn-Vulkan | vs-mlrt | Drop frame fixer and FPS converter

Frame Interpolation

2024.08 - We find that 4.24+ is quite suitable for post-processing of some diffusion model generated videos.

Trained Model

The content of these links is under the same MIT license as this project. lite means using similar training framework, but lower computational cost model. Currently, it is recommended to choose 4.25 by default for most scenes.

4.26 - 2024.09.21 | Google Drive 百度网盘 || 4.25.lite - 2024.10.20

4.25 - 2024.09.19 | Google Drive 百度网盘 | I am trying using more flow blocks, so the scale_list will change accordingly. It seems that the anime scenes have been significantly improved.

4.22 - 2024.08.08 | Google Drive 百度网盘 || 4.22.lite || 4.21 - 2024.08.04 | Google Drive 百度网盘

4.20 - 2024.07.24 | Google Drive 百度网盘 || 4.18 - 2024.07.03 | Google Drive 百度网盘

4.17 - 2024.05.24 | Google Drive 百度网盘 : Add gram loss from FILM || 4.17.lite

4.15 - 2024.03.11 | Google Drive 百度网盘 || 4.15.lite || 4.14 - 2024.01.08 | Google Drive 百度网盘 || 4.14.lite

v4.9.2 - 2023.11.01 | Google Drive 百度网盘 || v4.3 - 2022.8.17 | Google Drive 百度网盘

v3.8 - 2021.6.17 | Google Drive 百度网盘 || v3.1 - 2021.5.17 | Google Drive 百度网盘

More Older Version

Installation

git clone git@github.com:hzwer/Practical-RIFE.git
cd Practical-RIFE
uv sync --locked

Download a model from the model list and put *.py and flownet.pkl on train_log/

Run

You can use our demo video or your video.

python3 inference_video.py --multi=2 --video=video.mp4 

(generate video_2X_xxfps.mp4)

python3 inference_video.py --multi=4 --video=video.mp4

(for 4X interpolation)

python3 inference_video.py --multi=2 --video=video.mp4 --scale=0.5

(If your video has high resolution, such as 4K, we recommend set --scale=0.5 (default 1.0))

python3 inference_video.py --multi=4 --img=input/

(to read video from pngs, like input/0.png ... input/612.png, ensure that the png names are numbers)

Parameter descriptions:

--img / --video: The input file address

--output: Output video name 'xxx.mp4'

--model: Directory with trained model files

--UHD: It is equivalent to setting scale=0.5

--montage: Splice the generated video with the original video, like this demo

--fps: Set output FPS manually

--ext: Set output video format, default: mp4

--multi: Interpolation frame rate multiplier

--exp: Set --multi to 2^(--exp)

--skip: It's no longer useful refer to issue 207

Python API (tensor in / tensor out)

The inference logic from inference_video.py is also available as an importable API that works directly on tensors:

import torch
from practical_rife_a6i import RifeVideoInterpolator, interpolate_video

# video: (T, C, H, W) or (T, H, W, C); uint8 (0..255) or float (0..1)
video = torch.randint(0, 256, (8, 3, 720, 1280), dtype=torch.uint8)

out = interpolate_video(video, exp=1)   # 15 frames, same layout/dtype

# Reuse the loaded model when processing several videos:
engine = RifeVideoInterpolator(scale=1.0, device="cuda")
out = engine(video, exp=2)              # 4x frames

exp has the same meaning as the CLI flag: the result contains (T - 1) * 2 ** exp + 1 frames. See src/practical_rife_a6i/interpolation.py for all options (layout, output_layout, output_device, fp16, ...).

Model training

The whole repo can be downloaded from v4.0, v4.12, v4.15, v4.18, v4.25. However, we currently do not have the time to organize them well, they are for reference only.

Video Enhancement

image

We are developing a practical model of SAFA. Welcome to check its demo (BiliBili) and provide advice.

v0.5 - 2023.12.26 | Google Drive

python3 inference_video_enhance.py --video=demo.mp4

Citation

@inproceedings{huang2022rife,
  title={Real-Time Intermediate Flow Estimation for Video Frame Interpolation},
  author={Huang, Zhewei and Zhang, Tianyuan and Heng, Wen and Shi, Boxin and Zhou, Shuchang},
  booktitle={Proceedings of the European Conference on Computer Vision (ECCV)},
  year={2022}
}
@inproceedings{huang2024safa,
  title={Scale-Adaptive Feature Aggregation for Efficient Space-Time Video Super-Resolution},
  author={Huang, Zhewei and Huang, Ailin and Hu, Xiaotao and Hu, Chen and Xu, Jun and Zhou, Shuchang},
  booktitle={Winter Conference on Applications of Computer Vision (WACV)},
  year={2024}
}

License

This repository is a fork of Practical-RIFE and is distributed under a dual-license scheme that preserves the upstream MIT license.

Part Copyright License
Original Practical-RIFE code and model weights © 2021 hzwer MIT
Modifications and additions in this fork © 2026 tachyon_gz GPL-3.0-or-later OR AGPL-3.0-or-later
  • The combined derivative work is distributed as a whole under GPL-3.0-or-later OR AGPL-3.0-or-later. You may choose either one: GPL-3.0 if you only redistribute the software, or AGPL-3.0 if you also need the network-use protection (§13) for services built on modified versions.
  • MIT is compatible with these licenses: the upstream MIT grant is retained and not revoked, so the original portions remain available under MIT to anyone who receives them. Keep the original copyright and permission notice when redistributing.
  • Model weights downloaded from the upstream links remain under the upstream MIT license and are not relicensed by this fork.

SPDX-License-Identifier: GPL-3.0-or-later OR AGPL-3.0-or-later

Reference

Optical Flow: ARFlow pytorch-liteflownet RAFT pytorch-PWCNet

Video Interpolation: DVF TOflow SepConv DAIN CAIN MEMC-Net SoftSplat BMBC EDSC EQVI RIFE

Metadata

Release files for practical-rife-a6i 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for practical-rife-a6i 0.1.0
File Size Uploaded Provenance Actions
practical_rife_a6i-0.1.0.tar.gz 40.1 kB Without provenance Details for practical_rife_a6i-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for practical-rife-a6i 0.1.0
File Interpreter ABI Platform Actions
practical_rife_a6i-0.1.0-py3-none-any.whl Python 3 none any Details for practical_rife_a6i-0.1.0-py3-none-any.whl

Total release size: 77.7 kB

Release files / practical_rife_a6i-0.1.0.tar.gz

Download URL practical_rife_a6i-0.1.0.tar.gz
Size 40.1 kB
Tags Source
SHA-256 checksum
How to use checksums
50958ff3aaa5a147e0f565e99f9128b521913d879d7bfbeb49d3cd4f50cc2d6e
BLAKE2b-256 checksum
How to use checksums
de072120bdb98937040d7772ad642301ec8326601d66e06104a6d6bb040b6f73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / practical_rife_a6i-0.1.0-py3-none-any.whl

Download URL practical_rife_a6i-0.1.0-py3-none-any.whl
Size 37.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a7dba16ed39e97d9ee335c82f36efbbc9e9f6536aea629f3eb6073d69cd65d7
BLAKE2b-256 checksum
How to use checksums
25a79b2beb82b7d95daab92cdfaa00efca3dc665619ed85fb658b362f6159e60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for practical-rife-a6i 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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