Skip to main content
PyCon US is happening May 14th-22nd in Pittsburgh, PA USA.  Learn more

an inference lib for video frame interpolation with VapourSynth support

Project description

ccvfi

codecov CI-test Release-pypi PyPI version GitHub

an inference lib for video frame interpolation with VapourSynth support

Install

Make sure you have Python >= 3.9 and PyTorch >= 1.13 installed

pip install ccvfi
  • Install VapourSynth (optional)

Start

cv2

a simple example to use the RIFE (ECCV2022-RIFE) model to process an image sequence.

import cv2
import numpy as np

from ccvfi import AutoModel, ConfigType, VFIBaseModel

model: VFIBaseModel = AutoModel.from_pretrained(
    pretrained_model_name=ConfigType.RIFE_IFNet_v426_heavy,
)

img0 = cv2.imdecode(np.fromfile("01.jpg", dtype=np.uint8), cv2.IMREAD_COLOR)
img1 = cv2.imdecode(np.fromfile("02.jpg", dtype=np.uint8), cv2.IMREAD_COLOR)
out = model.inference_image_list(img_list=[img0, img1])[0]
cv2.imwrite("test_out.jpg", out)

VapourSynth

a simple example to use the VFI (Video Frame-Interpolation) model to process a video (DRBA)

import vapoursynth as vs
from vapoursynth import core

from ccvfi import AutoModel, BaseModelInterface, ConfigType

model: BaseModelInterface = AutoModel.from_pretrained(
    pretrained_model_name=ConfigType.DRBA_IFNet,
)

clip = core.bs.VideoSource(source="s.mp4")
clip = core.resize.Bicubic(clip=clip, matrix_in_s="709", format=vs.RGBH)
clip = model.inference_video(clip, tar_fps=60)
clip = core.resize.Bicubic(clip=clip, matrix_s="709", format=vs.YUV420P16)
clip.set_output()

See more examples in the example directory, ccvfi can register custom configurations and models to extend the functionality

Current Support

It still in development, the following models are supported:

Reference

License

This project is licensed under the MIT - see the LICENSE file for details.

Supported by

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