Gemini.Types.Generation.Video (GeminiEx v0.9.0)

Copy Markdown View Source

Type definitions for video generation using Google's Veo models.

Veo is Google's advanced text-to-video generation model that creates high-quality videos from text descriptions. Video generation is a long-running operation that requires polling to check completion status.

Supported Models

  • veo-2.0-generate-001 - Veo 2.0 video generation model
  • veo-3.1-generate-preview - Veo 3.1 preview
  • veo-3.1-fast-generate-preview - Veo 3.1 Fast preview
  • veo-3.0-generate-001 - Veo 3.0 stable
  • veo-3.0-fast-generate-001 - Veo 3.0 Fast stable

Example

config = %VideoGenerationConfig{
  number_of_videos: 1,
  duration_seconds: 8,
  aspect_ratio: "16:9"
}

{:ok, operation} = Gemini.APIs.Videos.generate(
  "A cat playing piano in a cozy living room",
  config
)

# Wait for completion
{:ok, completed} = Gemini.APIs.Operations.wait(operation.name)

# Get video URLs
videos = completed.response["generatedVideos"]

See Gemini.APIs.Videos for API functions.

Summary

Types

Aspect ratio for generated videos.

Video compression format.

Reference image type for video generation.

Resolution for generated videos.

t()

Functions

Builds parameters map for video generation API request.

Checks if a video operation is complete.

Extracts generated videos from a completed operation.

Checks if a video operation failed.

Converts compression format to API format.

Converts person generation policy to API format.

Converts safety filter level to API format.

Parses a generated video from API response.

Checks if a video operation succeeded.

Wraps an Operation with video-specific metadata.

Types

aspect_ratio()

@type aspect_ratio() :: String.t()

Aspect ratio for generated videos.

Common aspect ratios:

  • "9:16" - Vertical/mobile (e.g., 720x1280)
  • "16:9" - Horizontal/desktop (e.g., 1280x720)
  • "1:1" - Square (e.g., 1024x1024)

compression_format()

@type compression_format() :: :h264 | :h265

Video compression format.

  • :h264 - H.264/AVC compression (default, widely compatible)
  • :h265 - H.265/HEVC compression (better quality, smaller size)

reference_type()

@type reference_type() :: String.t()

Reference image type for video generation.

Common values:

  • "asset" - Preserve the referenced subject
  • "style" - Apply visual style

resolution()

@type resolution() :: String.t()

Resolution for generated videos.

Supported values:

  • "720p" (default)
  • "1080p" (up to 8s duration)

t()

Functions

build_generation_params(prompt, config)

@spec build_generation_params(
  String.t(),
  Gemini.Types.Generation.Video.VideoGenerationConfig.t()
) ::
  map()

Builds parameters map for video generation API request.

complete?(video_operation)

Checks if a video operation is complete.

extract_videos(operation)

@spec extract_videos(Gemini.Types.Operation.t()) ::
  {:ok, [Gemini.Types.Generation.Video.GeneratedVideo.t()]} | {:error, term()}

Extracts generated videos from a completed operation.

failed?(video_operation)

Checks if a video operation failed.

format_compression_format(atom)

@spec format_compression_format(compression_format()) :: String.t()

Converts compression format to API format.

Examples

iex> format_compression_format(:h264)
"h264"

format_person_generation(atom)

@spec format_person_generation(atom()) :: String.t()

Converts person generation policy to API format.

format_safety_filter_level(atom)

@spec format_safety_filter_level(atom()) :: String.t()

Converts safety filter level to API format.

parse_generated_video(data)

@spec parse_generated_video(map()) :: Gemini.Types.Generation.Video.GeneratedVideo.t()

Parses a generated video from API response.

succeeded?(video_operation)

Checks if a video operation succeeded.

wrap_operation(operation)

Wraps an Operation with video-specific metadata.