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 modelveo-3.1-generate-preview- Veo 3.1 previewveo-3.1-fast-generate-preview- Veo 3.1 Fast previewveo-3.0-generate-001- Veo 3.0 stableveo-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.
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
@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)
@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)
@type reference_type() :: String.t()
Reference image type for video generation.
Common values:
"asset"- Preserve the referenced subject"style"- Apply visual style
@type resolution() :: String.t()
Resolution for generated videos.
Supported values:
"720p"(default)"1080p"(up to 8s duration)
@type t() :: Gemini.Types.Generation.Video.VideoGenerationConfig.t()
Functions
@spec build_generation_params( String.t(), Gemini.Types.Generation.Video.VideoGenerationConfig.t() ) :: map()
Builds parameters map for video generation API request.
@spec complete?(Gemini.Types.Generation.Video.VideoOperation.t()) :: boolean()
Checks if a video operation is complete.
@spec extract_videos(Gemini.Types.Operation.t()) :: {:ok, [Gemini.Types.Generation.Video.GeneratedVideo.t()]} | {:error, term()}
Extracts generated videos from a completed operation.
@spec failed?(Gemini.Types.Generation.Video.VideoOperation.t()) :: boolean()
Checks if a video operation failed.
@spec format_compression_format(compression_format()) :: String.t()
Converts compression format to API format.
Examples
iex> format_compression_format(:h264)
"h264"
Converts person generation policy to API format.
Converts safety filter level to API format.
@spec parse_generated_video(map()) :: Gemini.Types.Generation.Video.GeneratedVideo.t()
Parses a generated video from API response.
@spec succeeded?(Gemini.Types.Generation.Video.VideoOperation.t()) :: boolean()
Checks if a video operation succeeded.
@spec wrap_operation(Gemini.Types.Operation.t()) :: Gemini.Types.Generation.Video.VideoOperation.t()
Wraps an Operation with video-specific metadata.