Skip to main content

lexigram-multimedia-video

Video generation and processing for the Lexigram Framework — local and API-based backends (local-http, runway, openai, wan22, cogvideox, svd, comfyui) plus an ffmpeg-backed VideoProcessor.


Overview

lexigram-multimedia-video generates video from a text prompt and edits existing clips. The default backend calls a local HTTP reference server (http://localhost:5004) so the package works out of the box with no API keys; hosted backends (Runway, OpenAI), ComfyUI workflows, and local reference servers (Wan2.2, CogVideoX, SVD) are selectable via config. A built-in VideoProcessor provides ffmpeg-based editing (trim, concat, overlay, transcode, subtitles, GIF, and more).

Full documentation: docs.lexigram.dev

Install

uv add lexigram-multimedia-video
# Optional extras
uv add "lexigram-multimedia-video[runway]"            # Runway API
uv add "lexigram-multimedia-video[openai]"            # OpenAI Sora API
uv add "lexigram-multimedia-video[cogvideox-server]"  # local CogVideoX server (torch)
uv add "lexigram-multimedia-video[svd-server]"        # local SVD server (torch)

Quick Start

from lexigram import Application
from lexigram.di.module import Module, module
from lexigram.multimedia.video import VideoModule
from lexigram.contracts.multimedia import VideoProvider, VideoRequest


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


async def main() -> None:
    async with Application.boot(modules=[AppModule]) as app:
        video = await app.container.resolve(VideoProvider)
        result = await video.generate(
            VideoRequest(prompt="a drone flying over mountains")
        )
        if result.is_ok():
            asset = result.unwrap()  # MediaAsset — video bytes or URI


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

Configuration

Zero-config usage: Call VideoModule.configure() with no arguments to use the local-http backend at http://localhost:5004.

Option 1 — YAML file

# application.yaml
multimedia:
  video:
    backend: "comfyui"
    comfyui_base_url: "http://localhost:8188"
    processing:
      max_concurrent_jobs: 4

Option 2 — Profiles + Environment Variables

export LEX_PROFILE=production
export LEX_MULTIMEDIA__VIDEO__BACKEND=runway
export LEX_MULTIMEDIA__VIDEO__PROCESSING__MAX_CONCURRENT_JOBS=4

Option 3 — Python

from lexigram.multimedia.video import VideoModule
from lexigram.multimedia.video.config import VideoConfig, VideoProcessingConfig

VideoModule.configure(
    config=VideoConfig(
        backend="comfyui",
        processing=VideoProcessingConfig(max_concurrent_jobs=4),
    )
)

Config reference

Field Default Env var Description
backend "local-http" LEX_MULTIMEDIA__VIDEO__BACKEND local-http, runway, openai, wan22, cogvideox, svd, comfyui
local_http_base_url "http://localhost:5004" LEX_MULTIMEDIA__VIDEO__LOCAL_HTTP_BASE_URL Local reference server URL
runway_api_key_secret_name "runway_api_key" LEX_MULTIMEDIA__VIDEO__RUNWAY_API_KEY_SECRET_NAME Secret name for the Runway API key
openai_api_key_secret_name "openai_api_key" LEX_MULTIMEDIA__VIDEO__OPENAI_API_KEY_SECRET_NAME Secret name for the OpenAI API key
openai_model "sora-2" LEX_MULTIMEDIA__VIDEO__OPENAI_MODEL OpenAI video model
openai_base_url "https://api.openai.com" LEX_MULTIMEDIA__VIDEO__OPENAI_BASE_URL OpenAI-compatible base URL
wan22_base_url "http://localhost:5200" LEX_MULTIMEDIA__VIDEO__WAN22_BASE_URL Wan2.2 server URL
cogvideox_base_url "http://localhost:5201" LEX_MULTIMEDIA__VIDEO__COGVIDEOX_BASE_URL CogVideoX server URL
svd_base_url "http://localhost:5202" LEX_MULTIMEDIA__VIDEO__SVD_BASE_URL SVD server URL
comfyui_base_url "http://localhost:8188" LEX_MULTIMEDIA__VIDEO__COMFYUI_BASE_URL ComfyUI server URL
comfyui_checkpoint "svd_xt_1_1.safetensors" LEX_MULTIMEDIA__VIDEO__COMFYUI_CHECKPOINT ComfyUI checkpoint name
comfyui_workflow_path None LEX_MULTIMEDIA__VIDEO__COMFYUI_WORKFLOW_PATH Path to a custom ComfyUI workflow JSON
comfyui_fps 6 LEX_MULTIMEDIA__VIDEO__COMFYUI_FPS Output frames per second
comfyui_motion_bucket_id 127 LEX_MULTIMEDIA__VIDEO__COMFYUI_MOTION_BUCKET_ID SVD motion bucket
comfyui_poll_interval 1.0 LEX_MULTIMEDIA__VIDEO__COMFYUI_POLL_INTERVAL ComfyUI progress poll interval in seconds
timeout 60.0 LEX_MULTIMEDIA__VIDEO__TIMEOUT Request timeout in seconds
processing.ffmpeg_binary "ffmpeg" LEX_MULTIMEDIA__VIDEO__PROCESSING__FFMPEG_BINARY ffmpeg executable path
processing.max_concurrent_jobs 2 LEX_MULTIMEDIA__VIDEO__PROCESSING__MAX_CONCURRENT_JOBS Max concurrent ffmpeg jobs
processing.temp_dir None LEX_MULTIMEDIA__VIDEO__PROCESSING__TEMP_DIR Temp dir for intermediate frames
processing.timeout 300.0 LEX_MULTIMEDIA__VIDEO__PROCESSING__TIMEOUT Processing job timeout in seconds

Module Factory Methods

Method Description
VideoModule.configure(config) Configure with explicit video config
VideoModule.stub() Real module pinned to the default local-http backend for tests

Key Features

  • Seven generation backendslocal-http, runway, openai, wan22, cogvideox, svd, comfyui
  • VideoProcessor — ffmpeg-backed editing: trim, concat, overlays, composition, subtitles, audio mux, thumbnails, GIF, transcode, speed, crop, color filters, raw filter graphs
  • Reference serverslexigram-video-*-serve console scripts run each local model server
  • Secret-managed API keys — provider keys resolved by name through the secrets backend
  • Result-basedgenerate() -> Result[MediaAsset, MultimediaError]; errors are domain values, not exceptions

Testing

from lexigram import Application
from lexigram.multimedia.video import VideoModule


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

Key Source Files

File What it contains
src/lexigram/multimedia/video/module.py VideoModule.configure() and .stub()
src/lexigram/multimedia/video/config.py VideoConfig, VideoProcessingConfig
src/lexigram/multimedia/video/di/provider.py VideoGenerationProvider — registers VideoProvider + VideoProcessor, wires task handlers
src/lexigram/multimedia/video/providers/ Generation backends (local_http, runway, openai, wan22, cogvideox, svd, comfyui)
src/lexigram/multimedia/video/processing/ ffmpeg-backed VideoProcessor (argv, ffmpeg, media I/O)
src/lexigram/multimedia/video/servers/ Reference-server entry points (lexigram-video-*-serve)
src/lexigram/multimedia/video/tasks.py Background generation task handlers
src/lexigram/multimedia/video/exceptions.py VideoGenerationError hierarchy

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_video-0.1.5004.tar.gz (64.6 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_video-0.1.5004-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file lexigram_multimedia_video-0.1.5004.tar.gz.

File metadata

File hashes

Hashes for lexigram_multimedia_video-0.1.5004.tar.gz
Algorithm Hash digest
SHA256 c198a8374e12ceac74a021042c671cf5925deec027d055d000331c8da96ae698
MD5 a2359d385e69a144cd8b4cd0b1223bf1
BLAKE2b-256 eb29c5dd58cab77f4139223ae07f2b5ddab0584157afb75ceff94408a3555ceb

See more details on using hashes here.

File details

Details for the file lexigram_multimedia_video-0.1.5004-py3-none-any.whl.

File metadata

File hashes

Hashes for lexigram_multimedia_video-0.1.5004-py3-none-any.whl
Algorithm Hash digest
SHA256 3c6d4c4f77dd707722cf260659e4d8e1b5ae6f75522e2dab3198a7b66b2d6f7e
MD5 9a9214c49c2fc3ced748bf6c88fed112
BLAKE2b-256 607377f8a149cf9dabb91ece95137d9f3d74186912636d2dfa2239a4076994d4

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5008

1 file

This release

0.1.5004 This release

2 files

0.1.5001

2 files

0.1.3007

1 file

0.1.3006

1 file

0.1.3005

1 file

0.1.4

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