or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

asset-dvr-management.mdchannel-management.mdclip-management.mdevent-management.mdindex.mdinput-management.mdpool-management.md
tile.json

tessl/pypi-google-cloud-video-live-stream

Google Cloud Video Live Stream API client library that transcodes mezzanine live signals into direct-to-consumer streaming formats, including Dynamic Adaptive Streaming over HTTP (DASH/MPEG-DASH), and HTTP Live Streaming (HLS), for multiple device platforms.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/google-cloud-video-live-stream@1.12.x

To install, run

npx @tessl/cli install tessl/pypi-google-cloud-video-live-stream@1.12.0

index.mddocs/

Google Cloud Video Live Stream

Google Cloud Video Live Stream API client library that transcodes mezzanine live signals into direct-to-consumer streaming formats, including Dynamic Adaptive Streaming over HTTP (DASH/MPEG-DASH) and HTTP Live Streaming (HLS), for multiple device platforms. This library provides comprehensive Python interface for managing live streaming workflows, channel configurations, input/output management, and real-time transcoding operations.

Package Information

  • Package Name: google-cloud-video-live-stream
  • Language: Python
  • Installation: pip install google-cloud-video-live-stream

Core Imports

from google.cloud.video import live_stream_v1

Individual client imports:

from google.cloud.video.live_stream_v1 import (
    LivestreamServiceClient,
    LivestreamServiceAsyncClient
)

Type imports:

from google.cloud.video.live_stream_v1.types.resources import (
    Channel, Input, Event, Asset, Pool
)
from google.cloud.video.live_stream_v1.types.service import (
    CreateChannelRequest, ListChannelsResponse
)

Basic Usage

from google.cloud.video import live_stream_v1
from google.cloud.video.live_stream_v1.types.resources import (
    Channel, Input, InputAttachment
)
from google.cloud.video.live_stream_v1.types.service import (
    CreateInputRequest, CreateChannelRequest, StartChannelRequest
)
from google.cloud.video.live_stream_v1.types.outputs import (
    ElementaryStream, VideoStream
)

# Create client with default credentials
client = live_stream_v1.LivestreamServiceClient()

# Create an input for receiving streams
input_resource = Input(
    type_=Input.Type.RTMP_PUSH,
    tier=Input.Tier.HD
)
input_request = CreateInputRequest(
    parent="projects/my-project/locations/us-central1",
    input_id="my-input",
    input=input_resource
)
input_operation = client.create_input(request=input_request)
created_input = input_operation.result()

# Create a channel for live streaming
channel_resource = Channel(
    input_attachments=[
        InputAttachment(
            key="input1",
            input=created_input.name
        )
    ],
    output=ElementaryStream(
        video_stream=VideoStream(
            h264=VideoStream.H264CodecSettings(
                bitrate_bps=1000000,
                frame_rate=30,
                height_pixels=720,
                width_pixels=1280
            )
        )
    )
)
channel_request = CreateChannelRequest(
    parent="projects/my-project/locations/us-central1",
    channel_id="my-channel",
    channel=channel_resource
)
channel_operation = client.create_channel(request=channel_request)
created_channel = channel_operation.result()

# Start the channel
start_request = StartChannelRequest(name=created_channel.name)
start_operation = client.start_channel(request=start_request)
start_response = start_operation.result()

Architecture

The Live Stream API follows a resource-oriented design with these core components:

  • Client: Primary interface (LivestreamServiceClient) with sync/async variants
  • Resources: Channel (streaming pipeline), Input (ingestion endpoint), Event (channel events), Asset (media assets), Pool (resource pools)
  • Operations: Long-running operations for channel lifecycle management
  • Types: Comprehensive type system with resources, outputs, and service request/response objects
  • Transport: Supports gRPC and REST protocols with automatic retry and authentication

Capabilities

Channel Management

Complete channel lifecycle management including creation, configuration, starting/stopping, and deletion of live streaming channels with support for multiple output formats and quality levels.

def create_channel(request: CreateChannelRequest) -> operation.Operation: ...
def list_channels(request: ListChannelsRequest) -> pagers.ListChannelsPager: ...
def get_channel(request: GetChannelRequest) -> Channel: ...
def delete_channel(request: DeleteChannelRequest) -> operation.Operation: ...
def update_channel(request: UpdateChannelRequest) -> operation.Operation: ...
def start_channel(request: StartChannelRequest) -> operation.Operation: ...
def stop_channel(request: StopChannelRequest) -> operation.Operation: ...

Channel Management

Input Management

Management of streaming input endpoints that receive live video streams via protocols like RTMP and SRT, with configuration for preprocessing, security rules, and stream properties.

def create_input(request: CreateInputRequest) -> operation.Operation: ...
def list_inputs(request: ListInputsRequest) -> pagers.ListInputsPager: ...
def get_input(request: GetInputRequest) -> Input: ...
def delete_input(request: DeleteInputRequest) -> operation.Operation: ...
def update_input(request: UpdateInputRequest) -> operation.Operation: ...

Input Management

Event Management

Creation and management of channel events for dynamic overlay insertion, ad breaks, and other time-based modifications to live streams during broadcast.

def create_event(request: CreateEventRequest) -> Event: ...
def list_events(request: ListEventsRequest) -> pagers.ListEventsPager: ...
def get_event(request: GetEventRequest) -> Event: ...
def delete_event(request: DeleteEventRequest) -> None: ...

Event Management

Asset and DVR Management

Management of media assets and Digital Video Recording (DVR) sessions for creating recordings, clips, and time-shifted viewing experiences from live streams.

def create_asset(request: CreateAssetRequest) -> operation.Operation: ...
def list_assets(request: ListAssetsRequest) -> pagers.ListAssetsPager: ...
def get_asset(request: GetAssetRequest) -> Asset: ...
def delete_asset(request: DeleteAssetRequest) -> operation.Operation: ...
def create_dvr_session(request: CreateDvrSessionRequest) -> DvrSession: ...
def list_dvr_sessions(request: ListDvrSessionsRequest) -> pagers.ListDvrSessionsPager: ...
def get_dvr_session(request: GetDvrSessionRequest) -> DvrSession: ...
def delete_dvr_session(request: DeleteDvrSessionRequest) -> None: ...
def update_dvr_session(request: UpdateDvrSessionRequest) -> DvrSession: ...

Asset and DVR Management

Clip Management

Creation and management of video clips extracted from live streams or DVR sessions, allowing users to create highlights and shareable content segments.

def list_clips(request: ListClipsRequest) -> pagers.ListClipsPager: ...
def get_clip(request: GetClipRequest) -> Clip: ...
def create_clip(request: CreateClipRequest) -> operation.Operation: ...
def delete_clip(request: DeleteClipRequest) -> operation.Operation: ...

Clip Management

Resource Pool Management

Management of resource pools that organize and control access to streaming resources across projects and regions.

def get_pool(request: GetPoolRequest) -> Pool: ...
def update_pool(request: UpdatePoolRequest) -> operation.Operation: ...

Resource Pool Management

Resource Path Utilities

Utilities for constructing and parsing Google Cloud resource names used throughout the Live Stream API.

@staticmethod
def asset_path(project: str, location: str, asset: str) -> str: ...
@staticmethod 
def channel_path(project: str, location: str, channel: str) -> str: ...
@staticmethod
def clip_path(project: str, location: str, channel: str, clip: str) -> str: ...
@staticmethod
def dvr_session_path(project: str, location: str, channel: str, dvr_session: str) -> str: ...
@staticmethod
def event_path(project: str, location: str, channel: str, event: str) -> str: ...
@staticmethod
def input_path(project: str, location: str, input: str) -> str: ...
@staticmethod
def pool_path(project: str, location: str, pool: str) -> str: ...
@staticmethod
def network_path(project: str, network: str) -> str: ...
@staticmethod
def secret_version_path(project: str, secret: str, version: str) -> str: ...
@staticmethod
def common_billing_account_path(billing_account: str) -> str: ...
@staticmethod
def common_folder_path(folder: str) -> str: ...
@staticmethod
def common_organization_path(organization: str) -> str: ...
@staticmethod
def common_project_path(project: str) -> str: ...
@staticmethod
def common_location_path(project: str, location: str) -> str: ...

@staticmethod
def parse_asset_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_channel_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_clip_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_dvr_session_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_event_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_input_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_pool_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_network_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_secret_version_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_common_billing_account_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_common_folder_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_common_organization_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_common_project_path(path: str) -> Dict[str, str]: ...
@staticmethod
def parse_common_location_path(path: str) -> Dict[str, str]: ...

Operations Management

Standard Google Cloud operations management for long-running operations.

def list_operations(
    self,
    request: operations_pb2.ListOperationsRequest = None,
    *,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> operations_pb2.ListOperationsResponse: ...

def get_operation(
    self,
    request: operations_pb2.GetOperationRequest = None,
    *,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> operations_pb2.Operation: ...

def delete_operation(
    self,
    request: operations_pb2.DeleteOperationRequest = None,
    *,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> None: ...

def cancel_operation(
    self,
    request: operations_pb2.CancelOperationRequest = None,
    *,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> None: ...

Locations Management

Standard Google Cloud locations management for service availability.

def get_location(
    self,
    request: locations_pb2.GetLocationRequest = None,
    *,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> locations_pb2.Location: ...

def list_locations(
    self,
    request: locations_pb2.ListLocationsRequest = None,
    *,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> locations_pb2.ListLocationsResponse: ...

Core Types

Client Types

class LivestreamServiceClient:
    """Main synchronous client for Live Stream API operations."""
    def __init__(self, *, credentials=None, transport=None, client_options=None) -> None: ...

class LivestreamServiceAsyncClient:
    """Asynchronous client for Live Stream API operations."""
    def __init__(self, *, credentials=None, transport=None, client_options=None) -> None: ...

Factory Methods

@classmethod
def from_service_account_info(
    cls,
    info: dict,
    *args,
    **kwargs
) -> LivestreamServiceClient:
    """Creates a client using service account information from a dictionary."""

@classmethod
def from_service_account_file(
    cls,
    filename: str,
    *args,
    **kwargs
) -> LivestreamServiceClient:
    """Creates a client using service account information from a JSON file."""

Client Properties

@property
def transport(self) -> LivestreamServiceTransport:
    """The transport used by the client instance."""

@property
def api_endpoint(self) -> str:
    """The API endpoint for the service."""

@property  
def universe_domain(self) -> str:
    """The universe domain for the service."""

Primary Resource Types

class Channel:
    """Live streaming channel configuration and state."""
    name: str
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    labels: MutableMapping[str, str]
    input_attachments: MutableSequence[InputAttachment]
    active_input: str
    output: ElementaryStream
    elementary_streams: MutableSequence[ElementaryStream]
    mux_streams: MutableSequence[MuxStream]
    manifests: MutableSequence[Manifest]
    sprite_sheets: MutableSequence[SpriteSheet]
    streaming_state: StreamingState
    streaming_error: status_pb2.Status
    log_config: LogConfig
    timecode_config: TimecodeConfig
    encryptions: MutableSequence[Encryption]

class Input:
    """Streaming input endpoint configuration."""
    name: str
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    labels: MutableMapping[str, str]
    type_: Type
    tier: Tier
    uri: str
    preprocessing_config: PreprocessingConfig
    security_rules: SecurityRule
    input_stream_property: InputStreamProperty

class Event:
    """Channel event for dynamic content insertion."""
    name: str
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    labels: MutableMapping[str, str]
    input_switch: InputSwitchTask
    ad_break: AdBreakTask
    return_to_program: ReturnToProgramTask
    slate: SlateTask
    mute: MuteTask
    unmute: UnmuteTask
    execute_now: bool
    execution_time: timestamp_pb2.Timestamp
    state: State
    error: status_pb2.Status

class Asset:
    """Media asset resource."""
    name: str
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    labels: MutableMapping[str, str]
    video: VideoAsset
    crc32c: str
    state: State
    error: status_pb2.Status

class DvrSession:
    """Digital Video Recording session."""
    name: str
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    labels: MutableMapping[str, str]
    start_time: timestamp_pb2.Timestamp
    end_time: timestamp_pb2.Timestamp
    retention_config: RetentionConfig
    dvr_end_time: timestamp_pb2.Timestamp
    state: State
    error: status_pb2.Status

class Pool:
    """Resource pool for organizing streaming resources."""
    name: str
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    labels: MutableMapping[str, str]
    network_config: NetworkConfig

class Clip:
    """Video clip extracted from streams."""
    name: str
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    labels: MutableMapping[str, str]
    start_time_offset: duration_pb2.Duration
    end_time_offset: duration_pb2.Duration
    clip_manifest_uri: str
    state: State
    error: status_pb2.Status

Request/Response Types

# Channel requests
class CreateChannelRequest:
    parent: str
    channel_id: str
    channel: Channel
    request_id: str

class ListChannelsRequest:
    parent: str
    page_size: int
    page_token: str
    filter: str
    order_by: str

class ListChannelsResponse:
    channels: MutableSequence[Channel]
    next_page_token: str
    unreachable: MutableSequence[str]

class GetChannelRequest:
    name: str

class DeleteChannelRequest:
    name: str
    request_id: str

class UpdateChannelRequest:
    update_mask: field_mask_pb2.FieldMask
    channel: Channel
    request_id: str

class StartChannelRequest:
    name: str
    request_id: str

class StopChannelRequest:
    name: str
    request_id: str

Output Configuration Types

class ElementaryStream:
    """Elementary stream configuration for video and audio streams."""
    key: str
    video_stream: VideoStream
    audio_stream: AudioStream
    text_stream: TextStream

class VideoStream:
    """Video stream configuration and encoding settings."""
    h264: H264CodecSettings
    h265: H265CodecSettings
    
    class H264CodecSettings:
        """H.264 video codec configuration."""
        bitrate_bps: int
        frame_rate: float
        height_pixels: int
        width_pixels: int
        aq_mode: str
        b_frames: int
        b_pyramid: bool
        entropy_coder: str
        gop_duration: duration_pb2.Duration
        keyframe_interval: int
        pixel_format: str
        preset: str
        profile: str
        rate_control_mode: str
        tune: str
        
    class H265CodecSettings:
        """H.265 video codec configuration."""
        bitrate_bps: int
        frame_rate: float
        height_pixels: int
        width_pixels: int

class AudioStream:
    """Audio stream configuration and encoding settings."""
    codec: str
    bitrate_bps: int
    channel_count: int
    channel_layout: MutableSequence[str]
    sample_rate_hertz: int
    language_code: str

class TextStream:
    """Text stream configuration for subtitles and captions."""
    codec: str
    language_code: str
    mapping: MutableSequence[TextMapping]
    
    class TextMapping:
        """Text stream mapping configuration."""
        atom_key: str
        input_key: str
        input_track: int

class MuxStream:
    """Multiplexed stream configuration combining elementary streams."""
    key: str
    container: str
    elementary_streams: MutableSequence[str]
    segment_settings: SegmentSettings
    encryption_id: str

class Manifest:
    """Output manifest configuration for HLS and DASH."""
    file_name: str
    type_: ManifestType
    mux_streams: MutableSequence[str]
    max_segment_count: int
    segment_keep_count: int
    
    class ManifestType(proto.Enum):
        """Manifest type enumeration."""
        MANIFEST_TYPE_UNSPECIFIED = 0
        HLS = 1
        DASH = 2

class SegmentSettings:
    """Segment configuration for streaming outputs."""
    segment_duration: duration_pb2.Duration
    individual_segments: bool
    
class SpriteSheet:
    """Sprite sheet configuration for video thumbnails."""
    format_: str
    file_prefix: str
    sprite_width_pixels: int
    sprite_height_pixels: int
    column_count: int
    row_count: int
    start_time_offset: duration_pb2.Duration
    end_time_offset: duration_pb2.Duration
    total_count: int
    interval: duration_pb2.Duration
    quality: int

class TimecodeConfig:
    """Timecode configuration for live streams."""
    source: TimecodeSource
    utc_offset: duration_pb2.Duration
    time_zone: TimeZone
    
    class TimecodeSource(proto.Enum):
        """Timecode source enumeration."""
        TIMECODE_SOURCE_UNSPECIFIED = 0
        EMBEDDED = 1
        MEDIA_TIMESTAMP = 2
        
    class TimeZone:
        """Time zone configuration."""
        id: str

class Encryption:
    """Encryption configuration for stream security."""
    id: str
    secret_manager_key_source: SecretManagerSource
    drm_systems: DrmSystems
    aes128: Aes128Encryption
    sample_aes: SampleAesEncryption
    mpeg_cenc: MpegCommonEncryption
    
    class SecretManagerSource:
        """Secret Manager key source."""
        secret: str
        version: str

class LogConfig:
    """Logging configuration for channels."""
    log_severity: LogSeverity
    
    class LogSeverity(proto.Enum):
        """Log severity levels."""
        LOG_SEVERITY_UNSPECIFIED = 0
        OFF = 1
        DEBUG = 100
        INFO = 200
        WARNING = 400
        ERROR = 500

class StaticOverlay:
    """Static overlay configuration for channels."""
    asset: str
    resolution: NormalizedResolution
    position: NormalizedCoordinate
    opacity: float
    
    class NormalizedCoordinate:
        """Normalized coordinate for positioning overlays."""
        x: float
        y: float
        
    class NormalizedResolution:
        """Normalized resolution for overlay sizing."""
        w: float
        h: float

class TimeInterval:
    """Time interval specification."""
    start_time: timestamp_pb2.Timestamp
    end_time: timestamp_pb2.Timestamp

class NetworkConfig:
    """Network configuration for resource pools."""
    peered_network: str

Operation Types

class OperationMetadata:
    """Metadata for long-running operations."""
    create_time: timestamp_pb2.Timestamp
    end_time: timestamp_pb2.Timestamp
    target: str
    verb: str
    status_message: str
    requested_cancellation: bool
    api_version: str

class ChannelOperationResponse:
    """Response for channel operations."""
    pass