Skip to main content

lexigram-multimedia-interpolate

Video frame-rate interpolation for the Lexigram Framework — a local RIFE reference-server backend that doubles or quadruples a clip's frame rate by synthesizing midpoint frames.


Overview

lexigram-multimedia-interpolate synthesizes intermediate frames between two input frames (or between frames of a video) using a RIFE reference server, and registers a VideoInterpolationService for frame-level video interpolation when a VideoProcessor is available in the container.

Full documentation: docs.lexigram.dev

Install

uv add lexigram-multimedia-interpolate
# Optional extras
uv add "lexigram-multimedia-interpolate[rife-server]"  # RIFE server deps (torch)

Quick Start

from lexigram import Application
from lexigram.di.module import Module, module
from lexigram.multimedia.interpolate import InterpolationModule
from lexigram.contracts.multimedia.protocols import InterpolationProvider
from lexigram.contracts.multimedia.types import InterpolationRequest, MediaAsset


@module(imports=[InterpolationModule.configure()])
class AppModule(Module):
    pass


async def main() -> None:
    async with Application.boot(modules=[AppModule]) as app:
        interpolate = await app.container.resolve(InterpolationProvider)
        frame_a = MediaAsset(
            mime_type="image/png", provider="local", bytes_data=b"<png>"
        )
        frame_b = MediaAsset(
            mime_type="image/png", provider="local", bytes_data=b"<png>"
        )
        result = await interpolate.interpolate(
            InterpolationRequest(frame_a=frame_a, frame_b=frame_b)
        )
        if result.is_ok():
            midframe = result.unwrap()  # MediaAsset — synthesized midpoint frame


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

Configuration

Zero-config usage: Call InterpolationModule.configure() with no arguments to use the rife backend at http://localhost:5500.

Option 1 — YAML file

# application.yaml
multimedia:
  interpolate:
    backend: "rife"

Option 2 — Profiles + Environment Variables

export LEX_PROFILE=production
export LEX_MULTIMEDIA__INTERPOLATE__BACKEND=rife

Option 3 — Python

from lexigram.multimedia.interpolate import InterpolationModule
from lexigram.multimedia.interpolate.config import InterpolationConfig

InterpolationModule.configure(config=InterpolationConfig())

Interpolation is frame-pair based — InterpolationRequest(frame_a=..., frame_b=...). There is no configurable factor; InterpolationConfig only carries backend, rife_base_url, and timeout.

Config reference

Field Default Env var Description
backend "rife" LEX_MULTIMEDIA__INTERPOLATE__BACKEND rife
rife_base_url "http://localhost:5500" LEX_MULTIMEDIA__INTERPOLATE__RIFE_BASE_URL RIFE server URL
timeout 15.0 LEX_MULTIMEDIA__INTERPOLATE__TIMEOUT Request timeout in seconds

Module Factory Methods

Method Description
InterpolationModule.configure(config) Configure with explicit interpolation config
InterpolationModule.stub() Real module pinned to the default rife backend for tests

Key Features

  • RIFE backend — state-of-the-art frame interpolation via a local reference server
  • Video interpolationVideoInterpolationService for frame-level video interpolation (when VideoProcessor is available)
  • Reference serverlexigram-interpolate-rife-serve console script runs the RIFE model server
  • Result-basedinterpolate() -> Result[MediaAsset, MultimediaError]; errors are domain values, not exceptions

Testing

from lexigram import Application
from lexigram.multimedia.interpolate import InterpolationModule


async def test_boot():
    async with Application.boot(modules=[InterpolationModule.stub()]) as app:
        assert app.container is not None

Key Source Files

File What it contains
src/lexigram/multimedia/interpolate/module.py InterpolationModule.configure() and .stub()
src/lexigram/multimedia/interpolate/config.py InterpolationConfig
src/lexigram/multimedia/interpolate/di/provider.py InterpolationGenerationProvider — registers InterpolationProvider, wires task handlers
src/lexigram/multimedia/interpolate/providers/ Backend implementations (rife)
src/lexigram/multimedia/interpolate/servers/ Reference-server entry point (lexigram-interpolate-rife-serve)
src/lexigram/multimedia/interpolate/video_interpolation_service.py VideoInterpolationService — frame-level video interpolation
src/lexigram/multimedia/interpolate/tasks.py Background interpolation task handlers

Download files

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

Source Distribution

lexigram_multimedia_interpolate-0.1.4.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

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

lexigram_multimedia_interpolate-0.1.4-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file lexigram_multimedia_interpolate-0.1.4.tar.gz.

File metadata

File hashes

Hashes for lexigram_multimedia_interpolate-0.1.4.tar.gz
Algorithm Hash digest
SHA256 41d509b75a6f5d6f8b60fe60448d1da21558ddc0426ee2afb1381d67cb188d71
MD5 932cdc29bdc3344c8bcfd4c4be4e3bce
BLAKE2b-256 d69d6b75373cd73b3460d28c511dc571474a1bbb3acd428a44f98bb599a76527

See more details on using hashes here.

File details

Details for the file lexigram_multimedia_interpolate-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for lexigram_multimedia_interpolate-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 173817a26ef053a2956818465746c5b2eea4cd6078498a17ef7e11649be888c1
MD5 b8e500e7da54b1f871a7f1ea0e9993b4
BLAKE2b-256 2b527a3321ea6e36a829b882467c8fc09060491ba273b109bea6ca9c0cc6a2ac

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5008

1 file

0.1.5004

2 files

0.1.5001

2 files

0.1.3007

1 file

0.1.3006

1 file

0.1.3005

1 file

This release

0.1.4 This release

2 files

0.1.0

1 file

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