aix.video¶
Video generation interface for AIX.
Generate videos from text descriptions or images.
Note
Video generation support varies by provider and may require additional API keys and configuration. This module provides a unified interface but implementation depends on available providers.
Examples
Text to video:
>>> from aix.video import generate_video
>>> video = generate_video(
... "A cat walking through a garden",
... duration=5
... )
>>> video.save("cat_video.mp4")
Image to video:
>>> video = animate_image(
... "static_image.jpg",
... prompt="Make the clouds move gently"
... )
Functions
|
Animate a static image into a video. |
|
Estimate the cost of video generation. |
|
Extend an existing video with additional generated content. |
|
Generate a video from a text prompt. |
|
Generate video using Pika Labs. |
|
Generate video using Runway ML. |
|
Generate video using Stable Diffusion Video. |
Get list of available video generation providers. |
|
|
Interpolate frames to create smoother video. |
Classes
|
Wrapper for generated videos. |
- class aix.video.GeneratedVideo(url=None, data=None, model=None, prompt=None, duration=None, resolution=None, status='completed', task_id=None)[source]¶
Bases:
objectWrapper for generated videos.
Provides convenient access to video data and metadata.
Examples
>>> video = GeneratedVideo(url="https://...") >>> video.save("output.mp4") >>> print(video.duration) 5.0
- wait_until_complete(max_wait=300, poll_interval=5)[source]¶
Wait for video generation to complete (for async operations).
- Parameters:
- Raises:
TimeoutError – If generation doesn’t complete within max_wait
RuntimeError – If generation fails
- aix.video.animate_image(image_path, prompt=None, *, model=None, duration=3.0, motion_strength=0.5, **kwargs)[source]¶
Animate a static image into a video.
- Parameters:
- Return type:
- Returns:
GeneratedVideo object
Examples
>>> from aix.video import animate_image >>> video = animate_image( ... "landscape.jpg", ... prompt="Gentle camera pan across the scene", ... duration=4 ... ) >>> video.save("animated_landscape.mp4")
- aix.video.estimate_cost(duration, resolution='1280x720', provider=None)[source]¶
Estimate the cost of video generation.
- Parameters:
- Return type:
- Returns:
Dict with cost estimates
Examples
>>> from aix.video import estimate_cost >>> cost = estimate_cost(duration=5, resolution="1920x1080") >>> print(cost) {'runway': 0.05, 'pika': 0.03}
- aix.video.extend_video(video_path, prompt=None, *, extend_duration=2.0, model=None, **kwargs)[source]¶
Extend an existing video with additional generated content.
- Parameters:
- Return type:
- Returns:
GeneratedVideo object with extended content
Examples
>>> from aix.video import extend_video >>> extended = extend_video( ... "original.mp4", ... prompt="Continue the same scene", ... extend_duration=3 ... )
- aix.video.generate_video(prompt, *, model=None, duration=5.0, resolution='1280x720', fps=24, aspect_ratio=None, style=None, seed=None, api_key=None, **kwargs)[source]¶
Generate a video from a text prompt.
Note
This is a high-level interface. Actual implementation depends on available video generation providers (Runway, Pika, etc.) and may require provider-specific API keys.
- Parameters:
prompt (
str) – Text description of the video to generatemodel (
str) – Video generation model to useduration (
float) – Video duration in seconds (typically 2-10 seconds)resolution (
str) – Video resolution (‘1280x720’, ‘1920x1080’, etc.)fps (
int) – Frames per secondaspect_ratio (
str) – Aspect ratio (‘16:9’, ‘9:16’, ‘1:1’, etc.)style (
str) – Video style hint (provider-specific)seed (
int) – Random seed for reproducibilityapi_key (
str) – Explicit API key for the video provider. If None, resolved from the environment / .env / AIX config store (see aix.credentials).**kwargs – Additional provider-specific parameters
- Return type:
- Returns:
GeneratedVideo object
- Raises:
NotImplementedError – If no video provider is configured
ImportError – If required provider SDK is not installed
Examples
>>> from aix.video import generate_video >>> video = generate_video( ... "A serene ocean sunset with gentle waves", ... duration=5, ... resolution="1920x1080" ... ) >>> video.save("sunset.mp4")
>>> # Specific style >>> video = generate_video( ... "A futuristic city", ... style="cyberpunk", ... duration=4 ... )
- aix.video.generate_video_pika(prompt, *, duration=3.0, **kwargs)[source]¶
Generate video using Pika Labs.
Requires: PIKA_API_KEY environment variable
- Parameters:
- Return type:
- Returns:
GeneratedVideo object
- aix.video.generate_video_runway(prompt, *, duration=5.0, **kwargs)[source]¶
Generate video using Runway ML.
Requires: RUNWAY_API_KEY environment variable
- Parameters:
- Return type:
- Returns:
GeneratedVideo object
- aix.video.generate_video_stable_diffusion(prompt, *, duration=2.0, **kwargs)[source]¶
Generate video using Stable Diffusion Video.
Requires: Stable Diffusion Video model setup
- Parameters:
- Return type:
- Returns:
GeneratedVideo object
- aix.video.get_available_providers()[source]¶
Get list of available video generation providers.
Examples
>>> from aix.video import get_available_providers >>> providers = get_available_providers() >>> print(providers) ['runway', 'pika']
- aix.video.interpolate_frames(video_path, *, target_fps=60, model=None, **kwargs)[source]¶
Interpolate frames to create smoother video.
- Parameters:
- Return type:
- Returns:
GeneratedVideo with interpolated frames
Examples
>>> from aix.video import interpolate_frames >>> smooth_video = interpolate_frames( ... "choppy.mp4", ... target_fps=60 ... )