rife_interp ¶
Small MLX RIFE wrapper for frame interpolation experiments.
The backend is the Apple-Silicon-native rife-mlx package, using the mlx-community/RIFE-4.25 weights. Frames are HWC RGB uint8 arrays.
Classes¶
fastvideo.mlx_runtime.rife_interp.RIFEBackendError ¶
Bases: RuntimeError
Raised when the MLX RIFE backend cannot be loaded or run.
fastvideo.mlx_runtime.rife_interp.RIFEWeightsUnavailableError ¶
Bases: RIFEBackendError
Raised when uncached RIFE weights cannot be downloaded.
Functions:¶
fastvideo.mlx_runtime.rife_interp.aligned_keyframe_count ¶
Return the smallest VAE-aligned keyframe count that RIFE can expand to the target.
Source code in fastvideo/mlx_runtime/rife_interp.py
fastvideo.mlx_runtime.rife_interp.ensure_weights_available ¶
Resolve or download RIFE weights without constructing the MLX model.
Source code in fastvideo/mlx_runtime/rife_interp.py
fastvideo.mlx_runtime.rife_interp.interpolate ¶
interpolate(frames: list[ndarray] | Iterable[ndarray], factor: int = 2, *, model=None, scale: float = 1.0) -> list[ndarray]
Return an Nx interpolated frame list.
For len(frames)=41 and factor=2, the output length is 81: (41 - 1) * 2 + 1. Original keyframes are preserved in order and RIFE fills factor - 1 intermediate timesteps between each adjacent pair.
Source code in fastvideo/mlx_runtime/rife_interp.py
fastvideo.mlx_runtime.rife_interp.interpolate_pair ¶
interpolate_pair(frame_a: ndarray, frame_b: ndarray, timestep: float = 0.5, *, model=None, scale: float = 1.0) -> ndarray
Interpolate one RGB frame between two input RGB frames.
Source code in fastvideo/mlx_runtime/rife_interp.py
fastvideo.mlx_runtime.rife_interp.interpolate_to_frame_count ¶
interpolate_to_frame_count(frames: list[ndarray] | Iterable[ndarray], target_frames: int, *, model=None, scale: float = 1.0) -> list[ndarray]
Interpolate a sparse sequence to an exact frame count.
Unlike :func:interpolate, this accepts targets that are not an integer multiple of the source interval count. The first and last source frames remain the first and last output frames, and every intermediate output is evaluated at its uniformly spaced source-time position.
Source code in fastvideo/mlx_runtime/rife_interp.py
fastvideo.mlx_runtime.rife_interp.load_model cached ¶
Load the MLX-native RIFE model.
weights_dir is passed through to build_model in the vendored rife_mlx. When it is None, the package downloads/uses the Hugging Face mlx-community/RIFE-4.25 snapshot.