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_image(image_path[, prompt, model, ...])

Animate a static image into a video.

estimate_cost(duration[, resolution, provider])

Estimate the cost of video generation.

extend_video(video_path[, prompt, ...])

Extend an existing video with additional generated content.

generate_video(prompt, *[, model, duration, ...])

Generate a video from a text prompt.

generate_video_pika(prompt, *[, duration])

Generate video using Pika Labs.

generate_video_runway(prompt, *[, duration])

Generate video using Runway ML.

generate_video_stable_diffusion(prompt, *[, ...])

Generate video using Stable Diffusion Video.

get_available_providers()

Get list of available video generation providers.

interpolate_frames(video_path, *[, ...])

Interpolate frames to create smoother video.

Classes

GeneratedVideo([url, data, model, prompt, ...])

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: object

Wrapper 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
as_bytes()[source]

Get video as bytes.

Return type:

bytes

Returns:

Video data as bytes

save(path)[source]

Save video to file.

Parameters:

path (Union[str, Path]) – Output file path

Examples

>>> video.save("output.mp4")
wait_until_complete(max_wait=300, poll_interval=5)[source]

Wait for video generation to complete (for async operations).

Parameters:
  • max_wait (int) – Maximum time to wait in seconds

  • poll_interval (int) – Time between status checks in seconds

Raises:
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:
  • image_path (Union[str, Path]) – Path to the source image

  • prompt (str) – Optional text prompt to guide the animation

  • model (str) – Video generation model to use

  • duration (float) – Animation duration in seconds

  • motion_strength (float) – Strength of motion (0.0 to 1.0)

  • **kwargs – Additional provider-specific parameters

Return type:

GeneratedVideo

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:
  • duration (float) – Video duration in seconds

  • resolution (str) – Video resolution

  • provider (str) – Provider name (or None for all)

Return type:

dict

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:
  • video_path (Union[str, Path]) – Path to the source video

  • prompt (str) – Optional text prompt to guide the extension

  • extend_duration (float) – How many seconds to add

  • model (str) – Video generation model

  • **kwargs – Additional provider-specific parameters

Return type:

GeneratedVideo

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 generate

  • model (str) – Video generation model to use

  • duration (float) – Video duration in seconds (typically 2-10 seconds)

  • resolution (str) – Video resolution (‘1280x720’, ‘1920x1080’, etc.)

  • fps (int) – Frames per second

  • aspect_ratio (str) – Aspect ratio (‘16:9’, ‘9:16’, ‘1:1’, etc.)

  • style (str) – Video style hint (provider-specific)

  • seed (int) – Random seed for reproducibility

  • api_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:

GeneratedVideo

Returns:

GeneratedVideo object

Raises:

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:
  • prompt (str) – Text description

  • duration (float) – Video duration

  • **kwargs – Pika-specific parameters

Return type:

GeneratedVideo

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:
  • prompt (str) – Text description

  • duration (float) – Video duration

  • **kwargs – Runway-specific parameters

Return type:

GeneratedVideo

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:
  • prompt (str) – Text description

  • duration (float) – Video duration

  • **kwargs – SD-specific parameters

Return type:

GeneratedVideo

Returns:

GeneratedVideo object

aix.video.get_available_providers()[source]

Get list of available video generation providers.

Return type:

list[str]

Returns:

List of provider names that are configured

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:
  • video_path (Union[str, Path]) – Path to the source video

  • target_fps (int) – Target frames per second

  • model (str) – Frame interpolation model

  • **kwargs – Additional provider-specific parameters

Return type:

GeneratedVideo

Returns:

GeneratedVideo with interpolated frames

Examples

>>> from aix.video import interpolate_frames
>>> smooth_video = interpolate_frames(
...     "choppy.mp4",
...     target_fps=60
... )